Added /premium

cleanup
This commit is contained in:
JeromSar 2013-08-14 15:12:30 +02:00
parent 422a7716f3
commit 0964871e8b
90 changed files with 748 additions and 676 deletions

View File

@ -1,5 +1,5 @@
#Tue, 13 Aug 2013 16:50:36 -0400
#Wed, 14 Aug 2013 15:07:06 +0200
program.VERSION=2.22
program.BUILDNUM=458
program.BUILDDATE=08/13/2013 04\:50 PM
program.BUILDNUM=467
program.BUILDDATE=08/14/2013 03\:07 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Tue Aug 13 16:50:36 EDT 2013
build.number=459
#Wed Aug 14 15:07:06 CEST 2013
build.number=468

View File

@ -29,11 +29,11 @@ public class Command_adminmode extends TFM_Command
{
TotalFreedomMod.adminOnlyMode = true;
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
p.kickPlayer("Server is now closed to non-superadmins.");
player.kickPlayer("Server is now closed to non-superadmins.");
}
}
return true;

View File

@ -23,9 +23,9 @@ public class Command_blockcmd extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Unblocking commands for all players", true);
int counter = 0;
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (playerdata.allCommandsBlocked())
{
counter += 1;
@ -36,28 +36,28 @@ public class Command_blockcmd extends TFM_Command
return true;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage());
playerMsg(e.getMessage());
return true;
}
if (TFM_SuperadminList.isUserSuperadmin(p))
if (TFM_SuperadminList.isUserSuperadmin(player))
{
playerMsg(p.getName() + " is a Superadmin, and cannot have their commands blocked.");
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
TFM_Util.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + p.getName(), true);
TFM_Util.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
return true;

View File

@ -21,18 +21,18 @@ public class Command_cage extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
Material cage_material_outer = Material.GLASS;
Material cage_material_inner = Material.AIR;
@ -40,7 +40,7 @@ public class Command_cage extends TFM_Command
{
if (TFM_Util.isStopCommand(args[1]))
{
TFM_Util.adminAction(sender.getName(), "Uncaging " + p.getName() + ".", true);
TFM_Util.adminAction(sender.getName(), "Uncaging " + player.getName() + ".", true);
playerdata.setCaged(false);
playerdata.regenerateHistory();
@ -70,7 +70,7 @@ public class Command_cage extends TFM_Command
}
}
Location target_pos = p.getLocation().add(0, 1, 0);
Location target_pos = player.getLocation().add(0, 1, 0);
playerdata.setCaged(true, target_pos, cage_material_outer, cage_material_inner);
playerdata.regenerateHistory();
playerdata.clearHistory();
@ -78,9 +78,9 @@ public class Command_cage extends TFM_Command
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER));
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
p.setGameMode(GameMode.SURVIVAL);
player.setGameMode(GameMode.SURVIVAL);
TFM_Util.adminAction(sender.getName(), "Caging " + p.getName() + ".", true);
TFM_Util.adminAction(sender.getName(), "Caging " + player.getName() + ".", true);
return true;
}

View File

@ -28,14 +28,14 @@ public class Command_cake extends TFM_Command
output.append(ChatColor.COLOR_CHAR).append(color_code).append(word).append(" ");
}
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
p.awardAchievement(Achievement.MINE_WOOD);
p.awardAchievement(Achievement.BUILD_WORKBENCH);
p.awardAchievement(Achievement.BUILD_HOE);
p.awardAchievement(Achievement.BAKE_CAKE);
player.getInventory().setItem(player.getInventory().firstEmpty(), heldItem);
player.awardAchievement(Achievement.MINE_WOOD);
player.awardAchievement(Achievement.BUILD_WORKBENCH);
player.awardAchievement(Achievement.BUILD_HOE);
player.awardAchievement(Achievement.BAKE_CAKE);
}
TFM_Util.bcastMsg(output.toString());

View File

@ -21,9 +21,9 @@ public class Command_cartsit extends TFM_Command
{
target_player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
}

View File

@ -21,11 +21,11 @@ public class Command_cmdlist extends TFM_Command
{
List<String> commands = new ArrayList<String>();
for (Plugin p : server.getPluginManager().getPlugins())
for (Plugin target_plugin : server.getPluginManager().getPlugins())
{
try
{
PluginDescriptionFile desc = p.getDescription();
PluginDescriptionFile desc = target_plugin.getDescription();
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands();
if (map != null)
@ -37,7 +37,7 @@ public class Command_cmdlist extends TFM_Command
}
}
}
catch (Throwable ex)
catch (Throwable e)
{
}
}

View File

@ -24,10 +24,10 @@ public class Command_creative extends TFM_Command
}
}
Player p;
Player target;
if (args.length == 0)
{
p = sender_p;
target = sender_p;
}
else
{
@ -56,19 +56,19 @@ public class Command_creative extends TFM_Command
try
{
p = getPlayer(args[0]);
target = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
}
playerMsg("Setting " + p.getName() + " to game mode 'Creative'.");
playerMsg(p, sender.getName() + " set your game mode to 'Creative'.");
p.setGameMode(GameMode.CREATIVE);
playerMsg("Setting " + target.getName() + " to game mode 'Creative'.");
playerMsg(target, sender.getName() + " set your game mode to 'Creative'.");
target.setGameMode(GameMode.CREATIVE);
return true;
}

View File

@ -18,7 +18,7 @@ public class Command_deafen extends TFM_Command
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
for (final Player p : server.getOnlinePlayers())
for (final Player player: server.getOnlinePlayers())
{
for (double percent = 0.0; percent <= 1.0; percent += (1.0 / STEPS))
{
@ -29,7 +29,7 @@ public class Command_deafen extends TFM_Command
@Override
public void run()
{
p.playSound(randomOffset(p.getLocation(), 5.0), Sound.values()[random.nextInt(Sound.values().length)], 100.0f, pitch);
player.playSound(randomOffset(player.getLocation(), 5.0), Sound.values()[random.nextInt(Sound.values().length)], 100.0f, pitch);
}
}.runTaskLater(plugin, Math.round(20.0 * percent * 2.0));
}

View File

@ -34,9 +34,9 @@ public class Command_debug extends TFM_Command
sender.sendMessage("Debug: OK");
}
catch (Exception ex)
catch (Exception e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
}
return true;

View File

@ -18,25 +18,25 @@ public class Command_deop extends TFM_Command
return false;
}
OfflinePlayer p = null;
OfflinePlayer player = null;
for (Player onlinePlayer : server.getOnlinePlayers())
{
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
{
p = onlinePlayer;
player = onlinePlayer;
}
}
// if the player is not online
if (p == null)
if (player == null)
{
p = server.getOfflinePlayer(args[0]);
player = server.getOfflinePlayer(args[0]);
}
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false);
p.setOp(false);
player.setOp(false);
return true;
}

View File

@ -15,10 +15,10 @@ public class Command_deopall extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "De-opping all players on the server", true);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
return true;

View File

@ -29,7 +29,7 @@ public class Command_dispfill extends TFM_Command
{
radius = Math.max(5, Math.min(25, Integer.parseInt(args[0])));
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
sender.sendMessage("Invalid radius.");
return true;
@ -49,7 +49,7 @@ public class Command_dispfill extends TFM_Command
{
is = new ItemStack(Integer.parseInt(search_item), 64);
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
}
}

View File

@ -22,53 +22,53 @@ public class Command_doom extends TFM_Command
return false;
}
final Player p;
final Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + p.getName(), true);
TFM_Util.bcastMsg(p.getName() + " will be completely obliviated!", ChatColor.RED);
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
TFM_Util.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED);
final String IP = p.getAddress().getAddress().getHostAddress().trim();
final String IP = player.getAddress().getAddress().getHostAddress().trim();
// remove from superadmin
if (TFM_SuperadminList.isUserSuperadmin(p))
if (TFM_SuperadminList.isUserSuperadmin(player))
{
TFM_Util.adminAction(sender.getName(), "Removing " + p.getName() + " from the superadmin list.", true);
TFM_SuperadminList.removeSuperadmin(p);
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
TFM_SuperadminList.removeSuperadmin(player);
}
// remove from whitelist
p.setWhitelisted(false);
player.setWhitelisted(false);
// deop
p.setOp(false);
player.setOp(false);
// ban IP
TFM_ServerInterface.banIP(IP, null, null, null);
// ban name
TFM_ServerInterface.banUsername(p.getName(), null, null, null);
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
// set gamemode to survival
p.setGameMode(GameMode.SURVIVAL);
player.setGameMode(GameMode.SURVIVAL);
// clear inventory
p.closeInventory();
p.getInventory().clear();
player.closeInventory();
player.getInventory().clear();
// ignite player
p.setFireTicks(10000);
player.setFireTicks(10000);
// generate explosion
p.getWorld().createExplosion(p.getLocation(), 4F);
player.getWorld().createExplosion(player.getLocation(), 4F);
new BukkitRunnable()
{
@ -76,10 +76,10 @@ public class Command_doom extends TFM_Command
public void run()
{
// strike lightning
p.getWorld().strikeLightning(p.getLocation());
player.getWorld().strikeLightning(player.getLocation());
// kill (if not done already)
p.setHealth(0.0);
player.setHealth(0.0);
}
}.runTaskLater(plugin, 20L * 2L);
@ -89,13 +89,13 @@ public class Command_doom extends TFM_Command
public void run()
{
// message
TFM_Util.adminAction(sender.getName(), "Banning " + p.getName() + ", IP: " + IP, true);
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + IP, true);
// generate explosion
p.getWorld().createExplosion(p.getLocation(), 4F);
player.getWorld().createExplosion(player.getLocation(), 4F);
// kick player
p.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
player.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
}
}.runTaskLater(plugin, 20L * 3L);

View File

@ -68,7 +68,7 @@ public class Command_enchant extends TFM_Command
itemInHand.addEnchantment(ench, ench.getMaxLevel());
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.info("Error using " + ench.getName() + " on " + itemInHand.getType().name() + " held by " + sender_p.getName() + ".");
}
@ -98,7 +98,7 @@ public class Command_enchant extends TFM_Command
{
ench = Enchantment.getByName(args[1]);
}
catch (Exception ex)
catch (Exception e)
{
}

View File

@ -38,25 +38,25 @@ public class Command_expel extends TFM_Command
}
Location sender_pos = sender_p.getLocation();
for (Player p : sender_pos.getWorld().getPlayers())
for (Player player: sender_pos.getWorld().getPlayers())
{
if (!p.equals(sender_p))
if (!player.equals(sender_p))
{
Location target_pos = p.getLocation();
Location target_pos = player.getLocation();
boolean in_range = false;
try
{
in_range = target_pos.distanceSquared(sender_pos) < (radius * radius);
}
catch (IllegalArgumentException ex)
catch (IllegalArgumentException e)
{
}
if (in_range)
{
p.setVelocity(target_pos.clone().subtract(sender_pos).toVector().normalize().multiply(strength));
playerMsg("Pushing " + p.getName() + ".");
player.setVelocity(target_pos.clone().subtract(sender_pos).toVector().normalize().multiply(strength));
playerMsg("Pushing " + player.getName() + ".");
}
}
}

