Code refactoring and cleanup.

This commit is contained in:
StevenLawson 2014-08-23 14:19:25 -04:00
parent 0f764b976b
commit 755080d0a4
52 changed files with 109 additions and 146 deletions

View file

@ -156,7 +156,6 @@ public class TFM_WorldEditBridge
}.runTask(TotalFreedomMod.plugin);
}
}
catch (IncompleteRegionException ex)
{

View file

@ -3,7 +3,6 @@ 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.TotalFreedomMod;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -117,7 +116,7 @@ public class Command_adminworld extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
@ -216,7 +215,7 @@ public class Command_adminworld extends TFM_Command
{
if (!(sender instanceof Player) || sender_p == null || !TFM_AdminList.isSuperAdmin(sender))
{
throw new PermissionDeniedException(TotalFreedomMod.MSG_NO_PERMS);
throw new PermissionDeniedException(TFM_Command.MSG_NO_PERMS);
}
}

View file

@ -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.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -41,7 +40,7 @@ public class Command_blockcmd extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
@ -52,7 +51,7 @@ public class Command_cage extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Minecart;
@ -23,7 +22,7 @@ public class Command_cartsit extends TFM_Command
if (targetPlayer == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
}

View file

@ -48,4 +48,4 @@ public class Command_cmdlist extends TFM_Command
return true;
}
}
}

View file

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -35,7 +34,7 @@ public class Command_creative extends TFM_Command
{
if (!TFM_AdminList.isSuperAdmin(sender))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -54,12 +53,11 @@ public class Command_creative extends TFM_Command
return true;
}
player = getPlayer(args[0]);
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -1,7 +1,6 @@
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;
@ -18,7 +17,7 @@ public class Command_deopall extends TFM_Command
for (Player player : server.getOnlinePlayers())
{
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
player.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
}
return true;

View file

@ -5,8 +5,6 @@ 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.TFM_UuidResolver;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
@ -31,7 +29,7 @@ public class Command_doom extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -5,14 +5,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>")
public class Command_ender extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.gotoWorld(sender, server.getWorlds().get(0).getName() + "_the_end");
TFM_Util.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_the_end");
return true;
}
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -24,7 +23,7 @@ public class Command_findip extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -85,7 +85,7 @@ public class Command_fr extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}

View file

@ -5,7 +5,6 @@ import java.util.Iterator;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -165,7 +164,7 @@ public class Command_gadmin extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), String.format("Opping %s.", target.getName()), false);
target.setOp(false);
target.sendMessage(TotalFreedomMod.YOU_ARE_OP);
target.sendMessage(TFM_Command.YOU_ARE_OP);
break;
}
@ -173,7 +172,7 @@ public class Command_gadmin extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), String.format("Deopping %s.", target.getName()), false);
target.setOp(false);
target.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
target.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
break;
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -23,7 +22,7 @@ public class Command_gcmd extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -5,7 +5,6 @@ import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -31,7 +30,7 @@ public class Command_gtfo extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}

View file

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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;
@ -81,7 +80,7 @@ public class Command_halt extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -23,7 +22,7 @@ public class Command_lastcmd extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
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;
@ -51,7 +50,7 @@ public class Command_lockup extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
@ -65,7 +64,7 @@ public class Command_lockup extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -5,14 +5,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the nether.", usage = "/<command>")
public class Command_nether extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
TFM_Util.gotoWorld(sender, server.getWorlds().get(0).getName() + "_nether");
TFM_Util.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_nether");
return true;
}
}

View file

@ -4,7 +4,6 @@ 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 me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -28,7 +27,7 @@ public class Command_onlinemode extends TFM_Command
if (sender instanceof Player && !TFM_AdminList.isSeniorAdmin(sender, true))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -35,7 +34,7 @@ public class Command_opall extends TFM_Command
for (Player player : server.getOnlinePlayers())
{
player.setOp(true);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
player.sendMessage(TFM_Command.YOU_ARE_OP);
if (doSetGamemode)
{

View file

@ -1,7 +1,6 @@
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;
@ -15,7 +14,7 @@ public class Command_opme extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false);
sender.setOp(true);
sender.sendMessage(TotalFreedomMod.YOU_ARE_OP);
sender.sendMessage(TFM_Command.YOU_ARE_OP);
return true;
}

View file

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -44,7 +43,7 @@ public class Command_ops extends TFM_Command
{
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -55,7 +54,7 @@ public class Command_ops extends TFM_Command
player.setOp(false);
if (player.isOnline())
{
playerMsg(player.getPlayer(), TotalFreedomMod.YOU_ARE_NOT_OP);
playerMsg(player.getPlayer(), TFM_Command.YOU_ARE_NOT_OP);
}
}
return true;

