diff --git a/README.md b/README.md index 19cdc7a..d3b1ad9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ 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 (DarthSalamon) 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. +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. 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). diff --git a/buildnumber.properties b/buildnumber.properties index 70d472a..b4614b9 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Mon Feb 16 16:40:10 CET 2015 -build.number=982 +#Sun Apr 26 22:23:22 CEST 2015 +build.number=990 diff --git a/nbproject/project.properties b/nbproject/project.properties index cac29b1..cfd893d 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -48,17 +48,17 @@ jar.archive.disabled=${jnlp.enabled} jar.compress=false jar.index=${jnlp.enabled} javac.classpath=\ - ${libs.WorldEdit.classpath}:\ - ${libs.Essentials.classpath}:\ + ${libs.SpigotServer.classpath}:\ ${libs.BukkitTelnet.classpath}:\ - ${libs.SpigotServer.classpath} + ${libs.TF-WorldEdit.classpath}:\ + ${libs.Essentials.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked -Xlint:deprecation javac.deprecation=false javac.processorpath=\ ${javac.classpath} -javac.source=1.6 -javac.target=1.6 +javac.source=1.7 +javac.target=1.7 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} diff --git a/src/bans.yml b/src/bans.yml index 742a316..8692ffe 100644 --- a/src/bans.yml +++ b/src/bans.yml @@ -7,7 +7,7 @@ # ips: - - '192.168.1.254:Notch:DarthSalamon:0:IP ban example' + - '192.168.1.254:Notch:Prozza:0:IP ban example' uuids: - - '245d2f30-61fb-4840-9cd3-298b3920f4a4:Cobrex:DarthSalamon:0:UUID ban example' \ No newline at end of file + - '245d2f30-61fb-4840-9cd3-298b3920f4a4:Cobrex:Prozza:0:UUID ban example' \ No newline at end of file diff --git a/src/config.yml b/src/config.yml index a0c7256..f4bec58 100644 --- a/src/config.yml +++ b/src/config.yml @@ -122,11 +122,10 @@ blocked_commands: - 's:b:/tool:_' - 's:b:/lrbuild:_' - 's:b:/defaultgamemode:_' - + - 's:b:/reload:_' # Superadmin commands - Auto-eject - 's:a:/stop:_' - - 's:a:/reload:_' - 's:a:/save-all:_' - 's:a:/save-on:_' - 's:a:/save-off:_' @@ -276,7 +275,7 @@ unbannable_usernames: # IPs that can not be supered noadmin_ips: - - 127.0.0.1 + - 167.114.97.16 # TwitterBot - Used to allow superadmins to verify themselves using twitter twitterbot: diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_TelnetListener.java b/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_BukkitTelnetListener.java similarity index 94% rename from src/me/StevenLawson/TotalFreedomMod/Listener/TFM_TelnetListener.java rename to src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_BukkitTelnetListener.java index 100d873..461b3aa 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_TelnetListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_BukkitTelnetListener.java @@ -1,11 +1,10 @@ -package me.StevenLawson.TotalFreedomMod.Listener; +package me.StevenLawson.TotalFreedomMod.Bridge; import java.util.Iterator; import java.util.Map; import me.StevenLawson.BukkitTelnet.api.TelnetCommandEvent; import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent; import me.StevenLawson.BukkitTelnet.api.TelnetRequestDataTagsEvent; -import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge; import me.StevenLawson.TotalFreedomMod.TFM_Admin; import me.StevenLawson.TotalFreedomMod.TFM_AdminList; import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker; @@ -15,7 +14,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -public class TFM_TelnetListener implements Listener +public class TFM_BukkitTelnetListener implements Listener { @EventHandler(priority = EventPriority.NORMAL) public void onTelnetPreLogin(TelnetPreLoginEvent event) diff --git a/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_WorldEditBridge.java b/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_WorldEditBridge.java index a4cafda..22b8230 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_WorldEditBridge.java +++ b/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_WorldEditBridge.java @@ -1,20 +1,12 @@ package me.StevenLawson.TotalFreedomMod.Bridge; -import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.bukkit.BukkitPlayer; import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.world.World; -import me.StevenLawson.TotalFreedomMod.TFM_AdminList; import me.StevenLawson.TotalFreedomMod.TFM_Log; -import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea; -import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.bukkit.scheduler.BukkitRunnable; public class TFM_WorldEditBridge { @@ -25,7 +17,7 @@ public class TFM_WorldEditBridge throw new AssertionError(); } - public static WorldEditPlugin getWorldEditPlugin() + private static WorldEditPlugin getWorldEditPlugin() { if (worldEditPlugin == null) { @@ -48,14 +40,14 @@ public class TFM_WorldEditBridge return worldEditPlugin; } - public static BukkitPlayer getBukkitPlayer(Player player) + private static LocalSession getPlayerSession(Player player) { try { final WorldEditPlugin wep = getWorldEditPlugin(); if (wep != null) { - return wep.wrapPlayer(player); + return wep.getSession(player); } } catch (Exception ex) @@ -65,14 +57,14 @@ public class TFM_WorldEditBridge return null; } - public static LocalSession getPlayerSession(Player player) + private static BukkitPlayer getBukkitPlayer(Player player) { try { final WorldEditPlugin wep = getWorldEditPlugin(); if (wep != null) { - return wep.getSession(player); + return wep.wrapPlayer(player); } } catch (Exception ex) @@ -120,54 +112,4 @@ public class TFM_WorldEditBridge TFM_Log.severe(ex); } } - - public static void validateSelection(final Player player) - { - if (TFM_AdminList.isSuperAdmin(player)) - { - return; - } - - try - { - final LocalSession session = getPlayerSession(player); - - if (session == null) - { - return; - } - - final World selectionWorld = session.getSelectionWorld(); - final Region selection = session.getSelection(selectionWorld); - - if (TFM_ProtectedArea.isInProtectedArea( - getBukkitVector(selection.getMinimumPoint()), - getBukkitVector(selection.getMaximumPoint()), - selectionWorld.getName())) - { - new BukkitRunnable() - { - @Override - public void run() - { - player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared."); - session.getRegionSelector(selectionWorld).clear(); - } - }.runTask(TotalFreedomMod.plugin); - } - - } - catch (IncompleteRegionException ex) - { - } - catch (Exception ex) - { - TFM_Log.severe(ex); - } - } - - private static org.bukkit.util.Vector getBukkitVector(com.sk89q.worldedit.Vector worldEditVector) - { - return new org.bukkit.util.Vector(worldEditVector.getX(), worldEditVector.getY(), worldEditVector.getZ()); - } } diff --git a/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_WorldEditListener.java b/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_WorldEditListener.java new file mode 100644 index 0000000..8d97b69 --- /dev/null +++ b/src/me/StevenLawson/TotalFreedomMod/Bridge/TFM_WorldEditListener.java @@ -0,0 +1,62 @@ +package me.StevenLawson.TotalFreedomMod.Bridge; + +import me.StevenLawson.TotalFreedomMod.TFM_AdminList; +import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea; +import me.StevenLawson.TotalFreedomMod.TFM_Util; +import me.StevenLawson.worldedit.LimitChangedEvent; +import me.StevenLawson.worldedit.SelectionChangedEvent; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +public class TFM_WorldEditListener implements Listener +{ + + @EventHandler + public void onSelectionChange(final SelectionChangedEvent event) + { + final Player player = event.getPlayer(); + + if (TFM_AdminList.isSuperAdmin(player)) + { + return; + } + + if (TFM_ProtectedArea.isInProtectedArea( + event.getMinVector(), + event.getMaxVector(), + event.getWorld().getName())) + { + + player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared."); + event.setCancelled(true); + } + } + + @EventHandler + public void onLimitChanged(LimitChangedEvent event) + { + final Player player = event.getPlayer(); + + if (TFM_AdminList.isSuperAdmin(player)) + { + return; + } + + if (!event.getPlayer().equals(event.getTarget())) + { + player.sendMessage(ChatColor.RED + "Only admins can change the limit for other players!"); + event.setCancelled(true); + } + + if (event.getLimit() < 0 || event.getLimit() > 10000) + { + player.setOp(false); + TFM_Util.bcastMsg(event.getPlayer().getName() + " tried to set their WorldEdit limit to " + event.getLimit() + " and has been de-opped", ChatColor.RED); + event.setCancelled(true); + player.sendMessage(ChatColor.RED + "You cannot set your limit higher than 10000 or to -1!"); + } + } + +} diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java index b8f5a42..edaf19f 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java @@ -5,6 +5,7 @@ import java.util.List; import me.StevenLawson.TotalFreedomMod.TFM_AdminList; import me.StevenLawson.TotalFreedomMod.TFM_Ban; import me.StevenLawson.TotalFreedomMod.TFM_BanManager; +import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.TFM_Player; import me.StevenLawson.TotalFreedomMod.TFM_PlayerList; import me.StevenLawson.TotalFreedomMod.TFM_Util; @@ -82,7 +83,7 @@ public class Command_glist extends TFM_Command if (target != null) { TFM_BanManager.addUuidBan(new TFM_Ban(TFM_UuidManager.getUniqueId(target), target.getName())); - target.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: http://www.totalfreedom.boards.net"); + target.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: " + TFM_ConfigEntry.SERVER_BAN_URL.getString()); } else { diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java index b447ed7..1f91d42 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java @@ -13,10 +13,10 @@ public class Command_setl extends TFM_Command @Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 500.", true); + TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 2500.", true); for (final Player player : server.getOnlinePlayers()) { - TFM_WorldEditBridge.setLimit(player, 500); + TFM_WorldEditBridge.setLimit(player, 2500); } return true; } diff --git a/src/me/StevenLawson/TotalFreedomMod/Config/TFM_Config.java b/src/me/StevenLawson/TotalFreedomMod/Config/TFM_Config.java index 52bf568..513319a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Config/TFM_Config.java +++ b/src/me/StevenLawson/TotalFreedomMod/Config/TFM_Config.java @@ -43,7 +43,7 @@ public class TFM_Config extends YamlConfiguration // BukkitLib @ https://github. * *
Example: *
- * YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "DarthSalamon.yml"), false); + * YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "Prozza.yml"), false); * config.load(); ** diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java b/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java index 8cd7bd3..05d8343 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java @@ -1,5 +1,6 @@ package me.StevenLawson.TotalFreedomMod; +import com.google.common.base.Function; import com.google.common.collect.Sets; import java.util.Collections; import java.util.Date; @@ -24,6 +25,7 @@ import org.bukkit.entity.Player; public class TFM_AdminList { + public static final Function