View File

@ -24,9 +24,9 @@ public class Command_explosives extends TFM_Command
{
TotalFreedomMod.explosiveRadius = Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1])));
}
catch (NumberFormatException nfex)
catch (NumberFormatException e)
{
TFM_Util.playerMsg(sender, nfex.getMessage());
TFM_Util.playerMsg(sender, e.getMessage());
return true;
}
}

View File

@ -19,18 +19,18 @@ public class Command_findip extends TFM_Command
return false;
}
final Player p;
final Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage());
playerMsg(e.getMessage());
return true;
}
playerMsg("Player IPs: " + StringUtils.join(TFM_UserList.getInstance(TotalFreedomMod.plugin).getEntry(p).getIpAddresses(), ", "));
playerMsg("Player IPs: " + StringUtils.join(TFM_UserList.getInstance(TotalFreedomMod.plugin).getEntry(player).getIpAddresses(), ", "));
return true;
}

View File

@ -62,9 +62,9 @@ public class Command_fr extends TFM_Command
TotalFreedomMod.freezePurgeTask.cancel();
}
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setFrozen(false);
}
@ -72,22 +72,22 @@ public class Command_fr extends TFM_Command
}
else
{
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setFrozen(!playerdata.isFrozen());
playerMsg(p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
playerMsg(p, "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA);
playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
playerMsg(player, "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA);
}
}

View File

@ -30,7 +30,7 @@ public class Command_fuckoff extends TFM_Command
{
fuckoff_range = Math.max(5.0, Math.min(100.0, Double.parseDouble(args[1])));
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
}
}

View File

@ -30,77 +30,77 @@ public class Command_gadmin extends TFM_Command
playerMsg("[ Real Name ] : [ Display Name ] - Hash:");
}
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
String hash = p.getUniqueId().toString().substring(0, 4);
String hash = player.getUniqueId().toString().substring(0, 4);
if (mode.equals("list"))
{
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
p.getName(),
ChatColor.stripColor(p.getDisplayName()),
player.getName(),
ChatColor.stripColor(player.getDisplayName()),
hash));
}
else if (hash.equalsIgnoreCase(args[1]))
{
if (mode.equals("kick"))
{
TFM_Util.adminAction(sender.getName(), String.format("Kicking: %s.", p.getName()), false);
p.kickPlayer("Kicked by Administrator");
TFM_Util.adminAction(sender.getName(), String.format("Kicking: %s.", player.getName()), false);
player.kickPlayer("Kicked by Administrator");
}
else if (mode.equals("nameban"))
{
TFM_ServerInterface.banUsername(p.getName(), null, null, null);
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s.", p.getName()), true);
p.kickPlayer("Username banned by Administrator.");
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s.", player.getName()), true);
player.kickPlayer("Username banned by Administrator.");
}
else if (mode.equals("ipban"))
{
String user_ip = p.getAddress().getAddress().getHostAddress();
String user_ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\.");
if (ip_parts.length == 4)
{
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", p.getName(), user_ip), true);
TFM_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", player.getName(), user_ip), true);
TFM_ServerInterface.banIP(user_ip, null, null, null);
p.kickPlayer("IP address banned by Administrator.");
player.kickPlayer("IP address banned by Administrator.");
}
else if (mode.equals("ban"))
{
String user_ip = p.getAddress().getAddress().getHostAddress();
String user_ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\.");
if (ip_parts.length == 4)
{
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), true);
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", player.getName(), user_ip), true);
TFM_ServerInterface.banIP(user_ip, null, null, null);
TFM_ServerInterface.banUsername(p.getName(), null, null, null);
p.kickPlayer("IP and username banned by Administrator.");
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
player.kickPlayer("IP and username banned by Administrator.");
}
else if (mode.equals("op"))
{
TFM_Util.adminAction(sender.getName(), String.format("Opping %s.", p.getName()), false);
p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
TFM_Util.adminAction(sender.getName(), String.format("Opping %s.", player.getName()), false);
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
}
else if (mode.equals("deop"))
{
TFM_Util.adminAction(sender.getName(), String.format("Deopping %s.", p.getName()), false);
p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
TFM_Util.adminAction(sender.getName(), String.format("Deopping %s.", player.getName()), false);
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
else if (mode.equals("ci"))
{
p.getInventory().clear();
player.getInventory().clear();
}
else if (mode.equals("fr"))
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setFrozen(!playerdata.isFrozen());
playerMsg(p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
player.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
}
return true;

View File

@ -17,14 +17,14 @@ public class Command_gcmd extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
@ -38,16 +38,16 @@ public class Command_gcmd extends TFM_Command
}
outcommand = outcommand_bldr.toString().trim();
}
catch (Throwable ex)
catch (Throwable e)
{
sender.sendMessage(ChatColor.GRAY + "Error building command: " + ex.getMessage());
sender.sendMessage(ChatColor.GRAY + "Error building command: " + e.getMessage());
return true;
}
try
{
playerMsg("Sending command as " + p.getName() + ": " + outcommand);
if (server.dispatchCommand(p, outcommand))
playerMsg("Sending command as " + player.getName() + ": " + outcommand);
if (server.dispatchCommand(player, outcommand))
{
playerMsg("Command sent.");
}
@ -56,9 +56,9 @@ public class Command_gcmd extends TFM_Command
playerMsg("Unknown error sending command.");
}
}
catch (Throwable ex)
catch (Throwable e)
{
playerMsg("Error sending command: " + ex.getMessage());
playerMsg("Error sending command: " + e.getMessage());
}
return true;

View File

@ -51,12 +51,12 @@ public class Command_glist extends TFM_Command
try
{
Player p = getPlayer(args[1]);
Player player = getPlayer(args[1]);
username = p.getName();
ip_addresses.add(p.getAddress().getAddress().getHostAddress());
username = player.getName();
ip_addresses.add(player.getAddress().getAddress().getHostAddress());
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]);
@ -75,11 +75,11 @@ public class Command_glist extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
Player p = server.getPlayerExact(username);
if (p != null)
Player player = server.getPlayerExact(username);
if (player != null)
{
TFM_ServerInterface.banUsername(p.getName(), null, null, null);
p.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: http://www.totalfreedom.boards.net");
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
player.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: http://www.totalfreedom.boards.net");
}
else
{

View File

@ -25,14 +25,14 @@ public class Command_gtfo extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
@ -42,25 +42,25 @@ public class Command_gtfo extends TFM_Command
ban_reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
}
TFM_Util.bcastMsg(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
TFM_Util.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
// Undo WorldEdits:
TFM_WorldEditBridge.getInstance().undo(p, 15);
TFM_WorldEditBridge.getInstance().undo(player, 15);
// rollback
TFM_RollbackManager.rollback(p.getName());
TFM_RollbackManager.rollback(player.getName());
// deop
p.setOp(false);
player.setOp(false);
// set gamemode to survival:
p.setGameMode(GameMode.SURVIVAL);
player.setGameMode(GameMode.SURVIVAL);
// clear inventory:
p.getInventory().clear();
player.getInventory().clear();
// strike with lightning effect:
final Location target_pos = p.getLocation();
final Location target_pos = player.getLocation();
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
@ -71,20 +71,20 @@ public class Command_gtfo extends TFM_Command
}
// ban IP address:
String user_ip = p.getAddress().getAddress().getHostAddress();
String user_ip = player.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\.");
if (ip_parts.length == 4)
{
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), user_ip), ChatColor.RED);
TFM_ServerInterface.banIP(user_ip, ban_reason, null, null);
// ban username:
TFM_ServerInterface.banUsername(p.getName(), ban_reason, null, null);
TFM_ServerInterface.banUsername(player.getName(), ban_reason, null, null);
// kick Player:
p.kickPlayer(ChatColor.RED + "GTFO" + (ban_reason != null ? ("\nReason: " + ChatColor.YELLOW + ban_reason) : ""));
player.kickPlayer(ChatColor.RED + "GTFO" + (ban_reason != null ? ("\nReason: " + ChatColor.YELLOW + ban_reason) : ""));
return true;
}

View File

@ -23,11 +23,11 @@ public class Command_halt extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Halting all non-superadmins.", true);
int counter = 0;
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
TFM_PlayerData.getPlayerData(p).setHalted(true);
TFM_PlayerData.getPlayerData(player).setHalted(true);
counter++;
}
}
@ -39,10 +39,10 @@ public class Command_halt extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Unhalting all players.", true);
int counter = 0;
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
if (TFM_PlayerData.getPlayerData(p).isHalted())
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (TFM_PlayerData.getPlayerData(player).isHalted())
{
playerdata.setHalted(false);
counter++;
@ -76,28 +76,28 @@ public class Command_halt extends TFM_Command
return true;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (!playerdata.isHalted())
{
TFM_Util.adminAction(sender.getName(), "Halting " + p.getName(), true);
TFM_Util.adminAction(sender.getName(), "Halting " + player.getName(), true);
playerdata.setHalted(true);
return true;
}
else
{
TFM_Util.adminAction(sender.getName(), "Unhalting " + p.getName(), true);
TFM_Util.adminAction(sender.getName(), "Unhalting " + player.getName(), true);
playerdata.setHalted(false);
return true;
}

View File

@ -51,9 +51,9 @@ public class Command_health extends TFM_Command
}
}.runTask(plugin);
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
}.runTaskAsynchronously(plugin);

View File

@ -33,14 +33,14 @@ public class Command_invis extends TFM_Command
List<String> players = new ArrayList<String>();
int smites = 0;
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (p.hasPotionEffect(PotionEffectType.INVISIBILITY))
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
{
players.add(p.getName());
if (smite && !TFM_SuperadminList.isUserSuperadmin(p))
players.add(player.getName());
if (smite && !TFM_SuperadminList.isUserSuperadmin(player))
{
Command_smite.smite(p);
Command_smite.smite(player);
smites++;
}
}

View File

@ -68,7 +68,7 @@ public class Command_jumppads extends TFM_Command
{
strength = Float.parseFloat(args[1]);
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
playerMsg("Invalid Strength");
return true;

View File

@ -16,11 +16,11 @@ public class Command_kicknoob extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Disconnecting all non-superadmins.", true);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
p.kickPlayer(ChatColor.RED + "Disconnected by admin.");
player.kickPlayer(ChatColor.RED + "Disconnected by admin.");
}
}

View File

@ -34,7 +34,7 @@ public class Command_landmine extends TFM_Command
{
radius = Math.max(2.0, Math.min(6.0, Double.parseDouble(args[0])));
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
}
}

View File

@ -18,18 +18,18 @@ public class Command_lastcmd extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (playerdata != null)
{
@ -38,7 +38,7 @@ public class Command_lastcmd extends TFM_Command
{
last_command = "(none)";
}
playerMsg(p.getName() + " - Last Command: " + last_command, ChatColor.GRAY);
playerMsg(player.getName() + " - Last Command: " + last_command, ChatColor.GRAY);
}
return true;

View File

