Merge with master

This commit is contained in:
unknown 2014-05-07 12:53:05 +02:00
commit 730b0e2c83
21 changed files with 81 additions and 84 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Mon May 05 16:25:12 CEST 2014
build.number=821
#Mon May 05 16:09:04 CEST 2014
build.number=824

View File

@ -130,9 +130,9 @@ public class Command_adminworld extends TFM_Command
playerMsg("Could not add player to guest list.");
}
}
else if (TFM_Util.isRemoveCommand(args[1]))
else if ("remove".equals(args[1]))
{
Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
final Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
if (player != null)
{
TFM_Util.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);

View File

@ -22,7 +22,7 @@ public class Command_cage extends TFM_Command
return false;
}
if (TFM_Util.isStopCommand(args[0]) && sender instanceof Player)
if ("off".equals(args[0]) && sender instanceof Player)
{
TFM_Util.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
@ -33,9 +33,9 @@ public class Command_cage extends TFM_Command
return true;
}
else if ("purge".equalsIgnoreCase(args[0]))
else if ("purge".equals(args[0]))
{
TFM_Util.adminAction(sender.getName(), "Uncaging all players.", true);
TFM_Util.adminAction(sender.getName(), "Uncaging all players", true);
for (Player player : server.getOnlinePlayers())
{
@ -63,7 +63,7 @@ public class Command_cage extends TFM_Command
if (args.length >= 2)
{
if (TFM_Util.isStopCommand(args[1]))
if ("off".equals(args[1]))
{
TFM_Util.adminAction(sender.getName(), "Uncaging " + player.getName(), true);

View File

@ -13,10 +13,9 @@ public class Command_denick 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(), "Removing all nicknames.", false);
TFM_Util.adminAction(sender.getName(), "Removing all nicknames", false);
Player[] onlinePlayers = server.getOnlinePlayers();
for (Player player : onlinePlayers)
for (Player player : server.getOnlinePlayers())
{
TFM_EssentialsBridge.getInstance().setNickname(player.getName(), null);
}

View File

@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
@ -51,8 +52,11 @@ public class Command_doom extends TFM_Command
// deop
player.setOp(false);
// ban IP
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName()));
// ban IPs
for (String playerIp : TFM_PlayerList.getInstance().getEntry(player).getIps())
{
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(playerIp, player.getName()));
}
// ban name
TFM_BanManager.getInstance().addUuidBan(new TFM_Ban(player.getUniqueId(), player.getName()));

View File

@ -55,13 +55,6 @@ public class Command_enchant extends TFM_Command
{
for (Enchantment ench : Enchantment.values())
{
/*
2013-07-20 23:17:13 [INFO] [TotalFreedomMod]: Command Error: enchant
java.lang.NullPointerException
at net.minecraft.server.v1_6_R2.EnchantmentDurability.canEnchant(SourceFile:33)
at org.bukkit.craftbukkit.v1_6_R2.enchantments.CraftEnchantment.canEnchantItem(CraftEnchantment.java:55)
at me.StevenLawson.TotalFreedomMod.Commands.Command_enchant.run(Command_enchant.java:56)
*/
try
{
if (ench.canEnchantItem(itemInHand))
@ -122,7 +115,7 @@ public class Command_enchant extends TFM_Command
playerMsg("Can't use this enchantment on held item.");
}
}
else if (TFM_Util.isRemoveCommand(args[0]))
else if (args[0].equals("remove"))
{
itemInHand.removeEnchantment(ench);

View File

@ -29,7 +29,7 @@ public class Command_jumppads extends TFM_Command
return true;
}
if (TFM_Util.isStopCommand(args[0]))
if ("off".equals(args[0]))
{
TFM_Util.adminAction(sender.getName(), "Disabling Jumppads", false);
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.OFF);
@ -50,7 +50,7 @@ public class Command_jumppads extends TFM_Command
if (args[0].equalsIgnoreCase("sideways"))
{
if (TFM_Util.isStopCommand(args[1]))
if ("off".equals(args[1]))
{
TFM_Util.adminAction(sender.getName(), "Setting Jumppads mode to: Madgeek", false);
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.MADGEEK);

View File

@ -1,34 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Prevents new players from joining the server", usage = "/<command> <on | off>")
public class Command_lockdown extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
if (TFM_Util.isStopCommand(args[0]))
{
TFM_Util.adminAction(sender.getName(), "De-activating server lockdown", true);
TotalFreedomMod.lockdownEnabled = false;
}
else
{
TFM_Util.adminAction(sender.getName(), "Activating server lockdown", true);
TotalFreedomMod.lockdownEnabled = true;
}
return true;
}
}

View File