View file

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
@ -27,7 +26,7 @@ public class Command_orbit extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PermbanList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -28,7 +27,7 @@ public class Command_permban extends TFM_Command
{
if (!senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}
playerMsg("Reloading permban list...", ChatColor.RED);

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -40,7 +39,7 @@ public class Command_potion extends TFM_Command
{
if (!(TFM_AdminList.isSuperAdmin(sender) || senderIsConsole))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
TFM_Util.adminAction(sender.getName(), "Cleared all potion effects from all players", true);
@ -62,7 +61,7 @@ public class Command_potion extends TFM_Command
if (target == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
}
@ -106,7 +105,7 @@ public class Command_potion extends TFM_Command
if (target == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
}

View file

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -38,7 +37,7 @@ public class Command_qdeop extends TFM_Command
{
matchedPlayerNames.add(player.getName());
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
player.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
}
}
}

View file

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -38,7 +37,7 @@ public class Command_qop extends TFM_Command
{
matchedPlayerNames.add(player.getName());
player.setOp(true);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
player.sendMessage(TFM_Command.YOU_ARE_OP);
}
}
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -38,11 +37,10 @@ public class Command_rank extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
playerMsg(player.getName() + " is " + TFM_PlayerRank.fromSender(player).getLoginMessage(), ChatColor.AQUA);
return true;

View file

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -71,7 +70,7 @@ public class Command_ro extends TFM_Command
targetPlayer = getPlayer(args[2]);
if (targetPlayer == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
}

View file

@ -85,7 +85,6 @@ public class Command_rollback extends TFM_Command
{
String playerName = null;
final Player player = getPlayer(playerNameInput);
if (player != null)
{

View file

@ -6,7 +6,6 @@ import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
@ -39,7 +38,7 @@ public class Command_saconfig extends TFM_Command
{
if (!TFM_AdminList.isSeniorAdmin(sender, true))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -53,7 +52,7 @@ public class Command_saconfig extends TFM_Command
// All commands below are superadmin+ commands.
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -61,7 +60,7 @@ public class Command_saconfig extends TFM_Command
{
if (senderIsConsole)
{
playerMsg(TotalFreedomMod.NOT_FROM_CONSOLE);
playerMsg(TFM_Command.NOT_FROM_CONSOLE);
return true;
}
@ -157,7 +156,7 @@ public class Command_saconfig extends TFM_Command
if (superadmin == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
@ -185,7 +184,7 @@ public class Command_saconfig extends TFM_Command
{
if (!TFM_AdminList.isSeniorAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}

View file

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -26,7 +25,7 @@ public class Command_smite extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -102,7 +102,7 @@ public class Command_stfu extends TFM_Command
if (player == null)
{
sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND);
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -36,7 +35,7 @@ public class Command_survival extends TFM_Command
{
if (!TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -55,7 +54,7 @@ public class Command_survival extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
}

View file

@ -5,7 +5,6 @@ import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -45,7 +44,7 @@ public class Command_tag extends TFM_Command
{
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -91,7 +90,7 @@ public class Command_tag extends TFM_Command
{
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -99,7 +98,7 @@ public class Command_tag extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}

View file

@ -2,9 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
@ -27,11 +25,10 @@ public class Command_tban extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
// strike with lightning effect:
final Location targetPos = player.getLocation();
for (int x = -1; x <= 1; x++)

View file

@ -31,7 +31,7 @@ public class Command_tempban extends TFM_Command
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND);
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
return true;
}
@ -55,7 +55,6 @@ public class Command_tempban extends TFM_Command
message.append(", Reason: \"").append(reason).append("\"");
}
// strike with lightning effect:
final Location targetPos = player.getLocation();
for (int x = -1; x <= 1; x++)
@ -72,7 +71,6 @@ public class Command_tempban extends TFM_Command
TFM_BanManager.addIpBan(new TFM_Ban(TFM_Util.getIp(player), player.getName(), sender.getName(), expires, reason));
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_Util.getUuid(player), player.getName(), sender.getName(), expires, reason));
player.kickPlayer(sender.getName() + " - " + message.toString());
return true;

View file

@ -33,7 +33,7 @@ public class Command_tfm extends TFM_Command
if (!TFM_AdminList.isSuperAdmin(sender))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}

View file

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.io.File;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
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;
@ -28,7 +27,7 @@ public class Command_tfupdate extends TFM_Command
if (!sender.getName().equalsIgnoreCase("madgeek1450"))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
playerMsg(TFM_Command.MSG_NO_PERMS);
return true;
}

View file

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -113,7 +112,7 @@ public class Command_twitter extends TFM_Command
{
if (!sender.getName().equalsIgnoreCase("DarthSalamon"))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}

View file

@ -109,7 +109,6 @@ public class Command_uuid extends TFM_Command
}
return false;
}

View file

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -58,7 +57,7 @@ public class Command_whitelist extends TFM_Command
// all commands past this line are superadmin-only
if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}
@ -152,7 +151,7 @@ public class Command_whitelist extends TFM_Command
// all commands past this line are console/telnet only
if (!senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}

View file