@ -25,9 +25,9 @@ public class Command_list extends TFM_Command
if (TFM_Util.isFromHostConsole(sender.getName()))
{
List<String> player_names = new ArrayList<String>();
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
player_names.add(p.getName());
player_names.add(player.getName());
}
playerMsg("There are " + player_names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(player_names, ", "), ChatColor.WHITE);
return true;
@ -50,9 +50,9 @@ public class Command_list extends TFM_Command
onlineStats.append(ChatColor.BLUE).append(" players online.");
List<String> player_names = new ArrayList<String>();
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
boolean userSuperadmin = TFM_SuperadminList.isUserSuperadmin(p);
boolean userSuperadmin = TFM_SuperadminList.isUserSuperadmin(player);
if (listFilter == ListFilter.SHOW_ADMINS && !userSuperadmin)
{
@ -63,7 +63,7 @@ public class Command_list extends TFM_Command
if (userSuperadmin)
{
if (TFM_SuperadminList.isSeniorAdmin(p))
if (TFM_SuperadminList.isSeniorAdmin(player))
{
prefix = (ChatColor.LIGHT_PURPLE + "[SrA]");
}
@ -72,25 +72,25 @@ public class Command_list extends TFM_Command
prefix = (ChatColor.GOLD + "[SA]");
}
if (TFM_Util.DEVELOPERS.contains(p.getName()))
if (TFM_Util.DEVELOPERS.contains(player.getName()))
{
prefix = (ChatColor.DARK_PURPLE + "[Dev]");
}
if (p.getName().equals("markbyron"))
if (player.getName().equals("markbyron"))
{
prefix = (ChatColor.BLUE + "[Owner]");
}
}
else
{
if (p.isOp())
if (player.isOp())
{
prefix = (ChatColor.RED + "[OP]");
}
}
player_names.add(prefix + p.getName() + ChatColor.WHITE);
player_names.add(prefix + player.getName() + ChatColor.WHITE);
}
onlineUsers.append("Connected ").append(listFilter == ListFilter.SHOW_ADMINS ? "admins" : "players").append(": ").append(StringUtils.join(player_names, ", "));

View File

@ -23,9 +23,9 @@ public class Command_listsync extends TFM_Command
TotalFreedomMod.loadSuperadminConfig();
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.SUPERADMIN_FILE + " downloaded.", false);
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
try
@ -34,9 +34,9 @@ public class Command_listsync extends TFM_Command
TotalFreedomMod.loadPermbanConfig();
TFM_Util.adminAction(sender.getName(), TotalFreedomMod.PERMBAN_FILE + " downloaded.", false);
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return true;

View File

@ -21,18 +21,18 @@ public class Command_lockup extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Locking up all players", true);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
startLockup(p);
startLockup(player);
}
playerMsg("Locked up all players.");
}
else if (args[0].equalsIgnoreCase("purge"))
{
TFM_Util.adminAction(sender.getName(), "Unlocking all players", true);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
cancelLockup(p);
cancelLockup(player);
}
playerMsg("Unlocked all players.");
@ -46,37 +46,37 @@ public class Command_lockup extends TFM_Command
{
if (args[1].equalsIgnoreCase("on"))
{
final Player p;
final Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
TFM_Util.adminAction(sender.getName(), "Locking up " + p.getName(), true);
startLockup(p);
playerMsg("Locked up " + p.getName() + ".");
TFM_Util.adminAction(sender.getName(), "Locking up " + player.getName(), true);
startLockup(player);
playerMsg("Locked up " + player.getName() + ".");
}
else if (TFM_Util.isStopCommand(args[1]))
{
final Player p;
final Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
TFM_Util.adminAction(sender.getName(), "Unlocking " + p.getName(), true);
cancelLockup(p);
playerMsg("Unlocked " + p.getName() + ".");
TFM_Util.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
cancelLockup(player);
playerMsg("Unlocked " + player.getName() + ".");
}
else
{
@ -101,14 +101,14 @@ public class Command_lockup extends TFM_Command
}
}
private void cancelLockup(final Player p)
private void cancelLockup(final Player player)
{
cancelLockup(TFM_PlayerData.getPlayerData(p));
cancelLockup(TFM_PlayerData.getPlayerData(player));
}
private void startLockup(final Player p)
private void startLockup(final Player player)
{
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
cancelLockup(playerdata);
@ -117,9 +117,9 @@ public class Command_lockup extends TFM_Command
@Override
public void run()
{
if (p.isOnline())
if (player.isOnline())
{
p.openInventory(p.getInventory());
player.openInventory(player.getInventory());
}
else
{

View File

@ -102,9 +102,9 @@ public class Command_logs extends TFM_Command
}.runTask(TotalFreedomMod.plugin);
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
}.runTaskAsynchronously(TotalFreedomMod.plugin);

View File

@ -38,7 +38,7 @@ public class Command_nf extends TFM_Command
{
player = getPlayerByDisplayName(displayName);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
}
if (player == null)
@ -47,7 +47,7 @@ public class Command_nf extends TFM_Command
{
player = getPlayerByDisplayNameAlt(displayName);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
return true;

View File

@ -43,9 +43,9 @@ public class Command_onlinemode extends TFM_Command
if (online_mode)
{
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
p.kickPlayer("Server is activating \"online-mode=true\". Please reconnect.");
player.kickPlayer("Server is activating \"online-mode=true\". Please reconnect.");
}
}
@ -53,9 +53,9 @@ public class Command_onlinemode extends TFM_Command
server.reload();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}

View File

@ -26,21 +26,21 @@ public class Command_op extends TFM_Command
return true;
}
OfflinePlayer p = null;
OfflinePlayer player = null;
for (Player onlinePlayer : server.getOnlinePlayers())
{
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
{
p = onlinePlayer;
player = onlinePlayer;
}
}
// if the player is not online
if (p == null)
if (player == null)
{
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
{
p = server.getOfflinePlayer(args[0]);
player = server.getOfflinePlayer(args[0]);
}
else
{
@ -50,8 +50,8 @@ public class Command_op extends TFM_Command
}
}
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
p.setOp(true);
TFM_Util.adminAction(sender.getName(), "Opping " + player.getName(), false);
player.setOp(true);
return true;
}

View File

@ -32,14 +32,14 @@ public class Command_opall extends TFM_Command
}
}
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
p.setOp(true);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
player.setOp(true);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
if (doSetGamemode)
{
p.setGameMode(targetGamemode);
player.setGameMode(targetGamemode);
}
}

View File

@ -31,9 +31,9 @@ public class Command_ops extends TFM_Command
int offlineOPs = 0;
int totalOPs = 0;
for (OfflinePlayer p : server.getOperators())
for (OfflinePlayer player: server.getOperators())
{
if (p.isOnline())
if (player.isOnline())
{
onlineOPs++;
}
@ -61,13 +61,13 @@ public class Command_ops extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Removing all operators", true);
for (OfflinePlayer p : server.getOperators())
for (OfflinePlayer player: server.getOperators())
{
p.setOp(false);
player.setOp(false);
if (p.isOnline())
if (player.isOnline())
{
p.getPlayer().sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
player.getPlayer().sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
}

View File

@ -21,18 +21,18 @@ public class Command_orbit extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
double strength = 10.0;
@ -40,7 +40,7 @@ public class Command_orbit extends TFM_Command
{
if (TFM_Util.isStopCommand(args[1]))
{
playerMsg("Stopped orbiting " + p.getName());
playerMsg("Stopped orbiting " + player.getName());
playerdata.stopOrbiting();
return true;
}
@ -49,18 +49,18 @@ public class Command_orbit extends TFM_Command
{
strength = Math.max(1.0, Math.min(150.0, Double.parseDouble(args[1])));
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
}
p.setGameMode(GameMode.SURVIVAL);
player.setGameMode(GameMode.SURVIVAL);
playerdata.startOrbiting(strength);
p.setVelocity(new Vector(0, strength, 0));
TFM_Util.adminAction(sender.getName(), "Orbiting " + p.getName() + ".", false);
player.setVelocity(new Vector(0, strength, 0));
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName() + ".", false);
return true;
}

View File

@ -58,20 +58,20 @@ public class Command_plugincontrol extends TFM_Command
else if (commandMode == CommandMode.RELOAD)
{
playerMsg("Disabling all plugins.");
for (Plugin p : pluginManager.getPlugins())
for (Plugin target_plugin : pluginManager.getPlugins())
{
if (!p.getName().toLowerCase().startsWith("totalfreedommod"))
if (!target_plugin.getName().toLowerCase().startsWith("totalfreedommod"))
{
pluginManager.disablePlugin(p);
pluginManager.disablePlugin(target_plugin);
}
}
playerMsg("Enabling all plugins.");
for (Plugin p : pluginManager.getPlugins())
for (Plugin target_plugin : pluginManager.getPlugins())
{
if (!p.getName().toLowerCase().startsWith("totalfreedommod"))
if (!target_plugin.getName().toLowerCase().startsWith("totalfreedommod"))
{
pluginManager.enablePlugin(p);
pluginManager.enablePlugin(target_plugin);
}
}
}
@ -81,11 +81,11 @@ public class Command_plugincontrol extends TFM_Command
Plugin targetPlugin = null;
for (Plugin p : pluginManager.getPlugins())
for (Plugin target_plugin : pluginManager.getPlugins())
{
if (searchPluginName.equalsIgnoreCase(p.getName().toLowerCase().trim()))
if (searchPluginName.equalsIgnoreCase(target_plugin.getName().toLowerCase().trim()))
{
targetPlugin = p;
targetPlugin = plugin;
break;
}
}

View File

@ -62,9 +62,9 @@ public class Command_potion extends TFM_Command
{
target = getPlayer(args[1]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
}
@ -107,9 +107,9 @@ public class Command_potion extends TFM_Command
{
target = getPlayer(args[4]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
}
@ -140,7 +140,7 @@ public class Command_potion extends TFM_Command
{
duration = Integer.parseInt(args[2]);
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
playerMsg("Invalid potion duration.", ChatColor.RED);
return true;
@ -151,7 +151,7 @@ public class Command_potion extends TFM_Command
{
amplifier = Integer.parseInt(args[3]);
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
playerMsg("Invalid potion amplifier.", ChatColor.RED);
return true;

View File

@ -0,0 +1,72 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import org.apache.commons.lang.exception.ExceptionUtils;
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 = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Validates if a given account is premium.", usage = "/<command> <player>", aliases = "prem")
public class Command_premium 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;
}
String name;
try
{
name = getPlayer(args[0]).getName();
}
catch (PlayerNotFoundException e)
{
name = args[0];
}
final String playername = name;
new BukkitRunnable()
{
@Override
public void run()
{
try
{
final URL getUrl = new URL("https://minecraft.net/haspaid.jsp?user=" + playername);
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();
new BukkitRunnable()
{
@Override
public void run()
{
playerMsg("Player " + playername + " is premium: " + message);
}
}.runTask(plugin);
}
catch (Exception e)
{
TFM_Log.severe(ExceptionUtils.getStackTrace(e));
playerMsg("There was an error querying the mojang server.", ChatColor.RED);
}
}
}.runTaskAsynchronously(plugin);
return true;
}
}

View File

@ -24,9 +24,9 @@ public class Command_purgeall extends TFM_Command
// Undisguise all players
TFM_DisguiseCraftBridge.undisguiseAllPlayers();
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
// Unmute all players
if (playerdata.isMuted())
@ -59,9 +59,9 @@ public class Command_purgeall extends TFM_Command
}
// Purge potion effects
for (PotionEffect potion_effect : p.getActivePotionEffects())
for (PotionEffect potion_effect : player.getActivePotionEffects())
{
p.removePotionEffect(potion_effect.getType());
player.removePotionEffect(potion_effect.getType());
}
// Uncage

View File

@ -28,18 +28,18 @@ public class Command_qdeop extends TFM_Command
String target_name = args[0].toLowerCase();
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (p.getName().toLowerCase().indexOf(target_name) != -1 || p.getDisplayName().toLowerCase().indexOf(target_name) != -1)
if (player.getName().toLowerCase().indexOf(target_name) != -1 || player.getDisplayName().toLowerCase().indexOf(target_name) != -1)
{
matched_player = true;
if (!silent)
{
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false);
}
p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
player.setOp(false);
player.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
}