@ -59,7 +59,7 @@ public class Command_lockup extends TFM_Command
startLockup(player);
playerMsg("Locked up " + player.getName() + ".");
}
else if (TFM_Util.isStopCommand(args[1]))
else if ("off".equals(args[1]))
{
final Player player = getPlayer(args[0]);

View File

@ -12,7 +12,6 @@ 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_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -32,7 +31,7 @@ public class Command_logs extends TFM_Command
if (args.length == 1)
{
mode = (TFM_Util.isStopCommand(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
}
updateLogsRegistration(sender, sender_p, mode);

View File

@ -19,7 +19,7 @@ public class Command_nicknyan extends TFM_Command
return false;
}
if (TFM_Util.isStopCommand(args[0]))
if ("off".equals(args[0]))
{
TFM_EssentialsBridge.getInstance().setNickname(sender.getName(), null);
playerMsg("Nickname cleared.");

View File

@ -11,7 +11,8 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!", usage = "/<command> <target> [power]")
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!",
usage = "/<command> <target> [<<power> | stop>]")
public class Command_orbit extends TFM_Command
{
@Override
@ -36,7 +37,7 @@ public class Command_orbit extends TFM_Command
if (args.length >= 2)
{
if (TFM_Util.isStopCommand(args[1]))
if (args[1].equals("stop"))
{
playerMsg("Stopped orbiting " + player.getName());
playerdata.stopOrbiting();
@ -58,7 +59,7 @@ public class Command_orbit extends TFM_Command
playerdata.startOrbiting(strength);
player.setVelocity(new Vector(0, strength, 0));
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName() + ".", false);
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
return true;
}

View File

@ -44,7 +44,7 @@ public class Command_protectarea extends TFM_Command
}
else if (args.length == 2)
{
if (TFM_Util.isRemoveCommand(args[0]))
if ("remove".equals(args[0]))
{
TFM_ProtectedArea.removeProtectedArea(args[1]);

View File

@ -170,7 +170,7 @@ public class Command_saconfig extends TFM_Command
return true;
}
if (TFM_Util.isRemoveCommand(args[0]))
if ("remove".equals(args[0]))
{
if (!TFM_AdminList.isSeniorAdmin(sender))
{

View File

@ -62,7 +62,7 @@ public class Command_tag extends TFM_Command
return true;
}
if (TFM_Util.isStopCommand(args[0]))
if ("remove".equals(args[0]))
{
TFM_PlayerData.getPlayerData(sender_p).setTag(null);
playerMsg("Your tag has been removed.");

View File

@ -0,0 +1,37 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Gives you a tag with random colors", usage = "/<command> <tag>", aliases = "tn")
public class Command_tagnyan extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
final StringBuilder tag = new StringBuilder();
for (char c : ChatColor.stripColor(TFM_Util.colorize(StringUtils.join(args, " "))).toCharArray())
{
tag.append(TFM_Util.randomChatColor()).append(c);
}
final TFM_PlayerData data = TFM_PlayerData.getPlayerData(sender_p);
data.setTag(tag.toString());
playerMsg("Set tag to " + tag);
return true;
}
}

View File

@ -4,6 +4,7 @@ import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler.TFM_GameRule;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -27,6 +28,7 @@ public class Command_toggle extends TFM_Command
playerMsg("- lavadmg");
playerMsg("- firespread");
playerMsg("- prelog");
playerMsg("- lockdown");
playerMsg("- petprotect");
playerMsg("- droptoggle");
playerMsg("- nonuke");
@ -78,6 +80,13 @@ public class Command_toggle extends TFM_Command
return true;
}
if (args[0].equals("lockdown"))
{
TFM_Util.adminAction(sender.getName(), (TotalFreedomMod.lockdownEnabled ? "De-a" : "A") + "ctivating server lockdown", true);
TotalFreedomMod.lockdownEnabled = !TotalFreedomMod.lockdownEnabled;
return true;
}
if (args[0].equals("petprotect"))
{
toggle("Tamed pet protection is", TFM_ConfigEntry.PET_PROTECT_ENABLED);

View File

@ -13,7 +13,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Throw a mob in the direction you are facing when you left click with a stick.", usage = "/<command> <mobtype [speed] | off | list>")
@CommandParameters(description = "Throw a mob in the direction you are facing when you left click with a stick.",
usage = "/<command> <mobtype [speed] | off | list>")
public class Command_tossmob extends TFM_Command
{
@Override
@ -30,7 +31,7 @@ public class Command_tossmob extends TFM_Command
EntityType creature = EntityType.PIG;
if (args.length >= 1)
{
if (TFM_Util.isStopCommand(args[0]))
if ("off".equals(args[0]))
{
playerData.disableMobThrower();
playerMsg("MobThrower is disabled.", ChatColor.GREEN);

View File

@ -28,7 +28,7 @@ public class Command_trail extends TFM_Command
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length > 0 && TFM_Util.isStopCommand(args[0]))
if (args.length > 0 && "off".equals(args[0]))
{
trailPlayers.remove(sender_p);

View File

@ -101,7 +101,7 @@ public class Command_whitelist extends TFM_Command
}
// remove
if (TFM_Util.isRemoveCommand(args[0]))
if ("remove".equals(args[0]))
{
if (args.length < 2)
{

View File

@ -45,8 +45,6 @@ public class TFM_Util
{
private static final Map<String, Integer> ejectTracker = new HashMap<String, Integer>();
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
public static final List<String> STOP_COMMANDS = Arrays.asList("stop", "off", "end", "halt", "die");
public static final List<String> REMOVE_COMMANDS = Arrays.asList("del", "delete", "rem", "remove");
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "DarthSalamon", "AcidicCyanide", "wild1145", "WickedGamingUK", "xXWilee999Xx");
private static final Random RANDOM = new Random();
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
@ -430,16 +428,6 @@ public class TFM_Util
return new File(plugin.getDataFolder(), name);
}
public static boolean isStopCommand(String command)
{
return STOP_COMMANDS.contains(command.toLowerCase());
}
public static boolean isRemoveCommand(String command)
{
return REMOVE_COMMANDS.contains(command.toLowerCase());
}
public static void autoEject(Player player, String kickMessage)
{
EjectMethod method = EjectMethod.STRIKE_ONE;