@ -13,6 +13,12 @@ import org.bukkit.entity.Player;
public abstract class TFM_Command
{
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
public static final String PLAYER_NOT_FOUND = ChatColor.GRAY + "Player not found!";
protected TotalFreedomMod plugin;
protected Server server;
private CommandSender commandSender;

View file

@ -40,7 +40,6 @@ public class TFM_CommandHandler
StringUtils.join(args, " ")), true);
}
final TFM_Command dispatcher;
try
{
@ -62,7 +61,7 @@ public class TFM_CommandHandler
if (!dispatcher.senderHasPermission())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
return true;
}

View file

@ -1,6 +1,5 @@
package me.StevenLawson.TotalFreedomMod;
import java.io.File;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@ -22,7 +21,6 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.util.FileUtil;
public class TFM_AdminList
{
@ -136,7 +134,6 @@ public class TFM_AdminList
admin.isSeniorAdmin(),
admin.isActivated());
newAdmin.addIps(admin.getIps());
adminList.remove(oldUuid);
@ -222,7 +219,6 @@ public class TFM_AdminList
telnetUUIDs.add(uuid);
}
if (admin.isSeniorAdmin())
{
seniorUUIDs.add(uuid);
@ -413,7 +409,6 @@ public class TFM_AdminList
}
}
if (!(sender instanceof Player))
{
return seniorConsoleNames.contains(sender.getName())
@ -443,7 +438,6 @@ public class TFM_AdminList
return true;
}
if (superIps.contains(TFM_Util.getIp(player)))
{
return true;

View file

@ -31,8 +31,8 @@ public class TFM_Heartbeat extends BukkitRunnable
{
lastRan = System.currentTimeMillis();
final boolean doAwayKickCheck =
TFM_ConfigEntry.AUTOKICK_ENABLED.getBoolean()
final boolean doAwayKickCheck
= TFM_ConfigEntry.AUTOKICK_ENABLED.getBoolean()
&& TFM_EssentialsBridge.isEssentialsEnabled()
&& ((server.getOnlinePlayers().length / server.getMaxPlayers()) > TFM_ConfigEntry.AUTOKICK_THRESHOLD.getDouble());

View file

@ -70,7 +70,6 @@ public enum TFM_PlayerRank
return DEVELOPER;
}
final TFM_Admin entry = TFM_AdminList.getEntry((Player) sender);
final TFM_PlayerRank rank;

View file

@ -1,7 +1,14 @@
package me.StevenLawson.TotalFreedomMod;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import java.io.*;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.net.URL;
import java.nio.channels.Channels;
@ -10,12 +17,24 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
import net.minecraft.util.org.apache.commons.io.FileUtils;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -260,35 +279,31 @@ public class TFM_Util
return escapedIp.trim().replaceAll("_", "\\.");
}
public static void gotoWorld(CommandSender sender, String targetworld)
public static void gotoWorld(Player player, String targetWorld)
{
if (sender instanceof Player)
if (player == null)
{
Player player = (Player) sender;
return;
}
if (player.getWorld().getName().equalsIgnoreCase(targetworld))
if (player.getWorld().getName().equalsIgnoreCase(targetWorld))
{
playerMsg(player, "Going to main world.", ChatColor.GRAY);
player.teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
return;
}
for (World world : Bukkit.getWorlds())
{
if (world.getName().equalsIgnoreCase(targetWorld))
{
sender.sendMessage(ChatColor.GRAY + "Going to main world.");
player.teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
playerMsg(player, "Going to world: " + targetWorld, ChatColor.GRAY);
player.teleport(world.getSpawnLocation());
return;
}
for (World world : Bukkit.getWorlds())
{
if (world.getName().equalsIgnoreCase(targetworld))
{
sender.sendMessage(ChatColor.GRAY + "Going to world: " + targetworld);
player.teleport(world.getSpawnLocation());
return;
}
}
sender.sendMessage(ChatColor.GRAY + "World " + targetworld + " not found.");
}
else
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
}
playerMsg(player, "World " + targetWorld + " not found.", ChatColor.GRAY);
}
public static String decolorize(String string)

View file

@ -14,7 +14,6 @@ import java.util.Properties;
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
import me.StevenLawson.TotalFreedomMod.HTTPD.TFM_HTTPD_Manager;
import me.StevenLawson.TotalFreedomMod.Listener.*;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
@ -36,12 +35,6 @@ public class TotalFreedomMod extends JavaPlugin
public static final String PROTECTED_AREA_FILE = "protectedareas.dat";
public static final String SAVED_FLAGS_FILE = "savedflags.dat";
//
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
public static final String PLAYER_NOT_FOUND = ChatColor.GRAY + "Player not found!";
//
public static String buildNumber = "1";
public static String buildDate = TotalFreedomMod.buildDate = TFM_Util.dateToString(new Date());
public static String buildCreator = "Unknown";

View file

@ -56,4 +56,4 @@ public class CleanroomBlockPopulator extends BlockPopulator
}
}
}
}
}

View file

@ -233,4 +233,4 @@ public class CleanroomChunkGenerator extends ChunkGenerator
return new Location(world, 0, world.getHighestBlockYAt(0, 0), 0);
}
}
}