View File

@ -28,18 +28,18 @@ public class Command_qop extends TFM_Command
String target_name = args[0].toLowerCase();
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (p.getName().toLowerCase().indexOf(target_name) != -1 || p.getDisplayName().toLowerCase().indexOf(target_name) != -1)
if (player.getName().toLowerCase().indexOf(target_name) != -1 || player.getDisplayName().toLowerCase().indexOf(target_name) != -1)
{
matched_player = true;
if (!silent)
{
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
TFM_Util.adminAction(sender.getName(), "Opping " + player.getName(), false);
}
p.setOp(true);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
player.setOp(true);
player.sendMessage(TotalFreedomMod.YOU_ARE_OP);
}
}

View File

@ -21,15 +21,15 @@ public class Command_radar extends TFM_Command
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
for (Player p : sender_pos.getWorld().getPlayers())
for (Player player : sender_pos.getWorld().getPlayers())
{
if (!p.equals(sender_p))
if (!player.equals(sender_p))
{
try
{
radar_data.add(new TFM_RadarData(p, sender_pos.distance(p.getLocation()), p.getLocation()));
radar_data.add(new TFM_RadarData(player, sender_pos.distance(player.getLocation()), player.getLocation()));
}
catch (IllegalArgumentException ex)
catch (IllegalArgumentException e)
{
}
}

View File

@ -15,9 +15,9 @@ public class Command_rank extends TFM_Command
{
if (senderIsConsole && args.length < 1)
{
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
playerMsg(p.getName() + " is " + TFM_Util.getRank(p));
playerMsg(player.getName() + " is " + TFM_Util.getRank(player));
}
return true;
}
@ -33,18 +33,18 @@ public class Command_rank extends TFM_Command
return true;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
playerMsg(p.getName() + " is " + TFM_Util.getRank(p), ChatColor.AQUA);
playerMsg(player.getName() + " is " + TFM_Util.getRank(player), ChatColor.AQUA);
return true;
}

View File

@ -26,7 +26,7 @@ public class Command_ro extends TFM_Command
{
from_material = Material.getMaterial(Integer.parseInt(args[0]));
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
}
@ -44,7 +44,7 @@ public class Command_ro extends TFM_Command
{
radius = Math.max(1, Math.min(50, Integer.parseInt(args[1])));
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
playerMsg("Invalid radius: " + args[1], ChatColor.RED);
return true;
@ -58,9 +58,9 @@ public class Command_ro extends TFM_Command
{
target_player = getPlayer(args[2]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
}
@ -70,9 +70,9 @@ public class Command_ro extends TFM_Command
if (target_player == null)
{
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of all players. Brace for lag...", senderIsConsole);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
affected += TFM_Util.replaceBlocks(p.getLocation(), from_material, Material.AIR, radius);
affected += TFM_Util.replaceBlocks(player.getLocation(), from_material, Material.AIR, radius);
}
}
else

View File

@ -60,7 +60,7 @@ public class Command_rollback extends TFM_Command
playerName = player.getName();
}
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
}

View File

@ -66,7 +66,7 @@ public class Command_saconfig extends TFM_Command
{
superadmin = TFM_SuperadminList.getAdminEntry(getPlayer(args[1]).getName().toLowerCase());
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
}
}
@ -91,14 +91,14 @@ public class Command_saconfig extends TFM_Command
if (args[0].equalsIgnoreCase("add"))
{
Player p = null;
Player player = null;
String admin_name = null;
try
{
p = getPlayer(args[1]);
player = getPlayer(args[1]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
TFM_Superadmin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase());
if (superadmin != null)
@ -107,15 +107,15 @@ public class Command_saconfig extends TFM_Command
}
else
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
}
if (p != null)
if (player != null)
{
TFM_Util.adminAction(sender.getName(), "Adding " + p.getName() + " to the superadmin list.", true);
TFM_SuperadminList.addSuperadmin(p);
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
TFM_SuperadminList.addSuperadmin(player);
}
else if (admin_name != null)
{
@ -137,7 +137,7 @@ public class Command_saconfig extends TFM_Command
{
target_name = getPlayer(target_name).getName();
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
}

View File

@ -27,9 +27,9 @@ public class Command_say extends TFM_Command
{
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
p.kickPlayer("Server is going offline, come back in a few minutes.");
player.kickPlayer("Server is going offline, come back in a few minutes.");
}
server.shutdown();

View File

@ -15,9 +15,9 @@ public class Command_setl extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 500.", true);
TFM_WorldEditBridge web = TFM_WorldEditBridge.getInstance();
for (final Player p : server.getOnlinePlayers())
for (final Player player: server.getOnlinePlayers())
{
web.setLimit(p, 500);
web.setLimit(player, 500);
}
return true;
}

View File

@ -32,7 +32,7 @@ public class Command_setlevel extends TFM_Command
new_level = 50;
}
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
playerMsg("Invalid level.", ChatColor.RED);
return true;

View File

@ -21,38 +21,38 @@ public class Command_smite extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
smite(p);
smite(player);
return true;
}
public static void smite(final Player p)
public static void smite(final Player player)
{
TFM_Util.bcastMsg(p.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
TFM_Util.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
//Deop
p.setOp(false);
player.setOp(false);
//Set gamemode to survival:
p.setGameMode(GameMode.SURVIVAL);
player.setGameMode(GameMode.SURVIVAL);
//Clear inventory:
p.getInventory().clear();
player.getInventory().clear();
//Strike with lightning effect:
final Location target_pos = p.getLocation();
final World world = p.getWorld();
final Location target_pos = player.getLocation();
final World world = player.getWorld();
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
@ -63,6 +63,6 @@ public class Command_smite extends TFM_Command
}
//Kill:
p.setHealth(0.0);
player.setHealth(0.0);
}
}

View File

@ -66,11 +66,11 @@ public class Command_stfu extends TFM_Command
TFM_PlayerData playerdata;
int counter = 0;
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
playerdata = TFM_PlayerData.getPlayerData(p);
playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setMuted(true);
counter++;
}
@ -87,9 +87,9 @@ public class Command_stfu extends TFM_Command
public void run()
{
TFM_Util.adminAction("MuteTimer", "Unmuting all players", false);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
TFM_PlayerData.getPlayerData(p).setMuted(false);
TFM_PlayerData.getPlayerData(player).setMuted(false);
}
}
}.runTaskLater(plugin, 20L * 60L * 5L);
@ -98,35 +98,35 @@ public class Command_stfu extends TFM_Command
}
else
{
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
sender.sendMessage(ex.getMessage());
sender.sendMessage(e.getMessage());
return true;
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (playerdata.isMuted())
{
TFM_Util.adminAction(sender.getName(), "Unmuting " + p.getName(), true);
TFM_Util.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
playerdata.setMuted(false);
playerMsg("Unmuted " + p.getName());
playerMsg("Unmuted " + player.getName());
}
else
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
TFM_Util.adminAction(sender.getName(), "Muting " + p.getName(), true);
TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true);
playerdata.setMuted(true);
playerMsg("Muted " + p.getName());
playerMsg("Muted " + player.getName());
}
else
{
playerMsg(p.getName() + " is a superadmin, and can't be muted.");
playerMsg(player.getName() + " is a superadmin, and can't be muted.");
}
}
}

View File

@ -15,9 +15,9 @@ public class Command_stop extends TFM_Command
{
TFM_Util.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
p.kickPlayer("Server is going offline, come back in about 20 seconds.");
player.kickPlayer("Server is going offline, come back in about 20 seconds.");
}
server.shutdown();

View File

@ -26,11 +26,11 @@ public class Command_survival extends TFM_Command
}
}
Player p;
Player player;
if (args.length == 0)
{
p = sender_p;
player = sender_p;
}
else
{
@ -42,9 +42,9 @@ public class Command_survival extends TFM_Command
return true;
}
for (Player player : server.getOnlinePlayers())
for (Player target : server.getOnlinePlayers())
{
player.setGameMode(GameMode.SURVIVAL);
target.setGameMode(GameMode.SURVIVAL);
}
TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to survival", false);
@ -55,11 +55,11 @@ public class Command_survival extends TFM_Command
{
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
}
@ -70,9 +70,9 @@ public class Command_survival extends TFM_Command
}
}
playerMsg("Setting " + p.getName() + " to game mode 'Survival'.");
p.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
p.setGameMode(GameMode.SURVIVAL);
playerMsg("Setting " + player.getName() + " to game mode 'Survival'.");
player.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
player.setGameMode(GameMode.SURVIVAL);
return true;
}

View File

@ -35,14 +35,14 @@ public class Command_tag extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Removing all tags", false);
int count = 0;
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
if (playerdata.getTag() != null)
{
count++;
TFM_PlayerData.getPlayerData(p).setTag(null);
TFM_PlayerData.getPlayerData(player).setTag(null);
}
}
@ -104,19 +104,19 @@ public class Command_tag extends TFM_Command
return true;
}
final Player p;
final Player player;
try
{
p = getPlayer(args[1]);
player = getPlayer(args[1]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage());
playerMsg(e.getMessage());
return true;
}
TFM_PlayerData.getPlayerData(p).setTag(null);
playerMsg("Removed " + p.getName() + "'s tag.");
TFM_PlayerData.getPlayerData(player).setTag(null);
playerMsg("Removed " + player.getName() + "'s tag.");
return true;
}

View File

@ -19,21 +19,21 @@ public class Command_tban extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
TFM_Util.adminAction(sender.getName(), "NOPE: " + p.getName(), true);
TFM_ServerInterface.banUsername(p.getName(), ChatColor.RED + "You have been temporarily banned for 5 minutes",
TFM_Util.adminAction(sender.getName(), "NOPE: " + player.getName(), true);
TFM_ServerInterface.banUsername(player.getName(), ChatColor.RED + "You have been temporarily banned for 5 minutes",
sender.getName(), TFM_Util.parseDateOffset("5m"));
p.kickPlayer(ChatColor.RED + "NOPE!\nYou have been temporarily banned for five minutes.");
player.kickPlayer(ChatColor.RED + "NOPE!\nYou have been temporarily banned for five minutes.");
return true;
}

View File

