diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8356291..2d4f7c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ # Contributing to TotalFreedomMod # TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, it can be used in a variety of other configurations with minimal fuss. -For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that will explain this process in further detail. +For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that explain this process in further detail. ## Quick Guide ## 1. Create or find an issue on our [Issue Tracker](https://github.com/TotalFreedom/TotalFreedomMod/issues). @@ -33,7 +33,7 @@ As a rough guideline, ask yourself the following questions to determine if your Pull requests that involve adding a micromanagement feature will likely not be accepted. This includes shorthands for multiple commands. * Is a similar feature already present? - Features that have very similar alternatives fill not be added. For example: A command that temporarily bans a player from the server is very similar to the _/tban_ command and thus will likely not be accepted. + Features that have very similar alternatives will not be added. For example: A command that temporarily bans a player from the server is very similar to the _/tban_ command and thus will likely not be accepted. ## Making Changes ## * Create a topic branch from where you want to base your work. diff --git a/buildnumber.properties b/buildnumber.properties index 454b2c3..0c32097 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sat Nov 29 19:05:03 GMT 2014 -build.number=960 +#Thu Jan 15 15:34:13 CET 2015 +build.number=967 diff --git a/nbproject/project.properties b/nbproject/project.properties index 3536837..cac29b1 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -51,7 +51,7 @@ javac.classpath=\ ${libs.WorldEdit.classpath}:\ ${libs.Essentials.classpath}:\ ${libs.BukkitTelnet.classpath}:\ - ${libs.CraftBukkit.classpath} + ${libs.SpigotServer.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked -Xlint:deprecation javac.deprecation=false diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminworld.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminworld.java index e23dfa0..366b574 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminworld.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_adminworld.java @@ -1,8 +1,8 @@ package me.StevenLawson.TotalFreedomMod.Commands; -import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld; import me.StevenLawson.TotalFreedomMod.TFM_AdminList; import me.StevenLawson.TotalFreedomMod.TFM_Util; +import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_cbtool.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_cbtool.java index a1d3e4e..1bc450d 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_cbtool.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_cbtool.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker; +import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator; import me.StevenLawson.TotalFreedomMod.TFM_Log; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -29,7 +30,7 @@ public class Command_cbtool extends TFM_Command if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player) { - Block targetBlock = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(sender_p, null, 100); + Block targetBlock = TFM_DepreciationAggregator.getTargetBlock(sender_p, null, 100); playerMsg("Your target block: " + targetBlock.getLocation().toString()); return true; } diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_deop.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_deop.java index 96143ad..848cdd1 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_deop.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_deop.java @@ -1,5 +1,6 @@ package me.StevenLawson.TotalFreedomMod.Commands; +import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator; import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; @@ -31,7 +32,7 @@ public class Command_deop extends TFM_Command // if the player is not online if (player == null) { - player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]); + player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]); } TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false); diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_dispfill.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_dispfill.java index 00a4c25..5fe055b 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_dispfill.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_dispfill.java @@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands; import java.util.ArrayList; import java.util.List; +import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator; import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.apache.commons.lang3.StringUtils; import org.bukkit.Location; @@ -45,7 +46,7 @@ public class Command_dispfill extends TFM_Command { try { - material = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getMaterial(Integer.parseInt(searchItem)); + material = TFM_DepreciationAggregator.getMaterial(Integer.parseInt(searchItem)); } catch (NumberFormatException ex) { diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_enchant.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_enchant.java index a153a3c..d05b664 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_enchant.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_enchant.java @@ -1,7 +1,6 @@ package me.StevenLawson.TotalFreedomMod.Commands; import me.StevenLawson.TotalFreedomMod.TFM_Log; -import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.enchantments.Enchantment; diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_fr.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_fr.java index 92f2823..967e1e6 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_fr.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_fr.java @@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands; import me.StevenLawson.TotalFreedomMod.TFM_AdminList; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_Util; -import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -14,31 +13,34 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Freeze players (toggles on and off).", usage = "/ [target | purge]") public class Command_fr extends TFM_Command { + private static boolean allFrozen = false; + @Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 0) { - TotalFreedomMod.allPlayersFrozen = !TotalFreedomMod.allPlayersFrozen; + allFrozen = !allFrozen; - if (TotalFreedomMod.allPlayersFrozen) + if (allFrozen) { TFM_Util.adminAction(sender.getName(), "Freezing all players", false); - TotalFreedomMod.allPlayersFrozen = true; + setAllFrozen(true); playerMsg("Players are now frozen."); + for (Player player : Bukkit.getOnlinePlayers()) { if (!TFM_AdminList.isSuperAdmin(player)) { - playerMsg(player, "You have been frozen due to rule breaker(s), you will be unfrozen very soon.", ChatColor.RED); + playerMsg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED); } } } else { TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false); - TotalFreedomMod.allPlayersFrozen = false; + setAllFrozen(false); playerMsg("Players are now free to move."); } } @@ -46,15 +48,8 @@ public class Command_fr extends TFM_Command { if (args[0].toLowerCase().equals("purge")) { - TotalFreedomMod.allPlayersFrozen = false; - - for (Player player : server.getOnlinePlayers()) - { - TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); - playerdata.setFrozen(false); - } - - TFM_Util.adminAction(sender.getName(), "Lifting all global and player freezes", false); + setAllFrozen(false); + TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false); } else { @@ -66,7 +61,7 @@ public class Command_fr extends TFM_Command return true; } - TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); + final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setFrozen(!playerdata.isFrozen()); playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + "."); @@ -76,4 +71,13 @@ public class Command_fr extends TFM_Command return true; } + + public static void setAllFrozen(boolean freeze) + { + allFrozen = freeze; + for (TFM_PlayerData data : TFM_PlayerData.USER_INFO.values()) + { + data.setFrozen(freeze); + } + } } diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gadmin.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gadmin.java index 83718aa..765573b 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gadmin.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gadmin.java @@ -1,6 +1,5 @@ package me.StevenLawson.TotalFreedomMod.Commands; -import java.util.Arrays; import java.util.Iterator; import me.StevenLawson.TotalFreedomMod.TFM_BanManager; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; @@ -69,7 +68,7 @@ public class Command_gadmin extends TFM_Command return true; } - final Iterator it = Arrays.asList(server.getOnlinePlayers()).iterator(); + final Iterator it = server.getOnlinePlayers().iterator(); if (mode == GadminMode.LIST) { diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_halt.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_halt.java index 4fb0ef1..1fe734c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_halt.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_halt.java @@ -1,7 +1,7 @@ package me.StevenLawson.TotalFreedomMod.Commands; -import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_AdminList; +import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java index c9ca71d..708bebf 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_list.java @@ -2,8 +2,8 @@ package me.StevenLawson.TotalFreedomMod.Commands; import java.util.ArrayList; import java.util.List; -import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank; import me.StevenLawson.TotalFreedomMod.TFM_AdminList; +import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank; import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.apache.commons.lang3.StringUtils; import org.bukkit.ChatColor; @@ -65,7 +65,7 @@ public class Command_list extends TFM_Command final StringBuilder onlineStats = new StringBuilder(); final StringBuilder onlineUsers = new StringBuilder(); - onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length); + onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size()); onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers()); onlineStats.append(ChatColor.BLUE).append(" players online."); diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_logs.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_logs.java index e259511..9151978 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_logs.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_logs.java @@ -10,8 +10,8 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry; -import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Admin; +import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import org.apache.commons.lang3.StringUtils; import org.bukkit.ChatColor; diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_mp.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_mp.java index 22a228e..56e4cf1 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_mp.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_mp.java @@ -4,7 +4,13 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import org.bukkit.entity.*; +import org.bukkit.entity.Ambient; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Ghast; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) @CommandParameters(description = "Purge all mobs in all worlds.", usage = "/") diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nf.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nf.java index b409f1c..5ee371a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nf.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nf.java @@ -86,8 +86,7 @@ public class Command_nf extends TFM_Command { needle = needle.toLowerCase().trim(); - Player[] onlinePlayers = Bukkit.getOnlinePlayers(); - for (Player player : onlinePlayers) + for (Player player : Bukkit.getOnlinePlayers()) { if (player.getDisplayName().toLowerCase().trim().contains(needle)) { @@ -105,8 +104,7 @@ public class Command_nf extends TFM_Command Integer minEditDistance = null; Player minEditMatch = null; - Player[] onlinePlayers = Bukkit.getOnlinePlayers(); - for (Player player : onlinePlayers) + for (Player player : Bukkit.getOnlinePlayers()) { String haystack = player.getDisplayName().toLowerCase().trim(); int editDistance = StringUtils.getLevenshteinDistance(needle, haystack.toLowerCase()); diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nicknyan.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nicknyan.java index 6719b53..5295237 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nicknyan.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nicknyan.java @@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands; import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge; import me.StevenLawson.TotalFreedomMod.TFM_Util; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -39,8 +40,7 @@ public class Command_nicknyan extends TFM_Command return true; } - final Player[] onlinePlayers = server.getOnlinePlayers(); - for (final Player player : onlinePlayers) + for (Player player : Bukkit.getOnlinePlayers()) { if (player == sender_p) { diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java index feb1def..be73eeb 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_onlinemode.java @@ -1,8 +1,8 @@ package me.StevenLawson.TotalFreedomMod.Commands; +import me.StevenLawson.TotalFreedomMod.TFM_AdminList; import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; -import me.StevenLawson.TotalFreedomMod.TFM_AdminList; import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_op.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_op.java index 709fb27..92d82fe 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_op.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_op.java @@ -1,6 +1,7 @@ package me.StevenLawson.TotalFreedomMod.Commands; import me.StevenLawson.TotalFreedomMod.TFM_AdminList; +import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator; import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; @@ -40,7 +41,7 @@ public class Command_op extends TFM_Command { if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole) { - player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]); + player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]); } else { diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_protectarea.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_protectarea.java index a1a02a6..14433ea 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_protectarea.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_protectarea.java @@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea; -import me.StevenLawson.TotalFreedomMod.TFM_Util; import org.apache.commons.lang3.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -14,6 +13,7 @@ import org.bukkit.entity.Player; usage = "/ | add