mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 12:36:41 +00:00
Compare commits
56 Commits
v5.0-mc1.9
...
V5.1-alpha
Author | SHA1 | Date | |
---|---|---|---|
3c09bc7995 | |||
13dc0a25be | |||
299e0ccd4a | |||
4f6d32330b | |||
089fc0670d | |||
b55ca70056 | |||
3bc8adfb98 | |||
3668c5e9d6 | |||
1971910178 | |||
655d7471dc | |||
2c5ac7297d | |||
e16714ea6c | |||
c4ebbb74c7 | |||
8c424a45f9 | |||
98f0fdb620 | |||
26c83ff585 | |||
f97de65787 | |||
30a6b7a442 | |||
5d7aa8913b | |||
f25207104c | |||
c6a2496d72 | |||
baf73df4f9 | |||
5ffbc9e8a4 | |||
7245de1513 | |||
d2503da298 | |||
c8fb54182e | |||
f3130f5cfc | |||
6e6842dbd2 | |||
28142a6883 | |||
0bb5265b77 | |||
60b143e248 | |||
aaeee0d36e | |||
7b183612e4 | |||
0eb0c7a02f | |||
475b299e37 | |||
be8203a832 | |||
9fa4c0662c | |||
c10b08df27 | |||
25fafa7a6c | |||
2ff66ad54b | |||
1e47d29adf | |||
2008871658 | |||
cadf4e4fc7 | |||
662cef44d5 | |||
c885bbb144 | |||
f2260d56a4 | |||
174a782759 | |||
6a86f66cf6 | |||
b153debdef | |||
71c46b5431 | |||
580e88d1a9 | |||
92a7e354ba | |||
6a004a9f35 | |||
91506480b7 | |||
e8e0e9988a | |||
1a16f06ac6 |
12
.travis.yml
Normal file
12
.travis.yml
Normal file
@ -0,0 +1,12 @@
|
||||
language: java
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
notifications:
|
||||
email: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- sshpass
|
||||
script: mvn clean install
|
||||
after_success:
|
||||
- ./travis-upload.sh
|
11
README.md
11
README.md
@ -1,5 +1,8 @@
|
||||
# TotalFreedomMod #
|
||||
|
||||
|
||||
[](https://travis-ci.org/TotalFreedom/TotalFreedomMod)
|
||||
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, you are more than welcome to adapt the source for your own server.
|
||||
|
||||
This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van der Sar (Prozza) becoming heavily involved in its development some time later. It consists of over 85 custom coded commands and a large variety of distinguishable features not included in any other plugin. The plugin has since its beginning grown immensely. Together, with the main TotalFreedom server, TotalFreedomMod has a long-standing reputation of effectiveness whilst maintaining a clear feeling of openness towards the administrators and the players themselves.
|
||||
@ -7,5 +10,11 @@ This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van d
|
||||
### Download ###
|
||||
You may download official binaries from the [releases page](https://github.com/TotalFreedom/TotalFreedomMod/releases).
|
||||
|
||||
Additionally, Travis CI generates a binary for each commit to the repository. While they might not be stable or 100% functional, these binaries are accessible at [tfmbuilds.win](https://tfmbuilds.win/).
|
||||
|
||||
### Contributing ###
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in developing TotalFreedomMod. For information on how TotalFreedomMod is licensed, please see [LICENSE.md](LICENSE.md).
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in developing TotalFreedomMod.
|
||||
|
||||
For information on how TotalFreedomMod is licensed, please see [LICENSE.md](LICENSE.md).
|
||||
|
||||
Please [join our Discord server](https://discord.gg/fb9J2TD) for any discussion on TFM development and other TotalFreedom Organization projects.
|
||||
|
78
pom.xml
78
pom.xml
@ -11,7 +11,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<tfm.build.version>${project.version}</tfm.build.version>
|
||||
<tfm.build.codename>Electrum</tfm.build.codename>
|
||||
<tfm.build.number>${maven.buildnumber}</tfm.build.number>
|
||||
<!-- <tfm.build.number>${maven.buildnumber}</tfm.build.number> -->
|
||||
<tfm.build.date>${maven.build.timestamp}</tfm.build.date>
|
||||
<tfm.build.author>${buildAuthor}</tfm.build.author>
|
||||
<tfm.build.head>${buildHead}</tfm.build.head>
|
||||
@ -43,59 +43,83 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
<id>ess-repo</id>
|
||||
<url>http://repo.ess3.net</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<!-- <repository>
|
||||
<id>elmakers-repo</id>
|
||||
<url>http://maven.elmakers.com/repository/</url>
|
||||
</repository>-->
|
||||
<repository>
|
||||
<id>sk89q-snapshots</id>
|
||||
<url>http://maven.sk89q.com/artifactory/repo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Spigot-1.9.jar</systemPath>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12-pre5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.pravian</groupId>
|
||||
<artifactId>aero</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Aero-2.0.jar</systemPath>
|
||||
<groupId>com.github.Pravian</groupId>
|
||||
<artifactId>Aero</artifactId>
|
||||
<version>a0e1dc5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.totalfreedom</groupId>
|
||||
<artifactId>bukkittelnet</artifactId>
|
||||
<version>4.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/BukkitTelnet-4.3.jar</systemPath>
|
||||
<groupId>com.github.TotalFreedom</groupId>
|
||||
<artifactId>BukkitTelnet</artifactId>
|
||||
<version>4.5-pre1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.totalfreedom</groupId>
|
||||
<artifactId>tf-worldedit</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.TotalFreedom.TF-WorldEdit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>6.1.0-TF</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/TF-WorldEdit-6.1.1.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.totalfreedom</groupId>
|
||||
<artifactId>tf-essentials</artifactId>
|
||||
<version>2.0-TF</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/TF-Essentials-2.1.jar</systemPath>
|
||||
<groupId>com.github.TotalFreedom.TF-WorldEdit</groupId>
|
||||
<artifactId>worldedit-core</artifactId>
|
||||
<version>6.1.0-TF</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -51,10 +51,10 @@ public class ChatManager extends FreedomService
|
||||
// Strip color from messages
|
||||
message = ChatColor.stripColor(message);
|
||||
|
||||
// Truncate messages that are too long - 100 characters is vanilla client max
|
||||
if (message.length() > 100)
|
||||
// Truncate messages that are too long - 256 characters is vanilla client max
|
||||
if (message.length() > 256)
|
||||
{
|
||||
message = message.substring(0, 100);
|
||||
message = message.substring(0, 256);
|
||||
FSync.playerMsg(player, "Message was shortened because it was too long to send.");
|
||||
}
|
||||
|
||||
|
@ -6,28 +6,36 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
public class CommandSpy extends FreedomService {
|
||||
public class CommandSpy extends FreedomService
|
||||
{
|
||||
|
||||
public CommandSpy(TotalFreedomMod plugin) {
|
||||
public CommandSpy(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
protected void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
protected void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if (plugin.al.isAdmin(event.getPlayer())) {
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (plugin.al.isAdmin(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).cmdspyEnabled()) {
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).cmdspyEnabled())
|
||||
{
|
||||
FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Boat;
|
||||
@ -25,16 +28,16 @@ import org.bukkit.entity.ThrownExpBottle;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class EntityWiper extends FreedomService
|
||||
{
|
||||
|
||||
private static final long WIPE_RATE = 5 * 20L;
|
||||
public static final long ENTITY_WIPE_RATE = 5 * 20L;
|
||||
public static final long ITEM_DESPAWN_RATE = 20L * 20L;
|
||||
public static final int CHUNK_ENTITY_MAX = 20;
|
||||
//
|
||||
private final List<Class<? extends Entity>> wipables = new ArrayList<>();
|
||||
//
|
||||
@ -53,6 +56,10 @@ public class EntityWiper extends FreedomService
|
||||
wipables.add(ThrownPotion.class);
|
||||
wipables.add(ThrownExpBottle.class);
|
||||
wipables.add(AreaEffectCloud.class);
|
||||
wipables.add(Minecart.class);
|
||||
wipables.add(Boat.class);
|
||||
wipables.add(FallingBlock.class);
|
||||
wipables.add(ArmorStand.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,9 +76,9 @@ public class EntityWiper extends FreedomService
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
wipeEntities(!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean(), false);
|
||||
wipeEntities(false);
|
||||
}
|
||||
}.runTaskTimer(plugin, WIPE_RATE, WIPE_RATE);
|
||||
}.runTaskTimer(plugin, ENTITY_WIPE_RATE, ENTITY_WIPE_RATE);
|
||||
|
||||
}
|
||||
|
||||
@ -82,32 +89,11 @@ public class EntityWiper extends FreedomService
|
||||
wipeTask = null;
|
||||
}
|
||||
|
||||
public boolean canWipe(Entity entity, boolean wipeExplosives, boolean wipeVehicles)
|
||||
public boolean isWipeable(Entity entity)
|
||||
{
|
||||
if (wipeExplosives)
|
||||
for (Class<? extends Entity> c : wipables)
|
||||
{
|
||||
if (Explosive.class.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (wipeVehicles)
|
||||
{
|
||||
if (Boat.class.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (Minecart.class.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<Class<? extends Entity>> it = wipables.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
if (it.next().isAssignableFrom(entity.getClass()))
|
||||
if (c.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -116,44 +102,91 @@ public class EntityWiper extends FreedomService
|
||||
return false;
|
||||
}
|
||||
|
||||
public int wipeEntities(boolean wipeExplosives, boolean wipeVehicles)
|
||||
public int wipeEntities(boolean force)
|
||||
{
|
||||
int removed = 0;
|
||||
|
||||
Iterator<World> worlds = Bukkit.getWorlds().iterator();
|
||||
while (worlds.hasNext())
|
||||
{
|
||||
Iterator<Entity> entities = worlds.next().getEntities().iterator();
|
||||
removed += wipeEntities(worlds.next(), force);
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
public int wipeEntities(World world, boolean force)
|
||||
{
|
||||
int removed = 0;
|
||||
|
||||
boolean wipeExpl = ConfigEntry.ALLOW_EXPLOSIONS.getBoolean();
|
||||
Iterator<Entity> entities = world.getEntities().iterator();
|
||||
|
||||
// Organise the entities in the world
|
||||
Map<Chunk, List<Entity>> cem = new HashMap<>();
|
||||
while (entities.hasNext())
|
||||
{
|
||||
Entity entity = entities.next();
|
||||
if (canWipe(entity, wipeExplosives, wipeVehicles))
|
||||
final Entity entity = entities.next();
|
||||
|
||||
// Explosives
|
||||
if (wipeExpl && Explosive.class.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
entity.remove();
|
||||
removed++;
|
||||
}
|
||||
|
||||
// Only wipeable entities can be wiped (duh!)
|
||||
if (!isWipeable(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Chunk c = entity.getLocation().getChunk();
|
||||
List<Entity> cel = cem.get(c);
|
||||
if (cel == null)
|
||||
{
|
||||
cem.put(c, new ArrayList<>(Arrays.asList(entity)));
|
||||
}
|
||||
else
|
||||
{
|
||||
cel.add(entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Now purge the entities if necessary
|
||||
for (Chunk c : cem.keySet())
|
||||
{
|
||||
List<Entity> cel = cem.get(c);
|
||||
|
||||
if (!force && cel.size() < CHUNK_ENTITY_MAX)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Too many entities in this chunk, wipe them all
|
||||
for (Entity e : cel)
|
||||
{
|
||||
e.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onContainerBreak(BlockBreakEvent event)
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onItemSpawn(ItemSpawnEvent event)
|
||||
{
|
||||
if (!ConfigEntry.AUTO_ENTITY_WIPE.getBoolean())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Item entity = event.getEntity();
|
||||
|
||||
BlockState state = event.getBlock().getState();
|
||||
if (!(state instanceof InventoryHolder))
|
||||
new BukkitRunnable()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Inventory inv = ((InventoryHolder) state).getInventory();
|
||||
inv.clear();
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
entity.remove();
|
||||
}
|
||||
}.runTaskLater(plugin, ITEM_DESPAWN_RATE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ public class FrontDoor extends FreedomService
|
||||
case 3: // Displays a message
|
||||
{
|
||||
FUtil.bcastMsg("TotalFreedom rocks!!", ChatColor.BLUE);
|
||||
FUtil.bcastMsg("To join this great server, join " + ChatColor.GOLD + "tf.sauc.in", ChatColor.BLUE);
|
||||
FUtil.bcastMsg("To join this great server, join " + ChatColor.GOLD + "play.totalfreedom.me", ChatColor.BLUE);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -472,7 +472,7 @@ public class FrontDoor extends FreedomService
|
||||
sign.setLine(0, ChatColor.BLUE + "TotalFreedom");
|
||||
sign.setLine(1, ChatColor.DARK_GREEN + "is");
|
||||
sign.setLine(2, ChatColor.YELLOW + "Awesome!");
|
||||
sign.setLine(3, ChatColor.DARK_GRAY + "tf.sauc.in");
|
||||
sign.setLine(3, ChatColor.DARK_GRAY + "play.totalfreedom.me");
|
||||
sign.update();
|
||||
}
|
||||
break;
|
||||
@ -501,7 +501,7 @@ public class FrontDoor extends FreedomService
|
||||
ChatColor.DARK_GREEN + "Why you should go to TotalFreedom instead\n"
|
||||
+ ChatColor.DARK_GRAY + "---------\n"
|
||||
+ ChatColor.BLACK + "TotalFreedom is the original TotalFreedomMod server. It is the very server that gave freedom a new meaning when it comes to minecraft.\n"
|
||||
+ ChatColor.BLUE + "Join now! " + ChatColor.RED + "tf.sauc.in");
|
||||
+ ChatColor.BLUE + "Join now! " + ChatColor.RED + "play.totalfreedom.me");
|
||||
bookStack.setItemMeta(book);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
|
@ -1,15 +1,13 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.command.Command_logs;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -38,10 +36,10 @@ public class LogViewer extends FreedomService
|
||||
|
||||
public void updateLogsRegistration(final CommandSender sender, final Player target, final LogsRegistrationMode mode)
|
||||
{
|
||||
updateLogsRegistration(sender, target.getName(), target.getAddress().getAddress().getHostAddress().trim(), mode);
|
||||
updateLogsRegistration(sender, target.getName(), mode);
|
||||
}
|
||||
|
||||
public void updateLogsRegistration(final CommandSender sender, final String targetName, final String targetIP, final LogsRegistrationMode mode)
|
||||
public void updateLogsRegistration(final CommandSender sender, final String targetName, final LogsRegistrationMode mode)
|
||||
{
|
||||
final String logsRegisterUrl = ConfigEntry.LOGS_URL.getString();
|
||||
final String logsRegisterPassword = ConfigEntry.LOGS_SECRET.getString();
|
||||
@ -63,14 +61,16 @@ public class LogViewer extends FreedomService
|
||||
sender.sendMessage(ChatColor.YELLOW + "Connecting...");
|
||||
}
|
||||
|
||||
URL url = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", mode.toString())
|
||||
final String key = SecureCodeGenerator.generateCode(20);
|
||||
|
||||
final URL urlAdd = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", mode.name())
|
||||
.addQueryParameter("password", logsRegisterPassword)
|
||||
.addQueryParameter("name", targetName)
|
||||
.addQueryParameter("ip", targetIP)
|
||||
.addQueryParameter("key", key)
|
||||
.getURL();
|
||||
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
final HttpURLConnection connection = (HttpURLConnection) urlAdd.openConnection();
|
||||
connection.setConnectTimeout(1000 * 5);
|
||||
connection.setReadTimeout(1000 * 5);
|
||||
connection.setUseCaches(false);
|
||||
@ -92,7 +92,29 @@ public class LogViewer extends FreedomService
|
||||
{
|
||||
if (responseCode == 200)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GREEN + "Registration " + mode.toString() + "d.");
|
||||
if (mode == LogsRegistrationMode.ADD)
|
||||
{
|
||||
String link = null;
|
||||
try
|
||||
{
|
||||
final URL urlVerify = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", LogsRegistrationMode.VERIFY.name())
|
||||
.addQueryParameter("name", targetName)
|
||||
.addQueryParameter("key", key)
|
||||
.getURL();
|
||||
link = urlVerify.toString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Open this link to verify your logviewer registration:\n" + ChatColor.DARK_GREEN + link);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.GREEN + "Logviewer access revoked successfully.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -110,30 +132,10 @@ public class LogViewer extends FreedomService
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
||||
public void deactivateSuperadmin(Admin superadmin)
|
||||
{
|
||||
for (String ip : superadmin.getIps())
|
||||
{
|
||||
updateLogsRegistration(null, superadmin.getName(), ip, LogsRegistrationMode.DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum LogsRegistrationMode
|
||||
{
|
||||
|
||||
UPDATE("update"), DELETE("delete");
|
||||
private final String mode;
|
||||
|
||||
private LogsRegistrationMode(String mode)
|
||||
{
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
ADD, DELETE, VERIFY;
|
||||
}
|
||||
|
||||
private static class URLBuilder
|
||||
@ -160,11 +162,44 @@ public class LogViewer extends FreedomService
|
||||
while (it.hasNext())
|
||||
{
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
pairs.add(pair.getKey() + "=" + pair.getValue());
|
||||
try
|
||||
{
|
||||
pairs.add(URLEncoder.encode(pair.getKey(), "UTF-8") + "=" + URLEncoder.encode(pair.getValue(), "UTF-8"));
|
||||
}
|
||||
catch (UnsupportedEncodingException ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return new URL(requestPath + "?" + StringUtils.join(pairs, "&"));
|
||||
}
|
||||
}
|
||||
|
||||
private static class SecureCodeGenerator
|
||||
{
|
||||
|
||||
private static final String CHARACTER_SET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
public static String generateCode(final int length)
|
||||
{
|
||||
SecureRandom random;
|
||||
try
|
||||
{
|
||||
random = SecureRandom.getInstance("SHA1PRNG", "SUN");
|
||||
}
|
||||
catch (NoSuchAlgorithmException | NoSuchProviderException ex)
|
||||
{
|
||||
random = new SecureRandom();
|
||||
FLog.severe(ex);
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
sb.append(CHARACTER_SET.charAt(random.nextInt(CHARACTER_SET.length())));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,15 +168,15 @@ public class LoginProcess extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
// Whitelist
|
||||
if (plugin.si.isWhitelisted())
|
||||
{
|
||||
if (!plugin.si.getWhitelisted().contains(username.toLowerCase()))
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// // Whitelist
|
||||
// if (plugin.si.isWhitelisted())
|
||||
// {
|
||||
// if (!plugin.si.getWhitelisted().contains(username.toLowerCase()))
|
||||
// {
|
||||
// event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
@ -1,19 +1,12 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.minecraft.server.v1_9_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_9_R1.PropertyManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
|
||||
|
||||
public class ServerInterface extends FreedomService
|
||||
{
|
||||
|
||||
public static final String COMPILE_NMS_VERSION = "v1_9_R1";
|
||||
public static final String COMPILE_NMS_VERSION = "v1_12_R1";
|
||||
|
||||
public ServerInterface(TotalFreedomMod plugin)
|
||||
{
|
||||
@ -41,52 +34,52 @@ public class ServerInterface extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnlineMode(boolean mode)
|
||||
{
|
||||
final PropertyManager manager = getServer().getPropertyManager();
|
||||
manager.setProperty("online-mode", mode);
|
||||
manager.savePropertiesFile();
|
||||
}
|
||||
|
||||
public int purgeWhitelist()
|
||||
{
|
||||
String[] whitelisted = getServer().getPlayerList().getWhitelisted();
|
||||
int size = whitelisted.length;
|
||||
for (EntityPlayer player : getServer().getPlayerList().players)
|
||||
{
|
||||
getServer().getPlayerList().getWhitelist().remove(player.getProfile());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
getServer().getPlayerList().getWhitelist().save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.warning("Could not purge the whitelist!");
|
||||
FLog.warning(ex);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public boolean isWhitelisted()
|
||||
{
|
||||
return getServer().getPlayerList().getHasWhitelist();
|
||||
}
|
||||
|
||||
public List<?> getWhitelisted()
|
||||
{
|
||||
return Arrays.asList(getServer().getPlayerList().getWhitelisted());
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return getServer().getVersion();
|
||||
}
|
||||
|
||||
private MinecraftServer getServer()
|
||||
{
|
||||
return ((CraftServer) Bukkit.getServer()).getServer();
|
||||
}
|
||||
// public void setOnlineMode(boolean mode)
|
||||
// {
|
||||
// final PropertyManager manager = getServer().getPropertyManager();
|
||||
// manager.setProperty("online-mode", mode);
|
||||
// manager.savePropertiesFile();
|
||||
// }
|
||||
//
|
||||
// public int purgeWhitelist()
|
||||
// {
|
||||
// String[] whitelisted = getServer().getPlayerList().getWhitelisted();
|
||||
// int size = whitelisted.length;
|
||||
// for (EntityPlayer player : getServer().getPlayerList().players)
|
||||
// {
|
||||
// getServer().getPlayerList().getWhitelist().remove(player.getProfile());
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// getServer().getPlayerList().getWhitelist().save();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// FLog.warning("Could not purge the whitelist!");
|
||||
// FLog.warning(ex);
|
||||
// }
|
||||
// return size;
|
||||
// }
|
||||
//
|
||||
// public boolean isWhitelisted()
|
||||
// {
|
||||
// return getServer().getPlayerList().getHasWhitelist();
|
||||
// }
|
||||
//
|
||||
// public List<?> getWhitelisted()
|
||||
// {
|
||||
// return Arrays.asList(getServer().getPlayerList().getWhitelisted());
|
||||
// }
|
||||
//
|
||||
// public String getVersion()
|
||||
// {
|
||||
// return getServer().getVersion();
|
||||
// }
|
||||
//
|
||||
// private MinecraftServer getServer()
|
||||
// {
|
||||
// return ((CraftServer) Bukkit.getServer()).getServer();
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,8 @@ public class ServerPing extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
String baseMotd = ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", plugin.si.getVersion());
|
||||
// String baseMotd = ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", plugin.si.getVersion());
|
||||
String baseMotd = ConfigEntry.SERVER_MOTD.getString();
|
||||
baseMotd = baseMotd.replace("\\n", "\n");
|
||||
baseMotd = FUtil.colorize(baseMotd);
|
||||
|
||||
|
@ -16,6 +16,7 @@ import me.totalfreedom.totalfreedommod.blocking.PotionBlocker;
|
||||
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
||||
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
||||
import me.totalfreedom.totalfreedommod.caging.Cager;
|
||||
import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
||||
@ -101,6 +102,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
public ServiceManager<TotalFreedomMod> bridges;
|
||||
public BukkitTelnetBridge btb;
|
||||
public EssentialsBridge esb;
|
||||
public LibsDisguisesBridge ldb;
|
||||
public WorldEditBridge web;
|
||||
|
||||
@Override
|
||||
@ -201,6 +203,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
bridges = new ServiceManager<>(plugin);
|
||||
btb = bridges.registerService(BukkitTelnetBridge.class);
|
||||
esb = bridges.registerService(EssentialsBridge.class);
|
||||
ldb = bridges.registerService(LibsDisguisesBridge.class);
|
||||
web = bridges.registerService(WorldEditBridge.class);
|
||||
bridges.start();
|
||||
|
||||
@ -271,7 +274,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe("Could not load build properties! Did you compile with Netbeans/ANT?");
|
||||
FLog.severe("Could not load build properties! Did you compile with Netbeans/Maven?");
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.base.ConfigLoadable;
|
||||
@ -25,7 +27,6 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Setter
|
||||
private String name;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean active = true;
|
||||
@Getter
|
||||
@Setter
|
||||
@ -138,6 +139,26 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
ips.clear();
|
||||
}
|
||||
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
this.active = active;
|
||||
|
||||
final TotalFreedomMod plugin = TotalFreedomMod.plugin();
|
||||
|
||||
if (!active)
|
||||
{
|
||||
if (getRank().isAtLeast(Rank.TELNET_ADMIN))
|
||||
{
|
||||
if (plugin.btb != null)
|
||||
{
|
||||
plugin.btb.killTelnetSessions(getName());
|
||||
}
|
||||
}
|
||||
|
||||
plugin.lv.updateLogsRegistration(null, getName(), LogsRegistrationMode.DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.command.Command_logs;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
@ -272,6 +271,14 @@ public class AdminList extends FreedomService
|
||||
|
||||
public boolean removeAdmin(Admin admin)
|
||||
{
|
||||
if (admin.getRank().isAtLeast(Rank.TELNET_ADMIN))
|
||||
{
|
||||
if (plugin.btb != null)
|
||||
{
|
||||
plugin.btb.killTelnetSessions(admin.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove admin, update views
|
||||
if (allAdmins.remove(admin.getConfigKey()) == null)
|
||||
{
|
||||
@ -345,7 +352,6 @@ public class AdminList extends FreedomService
|
||||
}
|
||||
|
||||
admin.setActive(false);
|
||||
plugin.lv.deactivateSuperadmin(admin);
|
||||
}
|
||||
|
||||
save();
|
||||
|
@ -108,6 +108,14 @@ public class BlockBlocker extends FreedomService
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STRUCTURE_BLOCK:
|
||||
case STRUCTURE_VOID:
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
||||
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,9 +33,6 @@ public class InteractBlocker extends FreedomService
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
final FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
|
||||
switch (event.getAction())
|
||||
{
|
||||
case RIGHT_CLICK_AIR:
|
||||
@ -98,6 +95,14 @@ public class InteractBlocker extends FreedomService
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
case SIGN:
|
||||
case SIGN_POST:
|
||||
case WALL_SIGN:
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Sign interaction is currently disabled.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,29 @@
|
||||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.bukkittelnet.BukkitTelnet;
|
||||
import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent;
|
||||
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
|
||||
import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent;
|
||||
import me.totalfreedom.bukkittelnet.session.ClientSession;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class BukkitTelnetBridge extends FreedomService
|
||||
{
|
||||
|
||||
private BukkitTelnet bukkitTelnetPlugin = null;
|
||||
|
||||
public BukkitTelnetBridge(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
@ -94,4 +102,69 @@ public class BukkitTelnetBridge extends FreedomService
|
||||
playerTags.put("tfm.essentialsBridge.getNickname", plugin.esb.getNickname(player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
public BukkitTelnet getBukkitTelnetPlugin()
|
||||
{
|
||||
if (bukkitTelnetPlugin == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
final Plugin bukkitTelnet = server.getPluginManager().getPlugin("BukkitTelnet");
|
||||
if (bukkitTelnet != null)
|
||||
{
|
||||
if (bukkitTelnet instanceof BukkitTelnet)
|
||||
{
|
||||
bukkitTelnetPlugin = (BukkitTelnet) bukkitTelnet;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return bukkitTelnetPlugin;
|
||||
}
|
||||
|
||||
public void killTelnetSessions(final String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
final List<ClientSession> sessionsToRemove = new ArrayList<>();
|
||||
|
||||
final BukkitTelnet telnet = getBukkitTelnetPlugin();
|
||||
if (telnet != null)
|
||||
{
|
||||
final Iterator<ClientSession> it = telnet.appender.getSessions().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
final ClientSession session = it.next();
|
||||
if (name != null && name.equalsIgnoreCase(session.getUserName()))
|
||||
{
|
||||
sessionsToRemove.add(session);
|
||||
}
|
||||
}
|
||||
|
||||
for (final ClientSession session : sessionsToRemove)
|
||||
{
|
||||
try
|
||||
{
|
||||
telnet.appender.removeSession(session);
|
||||
session.syncTerminateSession();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe("Error removing single telnet session: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
FLog.info(sessionsToRemove.size() + " telnet session(s) removed.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe("Error removing telnet sessions: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,138 @@
|
||||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
//import me.libraryaddict.disguise.DisallowedDisguises;
|
||||
//import me.libraryaddict.disguise.LibsDisguises;
|
||||
//import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class LibsDisguisesBridge extends FreedomService
|
||||
{
|
||||
|
||||
// private LibsDisguises libsDisguisesPlugin = null;
|
||||
|
||||
public LibsDisguisesBridge(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
}
|
||||
/*
|
||||
public LibsDisguises getLibsDisguisesPlugin()
|
||||
{
|
||||
if (libsDisguisesPlugin == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
final Plugin libsDisguises = server.getPluginManager().getPlugin("LibsDisguises");
|
||||
if (libsDisguises != null)
|
||||
{
|
||||
if (libsDisguises instanceof LibsDisguises)
|
||||
{
|
||||
libsDisguisesPlugin = (LibsDisguises) libsDisguises;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return libsDisguisesPlugin;
|
||||
}
|
||||
|
||||
public Boolean isDisguised(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
||||
if (libsDisguises != null)
|
||||
{
|
||||
return DisguiseAPI.isDisguised(player);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void undisguiseAll(boolean admins)
|
||||
{
|
||||
try
|
||||
{
|
||||
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
||||
|
||||
if (libsDisguises == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (DisguiseAPI.isDisguised(player))
|
||||
{
|
||||
if (!admins && plugin.al.isAdmin(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisguisesEnabled(boolean state)
|
||||
{
|
||||
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
||||
|
||||
if (libsDisguises == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (state)
|
||||
{
|
||||
DisguiseAPI.enableDisguises();
|
||||
}
|
||||
else
|
||||
{
|
||||
DisguiseAPI.disableDisguises();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDisguisesEnabled()
|
||||
{
|
||||
return !DisallowedDisguises.disabled;
|
||||
}
|
||||
|
||||
public boolean isPluginEnabled()
|
||||
{
|
||||
Plugin ld = getLibsDisguisesPlugin();
|
||||
|
||||
if (ld == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ld.isEnabled();
|
||||
}*/
|
||||
}
|
@ -2,8 +2,16 @@ package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.worldedit.LimitChangedEvent;
|
||||
import me.totalfreedom.worldedit.SelectionChangedEvent;
|
||||
// These imports are not in the latest releases of WorldEdit, and the new versions of WorldEdit do not build properly. This will need to be reverted once the new WorldEdit builds are building properly.
|
||||
//
|
||||
//import me.totalfreedom.worldedit.LimitChangedEvent;
|
||||
//import me.totalfreedom.worldedit.SelectionChangedEvent;
|
||||
//
|
||||
//The following two imports are a temporary measure as mentioned above.
|
||||
//
|
||||
import me.StevenLawson.worldedit.LimitChangedEvent;
|
||||
import me.StevenLawson.worldedit.SelectionChangedEvent;
|
||||
//
|
||||
import net.pravian.aero.component.PluginListener;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
|
||||
public class Cager extends FreedomService
|
||||
{
|
||||
@ -95,6 +96,18 @@ public class Cager extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerKick(PlayerKickEvent event)
|
||||
{
|
||||
FPlayer player = plugin.pl.getPlayer(event.getPlayer());
|
||||
CageData cage = player.getCageData();
|
||||
|
||||
if (cage.isCaged())
|
||||
{
|
||||
cage.playerQuit();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
|
@ -0,0 +1,56 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to adventure, or define someone's username to change theirs.", usage = "/<command> <-a | [partialname]>", aliases = "gma")
|
||||
public class Command_adventure extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
if (isConsole())
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target player.");
|
||||
return true;
|
||||
}
|
||||
|
||||
playerSender.setGameMode(GameMode.ADVENTURE);
|
||||
msg("Gamemode set to adventure.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("-a"))
|
||||
{
|
||||
for (Player targetPlayer : server.getOnlinePlayers())
|
||||
{
|
||||
targetPlayer.setGameMode(GameMode.ADVENTURE);
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to adventure", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Setting " + player.getName() + " to game mode adventure");
|
||||
msg(player, sender.getName() + " set your game mode to adventure");
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -9,12 +9,16 @@ import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
|
||||
public class Command_banlist extends FreedomCommand {
|
||||
public class Command_banlist extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("purge")) {
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
checkRank(Rank.SENIOR_ADMIN);
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Purging the ban list", true);
|
||||
|
@ -0,0 +1,47 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
//import me.libraryaddict.disguise.DisallowedDisguises;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Toggle the disguise plugin", usage = "/<command>", aliases = "dtoggle")
|
||||
public class Command_disguisetoggle extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{/*
|
||||
if (!plugin.ldb.isPluginEnabled())
|
||||
{
|
||||
msg(ChatColor.RED + "LibsDisguises is not enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), (DisallowedDisguises.disabled ? "Enabling" : "Disabling") + " " +
|
||||
"Disguises", false);
|
||||
|
||||
if (plugin.ldb.isDisguisesEnabled())
|
||||
{
|
||||
plugin.ldb.undisguiseAll(true);
|
||||
plugin.ldb.setDisguisesEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.ldb.setDisguisesEnabled(true);
|
||||
}
|
||||
|
||||
msg("Disguises are now " + (!DisallowedDisguises.disabled ? "enabled." : "disabled."));
|
||||
|
||||
return true;
|
||||
|
||||
*/
|
||||
|
||||
msg("This command has been disabled for technical reasons. Contact a developer for additional information.");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -72,7 +72,7 @@ public class Command_doom extends FreedomCommand
|
||||
player.setFireTicks(10000);
|
||||
|
||||
// Generate explosion
|
||||
player.getWorld().createExplosion(player.getLocation(), 4F);
|
||||
player.getWorld().createExplosion(player.getLocation(), 0F, false);
|
||||
|
||||
// Shoot the player in the sky
|
||||
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 20, 0)));
|
||||
@ -99,7 +99,7 @@ public class Command_doom extends FreedomCommand
|
||||
FUtil.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + ip, true);
|
||||
|
||||
// generate explosion
|
||||
player.getWorld().createExplosion(player.getLocation(), 4F);
|
||||
player.getWorld().createExplosion(player.getLocation(), 0F, false);
|
||||
|
||||
// kick player
|
||||
player.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
|
||||
|
@ -15,7 +15,7 @@ public class Command_entitywipe extends FreedomCommand
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing all server entities.", true);
|
||||
msg((plugin.ew.wipeEntities(true, true)) + " entities removed.");
|
||||
msg((plugin.ew.wipeEntities(true)) + " entities removed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ public class Command_gtfo extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
|
@ -11,20 +11,20 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
|
||||
@CommandParameters(description = "Shows (and optionally clears) invisisible players", usage = "/<command> [clear]")
|
||||
public class Command_invis extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
boolean smite = false;
|
||||
boolean clear = false;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("smite"))
|
||||
if (args[0].equalsIgnoreCase("clear"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Smiting all invisible players", true);
|
||||
smite = true;
|
||||
FUtil.adminAction(sender.getName(), "Clearing invisibility for all players", false);
|
||||
clear = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -33,17 +33,17 @@ public class Command_invis extends FreedomCommand
|
||||
}
|
||||
|
||||
List<String> players = new ArrayList<>();
|
||||
int smites = 0;
|
||||
int clears = 0;
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
|
||||
{
|
||||
players.add(player.getName());
|
||||
if (smite && !plugin.al.isAdmin(player))
|
||||
if (clear && !plugin.al.isAdmin(player))
|
||||
{
|
||||
player.setHealth(0.0);
|
||||
smites++;
|
||||
player.removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||
clears++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -54,9 +54,9 @@ public class Command_invis extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (smite)
|
||||
if (clear)
|
||||
{
|
||||
msg("Smitten " + smites + " players");
|
||||
msg("Cleared invisibility effect from " + clears + " players");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,26 +1,10 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
||||
@ -30,16 +14,13 @@ public class Command_logs extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
LogsRegistrationMode mode = LogsRegistrationMode.UPDATE;
|
||||
|
||||
if (args.length == 1)
|
||||
LogsRegistrationMode mode = LogsRegistrationMode.ADD;
|
||||
if (args.length == 1 && "off".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
mode = LogsRegistrationMode.DELETE;
|
||||
}
|
||||
|
||||
plugin.lv.updateLogsRegistration(sender, playerSender, mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public class Command_myadmin extends FreedomCommand
|
||||
Player init = null;
|
||||
Admin target = getAdmin(playerSender);
|
||||
Player targetPlayer = playerSender;
|
||||
String targetIp = Ips.getIp(targetPlayer);
|
||||
|
||||
// -o switch
|
||||
if (args[0].equals("-o"))
|
||||
@ -44,6 +43,7 @@ public class Command_myadmin extends FreedomCommand
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
target = getAdmin(targetPlayer);
|
||||
if (target == null)
|
||||
{
|
||||
@ -59,6 +59,8 @@ public class Command_myadmin extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
final String targetIp = Ips.getIp(targetPlayer);
|
||||
|
||||
switch (args[0])
|
||||
{
|
||||
case "clearips":
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -44,26 +43,27 @@ public class Command_onlinemode extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
plugin.si.setOnlineMode(onlineMode);
|
||||
|
||||
if (onlineMode)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player.kickPlayer("Server is activating \"online-mode=true\". Please reconnect.");
|
||||
}
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Turning player validation " + (onlineMode ? "on" : "off") + ".", true);
|
||||
|
||||
server.reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
// try
|
||||
// {
|
||||
// plugin.si.setOnlineMode(onlineMode);
|
||||
//
|
||||
// if (onlineMode)
|
||||
// {
|
||||
// for (Player player : server.getOnlinePlayers())
|
||||
// {
|
||||
// player.kickPlayer("Server is activating \"online-mode=true\". Please reconnect.");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// FUtil.adminAction(sender.getName(), "Turning player validation " + (onlineMode ? "on" : "off") + ".", true);
|
||||
//
|
||||
// server.reload();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// FLog.severe(ex);
|
||||
// }
|
||||
FUtil.adminAction(sender.getName(), "Online-Mode toggling is temporarily disabled.", true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage plugins", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
|
||||
public class Command_plugincontrol extends FreedomCommand
|
||||
{
|
||||
|
@ -44,12 +44,14 @@ public class Command_premium extends FreedomCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
final URL getUrl = new URL("https://minecraft.net/haspaid.jsp?user=" + name);
|
||||
final URL getUrl = new URL("http://axis.iaero.me/accstatus?username=" + name + "&format=plain");
|
||||
final URLConnection urlConnection = getUrl.openConnection();
|
||||
// Read the response
|
||||
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||
final String message = ("false".equalsIgnoreCase(in.readLine()) ? ChatColor.RED + "No" : ChatColor.DARK_GREEN + "Yes");
|
||||
in.close();
|
||||
final String message;
|
||||
try ( // Read the response
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())))
|
||||
{
|
||||
message = (!"PREMIUM".equalsIgnoreCase(in.readLine()) ? ChatColor.RED + "No" : ChatColor.DARK_GREEN + "Yes");
|
||||
}
|
||||
|
||||
if (!plugin.isEnabled())
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ public class Command_purgeall extends FreedomCommand
|
||||
FUtil.adminAction(sender.getName(), "Purging all player data", true);
|
||||
|
||||
// Purge entities
|
||||
plugin.ew.wipeEntities(true, true);
|
||||
plugin.ew.wipeEntities(true);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -74,6 +74,12 @@ public class Command_saconfig extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rank.isConsole())
|
||||
{
|
||||
msg("You cannot set players to a console rank");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!rank.isAtLeast(Rank.SUPER_ADMIN))
|
||||
{
|
||||
msg("Rank must be superadmin or higher.", ChatColor.RED);
|
||||
|
@ -53,7 +53,7 @@ public class Command_smite extends FreedomCommand
|
||||
|
||||
if (reason != null)
|
||||
{
|
||||
FUtil.bcastMsg(" Reason: " + reason, ChatColor.RED);
|
||||
FUtil.bcastMsg(" Reason: " + reason, ChatColor.YELLOW);
|
||||
}
|
||||
|
||||
// Deop
|
||||
@ -82,7 +82,7 @@ public class Command_smite extends FreedomCommand
|
||||
|
||||
if (reason != null)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You've been smitten. Reason: " + reason);
|
||||
player.sendMessage(ChatColor.RED + "You've been smitten. Reason: " + ChatColor.YELLOW + reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to spectator.", usage = "/<command>", aliases = "gmsp")
|
||||
public class Command_spectator extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||
msg("Gamemode set to spectator.");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ public class Command_stfu extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
if (args[0].equals("list"))
|
||||
{
|
||||
msg("Muted players:");
|
||||
FPlayer info;
|
||||
@ -45,7 +45,7 @@ public class Command_stfu extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
if (args[0].equals("purge"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unmuting all players.", true);
|
||||
FPlayer info;
|
||||
@ -63,7 +63,7 @@ public class Command_stfu extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
if (args[0].equals("all"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Muting all non-Superadmins", true);
|
||||
|
||||
@ -83,10 +83,16 @@ public class Command_stfu extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
// -s option (smite)
|
||||
boolean smite = args[0].equals("-s");
|
||||
if (smite)
|
||||
{
|
||||
args = ArrayUtils.subarray(args, 1, args.length);
|
||||
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
@ -0,0 +1,41 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
//import me.libraryaddict.disguise.DisallowedDisguises;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Undisguise all players on the server", usage = "/<command>", aliases = "uall")
|
||||
public class Command_undisguiseall extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{ /*
|
||||
if (!plugin.ldb.isPluginEnabled())
|
||||
{
|
||||
msg("LibsDisguises is not enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (DisallowedDisguises.disabled)
|
||||
{
|
||||
msg("Disguises are not enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Undisguising all non-admins", true);
|
||||
|
||||
plugin.ldb.undisguiseAll(false);
|
||||
|
||||
return true;
|
||||
|
||||
*/
|
||||
|
||||
msg("This command has been disabled for technical reasons. Contact a developer for additional information.");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Unloads chunks not currently in use", usage = "/<command>", aliases = "rc")
|
||||
public class Command_unloadchunks extends FreedomCommand {
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
FUtil.adminAction(sender.getName(), "Unloading unused chunks", false);
|
||||
|
||||
int numChunks = 0;
|
||||
|
||||
for (World world : server.getWorlds()) {
|
||||
numChunks += unloadUnusedChunks(world);
|
||||
}
|
||||
|
||||
FUtil.playerMsg(sender, numChunks + " chunks unloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
private int unloadUnusedChunks(World world) {
|
||||
int numChunks = 0;
|
||||
|
||||
for (Chunk loadedChunk : world.getLoadedChunks()) {
|
||||
if (!world.isChunkInUse(loadedChunk.getX(), loadedChunk.getZ())) {
|
||||
if (world.unloadChunk(loadedChunk)) {
|
||||
numChunks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return numChunks;
|
||||
}
|
||||
}
|
@ -158,8 +158,10 @@ public class Command_whitelist extends FreedomCommand
|
||||
//purge
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||
msg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist.");
|
||||
// FUtil.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||
// msg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist.");
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Whitelist purging is temporarily disabled.", true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "See who has a block and optionally smite.", usage = "/<command> <item> [smite]", aliases = "wh")
|
||||
@CommandParameters(description = "See who has a block and optionally clears the item.", usage = "/<command> <item> clear", aliases = "wh")
|
||||
public class Command_whohas extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ public class Command_whohas extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean doSmite = args.length >= 2 && "smite".equalsIgnoreCase(args[1]);
|
||||
final boolean doClear = args.length >= 2 && "clear".equalsIgnoreCase(args[1]);
|
||||
|
||||
final String materialName = args[0];
|
||||
Material material = Material.matchMaterial(materialName);
|
||||
@ -52,9 +52,9 @@ public class Command_whohas extends FreedomCommand
|
||||
if (player.getInventory().contains(material))
|
||||
{
|
||||
players.add(player.getName());
|
||||
if (doSmite && !plugin.al.isAdmin(player))
|
||||
if (doClear && !plugin.al.isAdmin(player))
|
||||
{
|
||||
Command_smite.smite(player);
|
||||
player.getInventory().remove(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -12,6 +14,13 @@ import org.bukkit.entity.Player;
|
||||
public class Command_wildcard extends FreedomCommand
|
||||
{
|
||||
|
||||
public static final List<String> BLOCKED_COMMANDS = Arrays.asList(
|
||||
"wildcard",
|
||||
"gtfo",
|
||||
"doom",
|
||||
"saconfig"
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -20,24 +29,16 @@ public class Command_wildcard extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("wildcard"))
|
||||
Command runCmd = server.getPluginCommand(args[0]);
|
||||
if (runCmd == null)
|
||||
{
|
||||
msg("What the hell are you trying to do, you stupid idiot...", ChatColor.RED);
|
||||
msg("Unknown command: " + args[0], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("gtfo"))
|
||||
|
||||
if (BLOCKED_COMMANDS.contains(runCmd.getName()))
|
||||
{
|
||||
msg("Nice try", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("doom"))
|
||||
{
|
||||
msg("Look, we all hate people, but this is not the way to deal with it, doom is evil enough!", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("saconfig"))
|
||||
{
|
||||
msg("WOA, WTF are you trying to do???", ChatColor.RED);
|
||||
msg("Did you really think that was going to work?", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,9 +52,9 @@ public class Command_wildcard extends FreedomCommand
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
String out_command = baseCommand.replaceAll("\\x3f", player.getName());
|
||||
msg("Running Command: " + out_command);
|
||||
server.dispatchCommand(sender, out_command);
|
||||
String runCommand = baseCommand.replaceAll("\\x3f", player.getName());
|
||||
msg("Running Command: " + runCommand);
|
||||
server.dispatchCommand(sender, runCommand);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -36,7 +36,7 @@ public class Module_players extends HTTPDModule
|
||||
}
|
||||
|
||||
// Admins
|
||||
for (Admin admin : plugin.al.getAllAdmins().values())
|
||||
for (Admin admin : plugin.al.getActiveAdmins())
|
||||
{
|
||||
final String username = admin.getName();
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class FUtil
|
||||
//
|
||||
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
||||
// See https://github.com/TotalFreedom/License - None of the listed names may be removed.
|
||||
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "Wild1145", "WickedGamingUK");
|
||||
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "Wild1145", "WickedGamingUK", "aggelosQQ");
|
||||
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
|
||||
public static final Map<String, ChatColor> CHAT_COLOR_NAMES = new HashMap<>();
|
||||
public static final List<ChatColor> CHAT_COLOR_POOL = Arrays.asList(
|
||||
|
@ -11,15 +11,15 @@ server:
|
||||
# The address your server is located at. Please do not include the port.
|
||||
address: play.totalfreedom.me
|
||||
|
||||
# Shown at the server list
|
||||
motd: TotalFreedom &8- Minecraft %mcversion%
|
||||
# Shown at the server list - Please note that support for %mcversion% has been withdrawn
|
||||
motd: TotalFreedom &8- The Original All-Op Server!
|
||||
|
||||
# Every word in the MOTD will be a different color unless prefixed by a color code
|
||||
colorful_motd: true
|
||||
|
||||
# All players who show up as owner
|
||||
owners:
|
||||
- markbyron
|
||||
- TheMinecraft
|
||||
|
||||
# URL players should appeal for bans at
|
||||
ban_url: http://totalfreedom.boards.net/
|
||||
@ -107,7 +107,6 @@ blocked_commands:
|
||||
- 'n:b:/execute:_'
|
||||
- 'n:b:/blockdata:_'
|
||||
- 'n:b:/clearhistory:_'
|
||||
- 'n:b:/save-all:_'
|
||||
- 'n:b:/save-on:_'
|
||||
- 'n:b:/save-off:_'
|
||||
- 'n:b:/playsound:_'
|
||||
@ -122,6 +121,7 @@ blocked_commands:
|
||||
- 'n:b:/tfipbanlist:Use /banlist to see and wipe the ban list'
|
||||
|
||||
# Superadmin commands
|
||||
- 's:b:/save-all:_'
|
||||
- 's:b:/kick:_'
|
||||
- 's:b:/socialspy:_'
|
||||
- 's:b:/replaceitem:_'
|
||||
@ -247,7 +247,7 @@ announcer:
|
||||
- 'MarkByron is the owner of TotalFreedom.'
|
||||
- 'Server lagging? Check the lag via "/tps"'
|
||||
- 'You are allowed to record and stream videos on TotalFreedom.'
|
||||
- 'Player vs player while in creative or god mode it forbidden!'
|
||||
- 'Player vs player while in creative or god mode is forbidden!'
|
||||
- 'Spawn killing is forbidden!'
|
||||
- 'Invisible potions are allowed!'
|
||||
- 'Serial griefing and trolling will result in a permanent ban!'
|
||||
|
@ -3,7 +3,7 @@ main: me.totalfreedom.totalfreedommod.TotalFreedomMod
|
||||
version: ${tfm.build.version}
|
||||
description: Plugin for the Total Freedom server.
|
||||
depend: [Aero, WorldEdit]
|
||||
softdepend: [BukkitTelnet, Essentials]
|
||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises]
|
||||
authors: [Madgeek1450, Prozza]
|
||||
|
||||
# plugin.yml is no longer used to define commands.
|
||||
|
13
travis-upload.sh
Executable file
13
travis-upload.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
|
||||
mv target/TotalFreedomMod.jar target/TotalFreedomMod-${TRAVIS_COMMIT}.jar
|
||||
export SSHPASS=${SFTP_PASSWORD}
|
||||
sshpass -e sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oLogLevel=ERROR -oBatchMode=no -b - ${SFTP_USER}@${SFTP_HOST}:${SFTP_PATH} << !
|
||||
put target/TotalFreedomMod-${TRAVIS_COMMIT}.jar
|
||||
bye
|
||||
!
|
||||
echo "Artifact upload status: "$?
|
||||
else
|
||||
echo "Skipping artifact upload for pull request build."
|
||||
fi
|
Reference in New Issue
Block a user