@ -25,18 +25,18 @@ public class Command_tempban extends TFM_Command
return false;
}
Player p;
Player player;
try
{
p = getPlayer(args[0]);
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
playerMsg(ex.getMessage(), ChatColor.RED);
playerMsg(e.getMessage(), ChatColor.RED);
return true;
}
StringBuilder bcast_msg = new StringBuilder("Temporarily banned " + p.getName());
StringBuilder bcast_msg = new StringBuilder("Temporarily banned " + player.getName());
Date ban_duration = TFM_Util.parseDateOffset("30m");
if (args.length >= 2)
@ -57,9 +57,9 @@ public class Command_tempban extends TFM_Command
}
TFM_Util.adminAction(sender.getName(), bcast_msg.toString(), true);
TFM_ServerInterface.banUsername(p.getName(), ban_reason, sender.getName(), ban_duration);
TFM_ServerInterface.banIP(p.getAddress().getAddress().getHostAddress().trim(), ban_reason, sender.getName(), ban_duration);
p.kickPlayer(sender.getName() + " - " + bcast_msg.toString());
TFM_ServerInterface.banUsername(player.getName(), ban_reason, sender.getName(), ban_duration);
TFM_ServerInterface.banIP(player.getAddress().getAddress().getHostAddress().trim(), ban_reason, sender.getName(), ban_duration);
player.kickPlayer(sender.getName() + " - " + bcast_msg.toString());
return true;
}

View File

@ -29,9 +29,9 @@ public class Command_tfbanlist extends TFM_Command
TFM_ServerInterface.wipeNameBans();
sender.sendMessage(ChatColor.GRAY + "Ban list has been purged.");
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return true;
@ -46,14 +46,14 @@ public class Command_tfbanlist extends TFM_Command
StringBuilder banned_players = new StringBuilder();
banned_players.append("Banned Players: ");
boolean first = true;
for (OfflinePlayer p : server.getBannedPlayers())
for (OfflinePlayer player: server.getBannedPlayers())
{
if (!first)
{
banned_players.append(", ");
}
first = false;
banned_players.append(p.getName().trim());
banned_players.append(player.getName().trim());
}
playerMsg(banned_players.toString());

View File

@ -29,9 +29,9 @@ public class Command_tfipbanlist extends TFM_Command
TFM_ServerInterface.wipeIpBans();
sender.sendMessage(ChatColor.GRAY + "IP ban list has been purged.");
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return true;

View File

@ -57,9 +57,9 @@ public class Command_tfupdate extends TFM_Command
TFM_Util.downloadFile(url, file, true);
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
}.runTaskAsynchronously(plugin);

View File

@ -47,7 +47,7 @@ public class Command_tossmob extends TFM_Command
{
creature = TFM_Util.getEntityType(args[0]);
}
catch (Exception ex)
catch (Exception e)
{
playerMsg(args[0] + " is not a supported mob type. Using a pig instead.", ChatColor.RED);
playerMsg("By the way, you can type /tossmob list to see all possible mobs.", ChatColor.RED);

View File

@ -35,9 +35,9 @@ public class Command_whitelist extends TFM_Command
int offlineWPs = 0;
int totalWPs = 0;
for (OfflinePlayer p : server.getWhitelistedPlayers())
for (OfflinePlayer player: server.getWhitelistedPlayers())
{
if (p.isOnline())
if (player.isOnline())
{
onlineWPs++;
}
@ -88,18 +88,18 @@ public class Command_whitelist extends TFM_Command
String search_name = args[1].trim().toLowerCase();
OfflinePlayer p;
OfflinePlayer player;
try
{
p = getPlayer(search_name);
player = getPlayer(search_name);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
p = server.getOfflinePlayer(search_name);
player = server.getOfflinePlayer(search_name);
}
TFM_Util.adminAction(sender.getName(), "Adding " + p.getName() + " to the whitelist.", false);
p.setWhitelisted(true);
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the whitelist.", false);
player.setWhitelisted(true);
return true;
}
@ -113,20 +113,20 @@ public class Command_whitelist extends TFM_Command
String search_name = args[1].trim().toLowerCase();
OfflinePlayer p;
OfflinePlayer player;
try
{
p = getPlayer(search_name);
player = getPlayer(search_name);
}
catch (PlayerNotFoundException ex)
catch (PlayerNotFoundException e)
{
p = server.getOfflinePlayer(search_name);
player = server.getOfflinePlayer(search_name);
}
if (p.isWhitelisted())
if (player.isWhitelisted())
{
TFM_Util.adminAction(sender.getName(), "Removing " + p.getName() + " from the whitelist.", false);
p.setWhitelisted(false);
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the whitelist.", false);
player.setWhitelisted(false);
return true;
}
else
@ -142,11 +142,11 @@ public class Command_whitelist extends TFM_Command
{
TFM_Util.adminAction(sender.getName(), "Adding all online players to the whitelist.", false);
int counter = 0;
for (Player p : server.getOnlinePlayers())
for (Player player : server.getOnlinePlayers())
{
if (!p.isWhitelisted())
if (!player.isWhitelisted())
{
p.setWhitelisted(true);
player.setWhitelisted(true);
counter++;
}
}

View File

@ -39,7 +39,7 @@ public class Command_whohas extends TFM_Command
{
material = Material.getMaterial(Integer.parseInt(args[0]));
}
catch (NumberFormatException ex)
catch (NumberFormatException e)
{
}
@ -52,14 +52,14 @@ public class Command_whohas extends TFM_Command
List<String> players = new ArrayList<String>();
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (p.getInventory().contains(material))
if (player.getInventory().contains(material))
{
players.add(p.getName());
if (smite & !TFM_SuperadminList.isUserSuperadmin(p))
players.add(player.getName());
if (smite & !TFM_SuperadminList.isUserSuperadmin(player))
{
Command_smite.smite(p);
Command_smite.smite(player);
}
}
}

View File

@ -36,9 +36,9 @@ public class Command_wildcard extends TFM_Command
String base_command = StringUtils.join(args, " ");
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
String out_command = base_command.replaceAll("\\x3f", p.getName());
String out_command = base_command.replaceAll("\\x3f", player.getName());
playerMsg("Running Command: " + out_command);
server.dispatchCommand(sender, out_command);
}

View File

@ -17,9 +17,9 @@ public class Command_wipeflatlands extends TFM_Command
TFM_Util.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
p.kickPlayer("Server is going offline for flatlands wipe, come back in a few minutes.");
player.kickPlayer("Server is going offline for flatlands wipe, come back in a few minutes.");
}
server.shutdown();

View File

@ -143,11 +143,11 @@ public abstract class TFM_Command
List<Player> matches = server.matchPlayer(partialname);
if (matches.isEmpty())
{
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
if (p.getDisplayName().toLowerCase().contains(partialname.toLowerCase()))
if (player.getDisplayName().toLowerCase().contains(partialname.toLowerCase()))
{
return p;
return player;
}
}
throw new PlayerNotFoundException(partialname);

View File

@ -103,9 +103,9 @@ public class TFM_CommandLoader
}
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -176,17 +176,17 @@ public class TFM_CommandLoader
commandList.add(commandInfo);
}
}
catch (ClassNotFoundException ex)
catch (ClassNotFoundException e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
}
}
}
catch (IOException ex)
catch (IOException e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return commandList;
@ -292,9 +292,9 @@ public class TFM_CommandLoader
{
success = getPlugin().onCommand(sender, this, commandLabel, args);
}
catch (Throwable ex)
catch (Throwable e)
{
throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + getPlugin().getDescription().getFullName(), ex);
throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + getPlugin().getDescription().getFullName(), e);
}
if (!success && getUsage().length() > 0)

View File

@ -41,14 +41,14 @@ public class TFM_BlockListener implements Listener
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockBreak(BlockBreakEvent event)
{
Player p = event.getPlayer();
Player player = event.getPlayer();
Location block_pos = event.getBlock().getLocation();
if (TotalFreedomMod.nukeMonitor)
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
Location player_pos = p.getLocation();
Location player_pos = player.getLocation();
boolean out_of_range = false;
if (!player_pos.getWorld().equals(block_pos.getWorld()))
@ -64,8 +64,8 @@ public class TFM_BlockListener implements Listener
{
if (playerdata.incrementAndGetFreecamDestroyCount() > TotalFreedomMod.freecamTriggerCount)
{
TFM_Util.bcastMsg(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
TFM_Util.autoEject(p, "Freecam (extended range) block breaking is not permitted on this server.");
TFM_Util.bcastMsg(player.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
TFM_Util.autoEject(player, "Freecam (extended range) block breaking is not permitted on this server.");
playerdata.resetFreecamDestroyCount();
@ -83,8 +83,8 @@ public class TFM_BlockListener implements Listener
{
if (playerdata.incrementAndGetBlockDestroyCount() > TotalFreedomMod.nukeMonitorCountBreak)
{
TFM_Util.bcastMsg(p.getName() + " is breaking blocks too fast!", ChatColor.RED);
TFM_Util.autoEject(p, "You are breaking blocks too fast. Nukers are not permitted on this server.");
TFM_Util.bcastMsg(player.getName() + " is breaking blocks too fast!", ChatColor.RED);
TFM_Util.autoEject(player, "You are breaking blocks too fast. Nukers are not permitted on this server.");
playerdata.resetBlockDestroyCount();
@ -96,7 +96,7 @@ public class TFM_BlockListener implements Listener
if (TotalFreedomMod.protectedAreasEnabled)
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
if (TFM_ProtectedArea.isInProtectedArea(block_pos))
{
@ -115,14 +115,14 @@ public class TFM_BlockListener implements Listener
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event)
{
Player p = event.getPlayer();
Player player = event.getPlayer();
Location block_pos = event.getBlock().getLocation();
if (TotalFreedomMod.nukeMonitor)
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
Location player_pos = p.getLocation();
Location player_pos = player.getLocation();
boolean out_of_range = false;
if (!player_pos.getWorld().equals(block_pos.getWorld()))
@ -138,8 +138,8 @@ public class TFM_BlockListener implements Listener
{
if (playerdata.incrementAndGetFreecamPlaceCount() > TotalFreedomMod.freecamTriggerCount)
{
TFM_Util.bcastMsg(p.getName() + " has been flagged for possible freecam building.", ChatColor.RED);
TFM_Util.autoEject(p, "Freecam (extended range) block building is not permitted on this server.");
TFM_Util.bcastMsg(player.getName() + " has been flagged for possible freecam building.", ChatColor.RED);
TFM_Util.autoEject(player, "Freecam (extended range) block building is not permitted on this server.");
playerdata.resetFreecamPlaceCount();
@ -157,8 +157,8 @@ public class TFM_BlockListener implements Listener
{
if (playerdata.incrementAndGetBlockPlaceCount() > TotalFreedomMod.nukeMonitorCountPlace)
{
TFM_Util.bcastMsg(p.getName() + " is placing blocks too fast!", ChatColor.RED);
TFM_Util.autoEject(p, "You are placing blocks too fast.");
TFM_Util.bcastMsg(player.getName() + " is placing blocks too fast!", ChatColor.RED);
TFM_Util.autoEject(player, "You are placing blocks too fast.");
playerdata.resetBlockPlaceCount();
@ -170,7 +170,7 @@ public class TFM_BlockListener implements Listener
if (TotalFreedomMod.protectedAreasEnabled)
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
if (TFM_ProtectedArea.isInProtectedArea(block_pos))
{
@ -187,14 +187,14 @@ public class TFM_BlockListener implements Listener
{
if (TotalFreedomMod.allowLavaPlace)
{
TFM_Log.info(String.format("%s placed lava @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
TFM_Log.info(String.format("%s placed lava @ %s", player.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot());
player.getInventory().clear(player.getInventory().getHeldItemSlot());
}
else
{
p.getInventory().setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
p.sendMessage(ChatColor.GRAY + "Lava placement is currently disabled.");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Lava placement is currently disabled.");
event.setCancelled(true);
}
@ -205,14 +205,14 @@ public class TFM_BlockListener implements Listener
{
if (TotalFreedomMod.allowWaterPlace)
{
TFM_Log.info(String.format("%s placed water @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
TFM_Log.info(String.format("%s placed water @ %s", player.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot());
player.getInventory().clear(player.getInventory().getHeldItemSlot());
}
else
{
p.getInventory().setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
p.sendMessage(ChatColor.GRAY + "Water placement is currently disabled.");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Water placement is currently disabled.");
event.setCancelled(true);
}
@ -222,14 +222,14 @@ public class TFM_BlockListener implements Listener
{
if (TotalFreedomMod.allowFirePlace)
{
TFM_Log.info(String.format("%s placed fire @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
TFM_Log.info(String.format("%s placed fire @ %s", player.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot());
player.getInventory().clear(player.getInventory().getHeldItemSlot());
}
else
{
p.getInventory().setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
p.sendMessage(ChatColor.GRAY + "Fire placement is currently disabled.");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.sendMessage(ChatColor.GRAY + "Fire placement is currently disabled.");
event.setCancelled(true);
}
@ -239,15 +239,15 @@ public class TFM_BlockListener implements Listener
{
if (TotalFreedomMod.allowExplosions)
{
TFM_Log.info(String.format("%s placed TNT @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
TFM_Log.info(String.format("%s placed TNT @ %s", player.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot());
player.getInventory().clear(player.getInventory().getHeldItemSlot());
}
else
{
p.getInventory().setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
player.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
event.setCancelled(true);
}
break;

View File

@ -233,7 +233,7 @@ public class TFM_PlayerListener implements Listener
return;
}
}
catch (IllegalArgumentException ex)
catch (IllegalArgumentException e)
{
}
@ -242,21 +242,21 @@ public class TFM_PlayerListener implements Listener
return;
}
Player p = event.getPlayer();
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
Player player = event.getPlayer();
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
for (Entry<Player, Double> fuckoff : TotalFreedomMod.fuckoffEnabledFor.entrySet())
{
Player fuckoff_player = fuckoff.getKey();
if (fuckoff_player.equals(p) || !fuckoff_player.isOnline())
if (fuckoff_player.equals(player) || !fuckoff_player.isOnline())
{
continue;
}
double fuckoff_range = fuckoff.getValue().doubleValue();
Location mover_pos = p.getLocation();
Location mover_pos = player.getLocation();
Location fuckoff_pos = fuckoff_player.getLocation();
double distanceSquared;
@ -264,7 +264,7 @@ public class TFM_PlayerListener implements Listener
{
distanceSquared = mover_pos.distanceSquared(fuckoff_pos);
}
catch (IllegalArgumentException ex)
catch (IllegalArgumentException e)
{
continue;
}
@ -279,7 +279,7 @@ public class TFM_PlayerListener implements Listener
boolean do_freeze = false;
if (TotalFreedomMod.allPlayersFrozen)
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
do_freeze = true;
}
@ -305,7 +305,7 @@ public class TFM_PlayerListener implements Listener
if (playerdata.isCaged())
{
Location target_pos = p.getLocation().add(0, 1, 0);
Location target_pos = player.getLocation().add(0, 1, 0);
boolean out_of_cage;
if (!target_pos.getWorld().equals(playerdata.getCagePos().getWorld()))
@ -330,9 +330,9 @@ public class TFM_PlayerListener implements Listener
if (playerdata.isOrbiting())
{
if (p.getVelocity().length() < playerdata.orbitStrength() * (2.0 / 3.0))
if (player.getVelocity().length() < playerdata.orbitStrength() * (2.0 / 3.0))
{
p.setVelocity(new Vector(0, playerdata.orbitStrength(), 0));
player.setVelocity(new Vector(0, playerdata.orbitStrength(), 0));
}
}
@ -355,23 +355,23 @@ public class TFM_PlayerListener implements Listener
continue;
}
if (!landmine.player.equals(p))
if (!landmine.player.equals(player))
{
if (p.getWorld().equals(landmine_pos.getWorld()))
if (player.getWorld().equals(landmine_pos.getWorld()))
{
if (p.getLocation().distanceSquared(landmine_pos) <= (landmine.radius * landmine.radius))
if (player.getLocation().distanceSquared(landmine_pos) <= (landmine.radius * landmine.radius))
{
landmine.landmine_pos.getBlock().setType(Material.AIR);
TNTPrimed tnt1 = landmine_pos.getWorld().spawn(landmine_pos, TNTPrimed.class);
tnt1.setFuseTicks(40);
tnt1.setPassenger(p);
tnt1.setPassenger(player);
tnt1.setVelocity(new Vector(0.0, 2.0, 0.0));
TNTPrimed tnt2 = landmine_pos.getWorld().spawn(p.getLocation(), TNTPrimed.class);
TNTPrimed tnt2 = landmine_pos.getWorld().spawn(player.getLocation(), TNTPrimed.class);
tnt2.setFuseTicks(1);
p.setGameMode(GameMode.SURVIVAL);
player.setGameMode(GameMode.SURVIVAL);
landmines.remove();
}
}
@ -392,10 +392,10 @@ public class TFM_PlayerListener implements Listener
{
try
{
final Player p = event.getPlayer();
final Player player = event.getPlayer();
String message = event.getMessage().trim();
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
// Check for spam
Long lastRan = TFM_Heartbeat.getLastRan();
@ -407,8 +407,8 @@ public class TFM_PlayerListener implements Listener
{
if (playerdata.incrementAndGetMsgCount() > MSG_PER_HEARTBEAT)
{
TFM_Util.bcastMsg(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
TFM_Util.autoEject(p, "Kicked for spamming chat.");
TFM_Util.bcastMsg(player.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
TFM_Util.autoEject(player, "Kicked for spamming chat.");
playerdata.resetMsgCount();
@ -420,7 +420,7 @@ public class TFM_PlayerListener implements Listener
// Check for message repeat
if (playerdata.getLastMessage().equalsIgnoreCase(message))
{
TFM_Util.playerMsg(p, "Please do not repeat messages.");
TFM_Util.playerMsg(player, "Please do not repeat messages.");
event.setCancelled(true);
return;
}
@ -429,9 +429,9 @@ public class TFM_PlayerListener implements Listener
// Check for muted
if (playerdata.isMuted())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
p.sendMessage(ChatColor.RED + "You are muted, STFU!");
player.sendMessage(ChatColor.RED + "You are muted, STFU!");
event.setCancelled(true);
return;
}
@ -448,7 +448,7 @@ public class TFM_PlayerListener implements Listener
if (message.length() > 100)
{
message = message.substring(0, 100);
TFM_Util.playerMsg(p, "Message was shortened because it was too long to send.");
TFM_Util.playerMsg(player, "Message was shortened because it was too long to send.");
}
// Check for caps
@ -471,7 +471,7 @@ public class TFM_PlayerListener implements Listener
// Check for adminchat
if (playerdata.inAdminChat())
{
TFM_Util.adminChatMessage(p, message, false);
TFM_Util.adminChatMessage(player, message, false);
event.setCancelled(true);
return;
}
@ -482,13 +482,13 @@ public class TFM_PlayerListener implements Listener
// Set the tag
if (playerdata.getTag() != null)
{
p.setDisplayName((playerdata.getTag() + " " + p.getDisplayName().replaceAll(" ", "")));
player.setDisplayName((playerdata.getTag() + " " + player.getDisplayName().replaceAll(" ", "")));
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -496,15 +496,15 @@ public class TFM_PlayerListener implements Listener
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
{
String command = event.getMessage();
Player p = event.getPlayer();
Player player = event.getPlayer();
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setLastCommand(command);
if (playerdata.incrementAndGetMsgCount() > MSG_PER_HEARTBEAT)
{
TFM_Util.bcastMsg(p.getName() + " was automatically kicked for spamming commands.", ChatColor.RED);
TFM_Util.autoEject(p, "Kicked for spamming commands.");
TFM_Util.bcastMsg(player.getName() + " was automatically kicked for spamming commands.", ChatColor.RED);
TFM_Util.autoEject(player, "Kicked for spamming commands.");
playerdata.resetMsgCount();
@ -516,7 +516,7 @@ public class TFM_PlayerListener implements Listener
if (playerdata.allCommandsBlocked())
{
TFM_Util.playerMsg(p, "Your commands have been blocked by an admin.", ChatColor.RED);
TFM_Util.playerMsg(player, "Your commands have been blocked by an admin.", ChatColor.RED);
event.setCancelled(true);
return;
}
@ -524,13 +524,13 @@ public class TFM_PlayerListener implements Listener
// Block commands if player is muted
if (playerdata.isMuted())
{
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
for (String test_command : BLOCKED_MUTED_CMDS)
{
if (Pattern.compile("^/" + test_command.toLowerCase() + " ").matcher(command).find())
{
p.sendMessage(ChatColor.RED + "That command is blocked while you are muted.");
player.sendMessage(ChatColor.RED + "That command is blocked while you are muted.");
event.setCancelled(true);
return;
}
@ -544,7 +544,7 @@ public class TFM_PlayerListener implements Listener
if (TotalFreedomMod.preprocessLogEnabled)
{
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), command), true);
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true);
}
command = command.toLowerCase().trim();
@ -556,13 +556,13 @@ public class TFM_PlayerListener implements Listener
event.setCancelled(true);
}
if (!TFM_SuperadminList.isUserSuperadmin(p))
if (!TFM_SuperadminList.isUserSuperadmin(player))
{
for (Player pl : Bukkit.getOnlinePlayers())
{
if (TFM_SuperadminList.isUserSuperadmin(pl) && TFM_PlayerData.getPlayerData(pl).cmdspyEnabled())
{
TFM_Util.playerMsg(pl, p.getName() + ": " + command);
TFM_Util.playerMsg(pl, player.getName() + ": " + command);
}
}
}
@ -587,12 +587,12 @@ public class TFM_PlayerListener implements Listener
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerKick(PlayerKickEvent event)
{
Player p = event.getPlayer();
if (TotalFreedomMod.fuckoffEnabledFor.containsKey(p))
Player player = event.getPlayer();
if (TotalFreedomMod.fuckoffEnabledFor.containsKey(player))
{
TotalFreedomMod.fuckoffEnabledFor.remove(p);
TotalFreedomMod.fuckoffEnabledFor.remove(player);
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.disarmMP44();
if (playerdata.isCaged())
{
@ -604,12 +604,12 @@ public class TFM_PlayerListener implements Listener
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event)
{
Player p = event.getPlayer();
if (TotalFreedomMod.fuckoffEnabledFor.containsKey(p))
Player player = event.getPlayer();
if (TotalFreedomMod.fuckoffEnabledFor.containsKey(player))
{
TotalFreedomMod.fuckoffEnabledFor.remove(p);
TotalFreedomMod.fuckoffEnabledFor.remove(player);
}
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.disarmMP44();
if (playerdata.isCaged())
{
@ -623,41 +623,41 @@ public class TFM_PlayerListener implements Listener
{
try
{
final Player p = event.getPlayer();
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
final Player player = event.getPlayer();
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setSuperadminIdVerified(null);
TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(p);
TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(player);
boolean superadmin_impostor = TFM_SuperadminList.isSuperadminImpostor(p);
boolean superadmin_impostor = TFM_SuperadminList.isSuperadminImpostor(player);
if (superadmin_impostor || TFM_SuperadminList.isUserSuperadmin(p))
if (superadmin_impostor || TFM_SuperadminList.isUserSuperadmin(player))
{
TFM_Util.bcastMsg(ChatColor.AQUA + p.getName() + " is " + TFM_Util.getRank(p));
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_Util.getRank(player));
if (superadmin_impostor)
{
p.getInventory().clear();
p.setOp(false);
p.setGameMode(GameMode.SURVIVAL);
TFM_Util.bcastMsg("Warning: " + p.getName() + " has been flagged as an impostor!", ChatColor.RED);
player.getInventory().clear();
player.setOp(false);
player.setGameMode(GameMode.SURVIVAL);
TFM_Util.bcastMsg("Warning: " + player.getName() + " has been flagged as an impostor!", ChatColor.RED);
}
else
{
if (TFM_SuperadminList.verifyIdentity(p.getName(), p.getAddress().getAddress().getHostAddress()))
if (TFM_SuperadminList.verifyIdentity(player.getName(), player.getAddress().getAddress().getHostAddress()))
{
playerdata.setSuperadminIdVerified(Boolean.TRUE);
TFM_SuperadminList.updateLastLogin(p);
TFM_SuperadminList.updateLastLogin(player);
}
else
{
playerdata.setSuperadminIdVerified(Boolean.FALSE);
TFM_Util.bcastMsg("Warning: " + p.getName() + " is an admin, but is using a username not registered to one of their IPs.", ChatColor.RED);
TFM_Util.bcastMsg("Warning: " + player.getName() + " is an admin, but is using a username not registered to one of their IPs.", ChatColor.RED);
}
p.setOp(true);
player.setOp(true);
}
}
@ -668,12 +668,12 @@ public class TFM_PlayerListener implements Listener
@Override
public void run()
{
p.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins.");
player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins.");
}
}.runTaskLater(TotalFreedomMod.plugin, 20L * 3L);
}
}
catch (Throwable ex)
catch (Throwable e)
{
}
}

View File

@ -158,25 +158,25 @@ public class TFM_ServerListener implements Listener
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value)
public PermissionAttachment addAttachment(Plugin target_plugin, String name, boolean value)
{
return null;
}
@Override
public PermissionAttachment addAttachment(Plugin plugin)
public PermissionAttachment addAttachment(Plugin target_plugin)
{
return null;
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks)
public PermissionAttachment addAttachment(Plugin target_plugin, String name, boolean value, int ticks)
{
return null;
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, int ticks)
public PermissionAttachment addAttachment(Plugin target_plugin, int ticks)
{
return null;
}

View File

@ -26,9 +26,9 @@ public class TFM_DisguiseCraftBridge
return api.undisguisePlayer(player);
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return false;
@ -53,9 +53,9 @@ public class TFM_DisguiseCraftBridge
}
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -66,7 +66,7 @@ public class TFM_DisguiseCraftBridge
{
pluginEnabled = Bukkit.getPluginManager().isPluginEnabled("DisguiseCraft");
}
catch (Exception ex)
catch (Exception e)
{
}
return pluginEnabled;

View File

@ -27,9 +27,9 @@ public class TFM_Heartbeat extends BukkitRunnable
{
lastRan = System.currentTimeMillis();
for (Player p : server.getOnlinePlayers())
for (Player player: server.getOnlinePlayers())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.resetMsgCount();
playerdata.resetBlockDestroyCount();
playerdata.resetBlockPlaceCount();

View File

@ -48,8 +48,8 @@ public class TFM_Log
TFM_Log.log(Level.SEVERE, message, raw);
}
public static void severe(Throwable ex)
public static void severe(Throwable e)
{
logger.log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, e);
}
}

View File

@ -62,9 +62,9 @@ public class TFM_PlayerData
this.player_name = player.getName();
}
public static TFM_PlayerData getPlayerData(Player p)
public static TFM_PlayerData getPlayerData(Player player)
{
TFM_PlayerData playerdata = TFM_PlayerData.userinfo.get(p);
TFM_PlayerData playerdata = TFM_PlayerData.userinfo.get(player);
if (playerdata == null)
{
@ -74,7 +74,7 @@ public class TFM_PlayerData
Entry<Player, TFM_PlayerData> pair = it.next();
TFM_PlayerData playerdata_test = pair.getValue();
if (playerdata_test.player_name.equalsIgnoreCase(p.getName()))
if (playerdata_test.player_name.equalsIgnoreCase(player.getName()))
{
if (Bukkit.getOnlineMode())
{
@ -83,7 +83,7 @@ public class TFM_PlayerData
}
else
{
if (playerdata_test.ip_address.equalsIgnoreCase(p.getAddress().getAddress().getHostAddress()))
if (playerdata_test.ip_address.equalsIgnoreCase(player.getAddress().getAddress().getHostAddress()))
{
playerdata = playerdata_test;
break;
@ -95,8 +95,8 @@ public class TFM_PlayerData
if (playerdata == null)
{
playerdata = new TFM_PlayerData(p);
TFM_PlayerData.userinfo.put(p, playerdata);
playerdata = new TFM_PlayerData(player);
TFM_PlayerData.userinfo.put(player, playerdata);
}
return playerdata;

View File

@ -83,9 +83,9 @@ public class TFM_ProtectedArea implements Serializable
oos.close();
fos.close();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -104,12 +104,12 @@ public class TFM_ProtectedArea implements Serializable
fis.close();
}
}
catch (Exception ex)
catch (Exception e)
{
File input_file = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PROTECTED_AREA_FILE);
input_file.delete();
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}

View File

@ -130,9 +130,9 @@ public class TFM_ServerInterface
final BanList banByIP = player_list.getIPBans();
final BanList banByName = player_list.getNameBans();
final Player p = event.getPlayer();
final Player player = event.getPlayer();
final String player_name = p.getName();
final String player_name = player.getName();
final String player_ip = event.getAddress().getHostAddress().trim().toLowerCase();
if (player_name.trim().length() <= 2)
@ -146,7 +146,7 @@ public class TFM_ServerInterface
return;
}
// not safe to use TFM_Util.isUserSuperadmin for player logging in because p.getAddress() will return a null until after player login.
// not safe to use TFM_Util.isUserSuperadmin for player logging in because player.getAddress() will return a null until after player login.
boolean is_superadmin;
if (server.getOnlineMode())
{
@ -304,7 +304,7 @@ public class TFM_ServerInterface
if (TotalFreedomMod.lockdownEnabled)
{
TFM_Util.playerMsg(p, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED);
TFM_Util.playerMsg(player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED);
}
}
}

View File

@ -88,10 +88,10 @@ public class TFM_ServiceChecker
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe("Error updating mojang services from " + TotalFreedomMod.serviceCheckerURL);
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
};

View File

@ -52,9 +52,9 @@ public class TFM_Superadmin
output.append("- Console Aliases: ").append(StringUtils.join(this.console_aliases, ", ")).append("\n");
output.append("- Is Activated: ").append(this.is_activated);
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return output.toString();

View File

@ -70,9 +70,9 @@ public class TFM_SuperadminList
updateIndexLists();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -153,9 +153,9 @@ public class TFM_SuperadminList
config.save(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -173,9 +173,9 @@ public class TFM_SuperadminList
}
}
public static TFM_Superadmin getAdminEntry(Player p)
public static TFM_Superadmin getAdminEntry(Player player)
{
return getAdminEntry(p.getName().toLowerCase());
return getAdminEntry(player.getName().toLowerCase());
}
public static TFM_Superadmin getAdminEntryByIP(String ip)
@ -193,9 +193,9 @@ public class TFM_SuperadminList
return null;
}
public static void updateLastLogin(Player p)
public static void updateLastLogin(Player player)
{
TFM_Superadmin admin_entry = getAdminEntry(p);
TFM_Superadmin admin_entry = getAdminEntry(player);
if (admin_entry != null)
{
admin_entry.setLastLogin(new Date());
@ -260,7 +260,7 @@ public class TFM_SuperadminList
}
}
}
catch (Exception ex)
catch (Exception e)
{
return false;
}
@ -309,9 +309,9 @@ public class TFM_SuperadminList
}
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return false;
@ -324,11 +324,11 @@ public class TFM_SuperadminList
return false;
}
Player p = (Player) user;
Player player = (Player) user;
if (superadminNames.contains(p.getName().toLowerCase()))
if (superadminNames.contains(player.getName().toLowerCase()))
{
return !isUserSuperadmin(p);
return !isUserSuperadmin(player);
}
return false;
@ -360,16 +360,16 @@ public class TFM_SuperadminList
saveSuperadminList();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
public static void addSuperadmin(Player p)
public static void addSuperadmin(Player player)
{
String admin_name = p.getName().toLowerCase();
List<String> ips = Arrays.asList(p.getAddress().getAddress().getHostAddress());
String admin_name = player.getName().toLowerCase();
List<String> ips = Arrays.asList(player.getAddress().getAddress().getHostAddress());
addSuperadmin(admin_name, ips);
}
@ -393,15 +393,15 @@ public class TFM_SuperadminList
saveSuperadminList();
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
public static void removeSuperadmin(Player p)
public static void removeSuperadmin(Player player)
{
removeSuperadmin(p.getName());
removeSuperadmin(player.getName());
}
public static void cleanSuperadminList(boolean verbose)
@ -433,9 +433,9 @@ public class TFM_SuperadminList
}
saveSuperadminList();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}

View File

@ -56,9 +56,9 @@ public class TFM_TwitterHandler
line = in.readLine();
in.close();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ExceptionUtils.getFullStackTrace(ex));
TFM_Log.severe(ExceptionUtils.getFullStackTrace(e));
}
return line;
}

View File

@ -40,16 +40,16 @@ public class TFM_UserList
userlist.put(username, entry);
}
for (Player p : plugin.getServer().getOnlinePlayers())
for (Player player: plugin.getServer().getOnlinePlayers())
{
addUser(p);
addUser(player);
}
exportList();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe("Error loading Userlist, resetting list: " + ex.getMessage());
TFM_Log.severe("Error loading Userlist, resetting list: " + e.getMessage());
purge();
}
}
@ -67,9 +67,9 @@ public class TFM_UserList
{
new_userlist.save(new File(plugin.getDataFolder(), USERLIST_FILENAME));
}
catch (IOException ex)
catch (IOException e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -82,9 +82,9 @@ public class TFM_UserList
return instance;
}
public void addUser(Player p)
public void addUser(Player player)
{
addUser(p.getName(), p.getAddress().getAddress().getHostAddress());
addUser(player.getName(), player.getAddress().getAddress().getHostAddress());
}
public void addUser(String username, String ip_address)
@ -105,9 +105,9 @@ public class TFM_UserList
}
}
public TFM_UserListEntry getEntry(Player p)
public TFM_UserListEntry getEntry(Player player)
{
return getEntry(p.getName());
return getEntry(player.getName());
}
public TFM_UserListEntry getEntry(String username)
@ -119,9 +119,9 @@ public class TFM_UserList
{
userlist.clear();
for (Player p : plugin.getServer().getOnlinePlayers())
for (Player player: plugin.getServer().getOnlinePlayers())
{
addUser(p);
addUser(player);
}
exportList();

View File

@ -40,7 +40,7 @@ public class TFM_Util
}
}
}
catch (Exception ex)
catch (Exception e)
{
}
}
@ -55,9 +55,9 @@ public class TFM_Util
{
TFM_Log.info(message, true);
for (Player p : Bukkit.getOnlinePlayers())
for (Player player: Bukkit.getOnlinePlayers())
{
p.sendMessage((color == null ? "" : color) + message);
player.sendMessage((color == null ? "" : color) + message);
}
}
@ -396,14 +396,14 @@ public class TFM_Util
STRIKE_ONE, STRIKE_TWO, STRIKE_THREE;
}
public static void autoEject(Player p, String kickMessage)
public static void autoEject(Player player, String kickMessage)
{
EjectMethod method = EjectMethod.STRIKE_ONE;
String player_ip = null;
try
{
player_ip = p.getAddress().getAddress().getHostAddress();
player_ip = player.getAddress().getAddress().getHostAddress();
Integer num_kicks = TFM_Util.eject_tracker.get(player_ip);
if (num_kicks == null)
@ -428,15 +428,15 @@ public class TFM_Util
method = EjectMethod.STRIKE_THREE;
}
}
catch (Exception ex)
catch (Exception e)
{
}
TFM_Log.info("autoEject -> name: " + p.getName() + " - player_ip: " + player_ip + " - method: " + method.toString());
TFM_Log.info("autoEject -> name: " + player.getName() + " - player_ip: " + player_ip + " - method: " + method.toString());
p.setOp(false);
p.setGameMode(GameMode.SURVIVAL);
p.getInventory().clear();
player.setOp(false);
player.setGameMode(GameMode.SURVIVAL);
player.getInventory().clear();
switch (method)
{
@ -446,11 +446,11 @@ public class TFM_Util
c.add(Calendar.MINUTE, 1);
Date expires = c.getTime();
TFM_Util.bcastMsg(ChatColor.RED + p.getName() + " has been banned for 1 minute.");
TFM_Util.bcastMsg(ChatColor.RED + player.getName() + " has been banned for 1 minute.");
TFM_ServerInterface.banIP(player_ip, kickMessage, "AutoEject", expires);
TFM_ServerInterface.banUsername(p.getName(), kickMessage, "AutoEject", expires);
p.kickPlayer(kickMessage);
TFM_ServerInterface.banUsername(player.getName(), kickMessage, "AutoEject", expires);
player.kickPlayer(kickMessage);
break;
}
@ -460,11 +460,11 @@ public class TFM_Util
c.add(Calendar.MINUTE, 3);
Date expires = c.getTime();
TFM_Util.bcastMsg(ChatColor.RED + p.getName() + " has been banned for 3 minutes.");
TFM_Util.bcastMsg(ChatColor.RED + player.getName() + " has been banned for 3 minutes.");
TFM_ServerInterface.banIP(player_ip, kickMessage, "AutoEject", expires);
TFM_ServerInterface.banUsername(p.getName(), kickMessage, "AutoEject", expires);
p.kickPlayer(kickMessage);
TFM_ServerInterface.banUsername(player.getName(), kickMessage, "AutoEject", expires);
player.kickPlayer(kickMessage);
break;
}
@ -477,11 +477,11 @@ public class TFM_Util
TFM_ServerInterface.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", kickMessage, "AutoEject", null);
//p.setBanned(true);
TFM_ServerInterface.banUsername(p.getName(), kickMessage, "AutoEject", null);
TFM_ServerInterface.banUsername(player.getName(), kickMessage, "AutoEject", null);
TFM_Util.bcastMsg(ChatColor.RED + p.getName() + " has been banned permanently.");
TFM_Util.bcastMsg(ChatColor.RED + player.getName() + " has been banned permanently.");
p.kickPlayer(kickMessage);
player.kickPlayer(kickMessage);
break;
}
@ -653,9 +653,9 @@ public class TFM_Util
public static String playerListToNames(Set<OfflinePlayer> players)
{
List<String> player_names = new ArrayList<String>();
for (OfflinePlayer p : players)
for (OfflinePlayer player: players)
{
player_names.add(p.getName());
player_names.add(player.getName());
}
return StringUtils.join(player_names, ", ");
}
@ -676,9 +676,9 @@ public class TFM_Util
ois.close();
fis.close();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -728,9 +728,9 @@ public class TFM_Util
oos.close();
fos.close();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
@ -741,7 +741,7 @@ public class TFM_Util
{
do_wipe_flatlands = TFM_Util.getSavedFlag("do_wipe_flatlands");
}
catch (Exception ex)
catch (Exception e)
{
}
@ -779,7 +779,7 @@ public class TFM_Util
{
return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).parse(date_str);
}
catch (ParseException ex)
catch (ParseException e)
{
return new Date(0L);
}
@ -893,11 +893,11 @@ public class TFM_Util
String name = sender.getName() + " " + getPrefix(sender, senderIsConsole);
TFM_Log.info("[ADMIN] " + name + ": " + message);
for (Player p : Bukkit.getOnlinePlayers())
for (Player player: Bukkit.getOnlinePlayers())
{
if (TFM_SuperadminList.isUserSuperadmin(p))
if (TFM_SuperadminList.isUserSuperadmin(player))
{
p.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + name + ": " + ChatColor.AQUA + message);
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + name + ": " + ChatColor.AQUA + message);
}
}
}
@ -952,10 +952,10 @@ public class TFM_Util
field.setAccessible(true);
return (T) field.get(from);
}
catch (NoSuchFieldException ex)
catch (NoSuchFieldException e)
{
}
catch (IllegalAccessException ex)
catch (IllegalAccessException e)
{
}
}

View File

@ -30,56 +30,56 @@ public class TFM_WorldEditBridge
}
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
return this.worldEditPlugin;
}
public BukkitPlayer getBukkitPlayer(Player p)
public BukkitPlayer getBukkitPlayer(Player player)
{
try
{
WorldEditPlugin wep = this.getWorldEditPlugin();
if (wep != null)
{
return wep.wrapPlayer(p);
return wep.wrapPlayer(player);
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return null;
}
public LocalSession getPlayerSession(Player p)
public LocalSession getPlayerSession(Player player)
{
try
{
WorldEditPlugin wep = this.getWorldEditPlugin();
if (wep != null)
{
return wep.getSession(p);
return wep.getSession(player);
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
return null;
}
public void undo(Player p, int count)
public void undo(Player player, int count)
{
try
{
LocalSession session = getPlayerSession(p);
LocalSession session = getPlayerSession(player);
if (session != null)
{
BukkitPlayer bukkitPlayer = this.getBukkitPlayer(p);
BukkitPlayer bukkitPlayer = this.getBukkitPlayer(player);
if (bukkitPlayer != null)
{
for (int i = 0; i < count; i++)
@ -89,25 +89,25 @@ public class TFM_WorldEditBridge
}
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
public void setLimit(Player p, int limit)
public void setLimit(Player player, int limit)
{
try
{
LocalSession session = getPlayerSession(p);
LocalSession session = getPlayerSession(player);
if (session != null)
{
session.setBlockChangeLimit(limit);
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}

View File

@ -139,9 +139,9 @@ public class TotalFreedomMod extends JavaPlugin
Metrics metrics = new Metrics(plugin);
metrics.start();
}
catch (IOException ex)
catch (IOException e)
{
TFM_Log.warning("Failed to submit metrics data: " + ex.getMessage());
TFM_Log.warning("Failed to submit metrics data: " + e.getMessage());
}
TFM_Log.info("Plugin Enabled - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
@ -198,9 +198,9 @@ public class TotalFreedomMod extends JavaPlugin
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX, cmd.getName().toLowerCase())).newInstance();
dispatcher.setup(this, sender, dispatcher.getClass());
}
catch (Throwable ex)
catch (Throwable e)
{
TFM_Log.severe("Command not loaded: " + cmd.getName() + "\n" + ExceptionUtils.getStackTrace(ex));
TFM_Log.severe("Command not loaded: " + cmd.getName() + "\n" + ExceptionUtils.getStackTrace(e));
sender.sendMessage(ChatColor.RED + "Command Error: Command not loaded: " + cmd.getName());
return true;
}
@ -216,15 +216,15 @@ public class TotalFreedomMod extends JavaPlugin
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
}
catch (Throwable ex)
catch (Throwable e)
{
TFM_Log.severe("Command Error: " + commandLabel + "\n" + ExceptionUtils.getStackTrace(ex));
TFM_Log.severe("Command Error: " + commandLabel + "\n" + ExceptionUtils.getStackTrace(e));
}
}
catch (Throwable ex)
catch (Throwable e)
{
TFM_Log.severe("Command Error: " + commandLabel + "\n" + ExceptionUtils.getStackTrace(ex));
TFM_Log.severe("Command Error: " + commandLabel + "\n" + ExceptionUtils.getStackTrace(e));
sender.sendMessage(ChatColor.RED + "Unknown Command Error.");
}
@ -324,9 +324,9 @@ public class TotalFreedomMod extends JavaPlugin
logsRegisterURL = config.getString("logs_register_url", logsRegisterURL);
serviceCheckerURL = config.getString("service_checker_url", serviceCheckerURL);
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe("Error loading main config: " + ex.getMessage());
TFM_Log.severe("Error loading main config: " + e.getMessage());
}
}
@ -337,9 +337,9 @@ public class TotalFreedomMod extends JavaPlugin
TFM_SuperadminList.backupSavedList();
TFM_SuperadminList.loadSuperadminList();
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe("Error loading superadmin list: " + ex.getMessage());
TFM_Log.severe("Error loading superadmin list: " + e.getMessage());
}
}
//
@ -371,9 +371,9 @@ public class TotalFreedomMod extends JavaPlugin
}
}
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe("Error loading permban list: " + ex.getMessage());
TFM_Log.severe("Error loading permban list: " + e.getMessage());
}
}
@ -403,9 +403,9 @@ public class TotalFreedomMod extends JavaPlugin
TotalFreedomMod.buildNumber = props.getProperty("program.BUILDNUM");
TotalFreedomMod.buildDate = props.getProperty("program.BUILDDATE");
}
catch (Exception ex)
catch (Exception e)
{
TFM_Log.severe(ex);
TFM_Log.severe(e);
}
}
}