DromedaryCase

This commit is contained in:
JeromSar 2013-08-14 16:55:37 +02:00
parent 339518f4f4
commit 122bef2d5a
16 changed files with 79 additions and 80 deletions

View File

@ -70,13 +70,13 @@ public class Command_cage extends TFM_Command
}
}
Location target_pos = player.getLocation().add(0, 1, 0);
playerdata.setCaged(true, target_pos, cage_material_outer, cage_material_inner);
Location targetPos = player.getLocation().add(0, 1, 0);
playerdata.setCaged(true, targetPos, cage_material_outer, cage_material_inner);
playerdata.regenerateHistory();
playerdata.clearHistory();
TFM_Util.buildHistory(target_pos, 2, playerdata);
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER));
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
TFM_Util.buildHistory(targetPos, 2, playerdata);
TFM_Util.generateCube(targetPos, 2, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER));
TFM_Util.generateCube(targetPos, 1, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
player.setGameMode(GameMode.SURVIVAL);

View File

@ -13,13 +13,13 @@ public class Command_cartsit extends TFM_Command
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
Player target_player = sender_p;
Player targetPlayer = sender_p;
if (args.length == 1)
{
try
{
target_player = getPlayer(args[0]);
targetPlayer = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
@ -30,26 +30,26 @@ public class Command_cartsit extends TFM_Command
if (senderIsConsole)
{
if (target_player == null)
if (targetPlayer == null)
{
sender.sendMessage("When used from the console, you must define a target player: /cartsit <player>");
return true;
}
}
else if (target_player != sender_p && !TFM_SuperadminList.isUserSuperadmin(sender))
else if (targetPlayer != sender_p && !TFM_SuperadminList.isUserSuperadmin(sender))
{
sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
return true;
}
if (target_player.isInsideVehicle())
if (targetPlayer.isInsideVehicle())
{
target_player.getVehicle().eject();
targetPlayer.getVehicle().eject();
}
else
{
Minecart nearest_cart = null;
for (Minecart cart : target_player.getWorld().getEntitiesByClass(Minecart.class))
for (Minecart cart : targetPlayer.getWorld().getEntitiesByClass(Minecart.class))
{
if (cart.isEmpty())
{
@ -59,7 +59,7 @@ public class Command_cartsit extends TFM_Command
}
else
{
if (cart.getLocation().distanceSquared(target_player.getLocation()) < nearest_cart.getLocation().distanceSquared(target_player.getLocation()))
if (cart.getLocation().distanceSquared(targetPlayer.getLocation()) < nearest_cart.getLocation().distanceSquared(targetPlayer.getLocation()))
{
nearest_cart = cart;
}
@ -69,7 +69,7 @@ public class Command_cartsit extends TFM_Command
if (nearest_cart != null)
{
nearest_cart.setPassenger(target_player);
nearest_cart.setPassenger(targetPlayer);
}
else
{

View File

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

View File

@ -39,9 +39,9 @@ public class Command_creative extends TFM_Command
return true;
}
for (Player target_player : server.getOnlinePlayers())
for (Player targetPlayer : server.getOnlinePlayers())
{
target_player.setGameMode(GameMode.CREATIVE);
targetPlayer.setGameMode(GameMode.CREATIVE);
}
TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false);

View File

@ -74,13 +74,13 @@ public class Command_dispfill extends TFM_Command
{
for (int z_offset = -radius; z_offset <= radius; z_offset++)
{
Block target_block = center_block.getRelative(x_offset, y_offset, z_offset);
if (target_block.getLocation().distanceSquared(center_location) < (radius * radius))
Block targetBlock = center_block.getRelative(x_offset, y_offset, z_offset);
if (targetBlock.getLocation().distanceSquared(center_location) < (radius * radius))
{
if (target_block.getType().equals(Material.DISPENSER))
if (targetBlock.getType().equals(Material.DISPENSER))
{
sender.sendMessage("Filling dispenser @ " + TFM_Util.formatLocation(target_block.getLocation()));
setDispenserContents(target_block, items_array);
sender.sendMessage("Filling dispenser @ " + TFM_Util.formatLocation(targetBlock.getLocation()));
setDispenserContents(targetBlock, items_array);
affected++;
}
}
@ -98,9 +98,9 @@ public class Command_dispfill extends TFM_Command
return true;
}
private static void setDispenserContents(Block target_block, ItemStack[] items)
private static void setDispenserContents(Block targetBlock, ItemStack[] items)
{
Dispenser dispenser = (Dispenser) target_block.getState();
Dispenser dispenser = (Dispenser) targetBlock.getState();
Inventory disp_inv = dispenser.getInventory();
disp_inv.clear();
disp_inv.addItem(items);

View File

@ -42,12 +42,12 @@ public class Command_expel extends TFM_Command
{
if (!player.equals(sender_p))
{
Location target_pos = player.getLocation();
Location targetPos = player.getLocation();
boolean in_range = false;
try
{
in_range = target_pos.distanceSquared(sender_pos) < (radius * radius);
in_range = targetPos.distanceSquared(sender_pos) < (radius * radius);
}
catch (IllegalArgumentException ex)
{
@ -55,7 +55,7 @@ public class Command_expel extends TFM_Command
if (in_range)
{
player.setVelocity(target_pos.clone().subtract(sender_pos).toVector().normalize().multiply(strength));
player.setVelocity(targetPos.clone().subtract(sender_pos).toVector().normalize().multiply(strength));
playerMsg("Pushing " + player.getName() + ".");
}
}

View File

@ -60,13 +60,13 @@ public class Command_gtfo extends TFM_Command
player.getInventory().clear();
// strike with lightning effect:
final Location target_pos = player.getLocation();
final Location targetPos = player.getLocation();
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
final Location strike_pos = new Location(target_pos.getWorld(), target_pos.getBlockX() + x, target_pos.getBlockY(), target_pos.getBlockZ() + z);
target_pos.getWorld().strikeLightning(strike_pos);
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
targetPos.getWorld().strikeLightning(strike_pos);
}
}

View File

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

View File

@ -16,7 +16,7 @@ import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
@CommandParameters(
description = "Manipulate potion effects. Duration is measured in server ticks (~20 ticks per second).",
usage = "/<command> <list | clear [target_name] | add <type> <duration> <amplifier> [target_name]>")
usage = "/<command> <list | clear [target name] | add <type> <duration> <amplifier> [target name]>")
public class Command_potion extends TFM_Command
{
@Override

View File

@ -26,11 +26,11 @@ public class Command_qdeop extends TFM_Command
boolean matched_player = false;
String target_name = args[0].toLowerCase();
String targetName = args[0].toLowerCase();
for (Player player : server.getOnlinePlayers())
{
if (player.getName().toLowerCase().indexOf(target_name) != -1 || player.getDisplayName().toLowerCase().indexOf(target_name) != -1)
if (player.getName().toLowerCase().indexOf(targetName) != -1 || player.getDisplayName().toLowerCase().indexOf(targetName) != -1)
{
matched_player = true;

View File

@ -26,11 +26,11 @@ public class Command_qop extends TFM_Command
boolean matched_player = false;
String target_name = args[0].toLowerCase();
String targetName = args[0].toLowerCase();
for (Player player : server.getOnlinePlayers())
{
if (player.getName().toLowerCase().indexOf(target_name) != -1 || player.getDisplayName().toLowerCase().indexOf(target_name) != -1)
if (player.getName().toLowerCase().indexOf(targetName) != -1 || player.getDisplayName().toLowerCase().indexOf(targetName) != -1)
{
matched_player = true;

View File

@ -51,12 +51,12 @@ public class Command_ro extends TFM_Command
}
}
Player target_player = null;
Player targetPlayer = null;
if (args.length == 3)
{
try
{
target_player = getPlayer(args[2]);
targetPlayer = getPlayer(args[2]);
}
catch (PlayerNotFoundException ex)
{
@ -67,7 +67,7 @@ public class Command_ro extends TFM_Command
int affected = 0;
if (target_player == null)
if (targetPlayer == null)
{
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of all players. Brace for lag...", senderIsConsole);
for (Player player : server.getOnlinePlayers())
@ -77,8 +77,8 @@ public class Command_ro extends TFM_Command
}
else
{
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of " + target_player.getName() + ".", senderIsConsole);
affected += TFM_Util.replaceBlocks(target_player.getLocation(), from_material, Material.AIR, radius);
TFM_Util.adminAction(sender.getName(), "Removing all " + from_material.name() + " within " + radius + " blocks of " + targetPlayer.getName() + ".", senderIsConsole);
affected += TFM_Util.replaceBlocks(targetPlayer.getLocation(), from_material, Material.AIR, radius);
}
TFM_Util.adminAction(sender.getName(), "Remove complete. " + affected + " blocks removed.", senderIsConsole);

View File

@ -131,24 +131,24 @@ public class Command_saconfig extends TFM_Command
return true;
}
String target_name = args[1];
String targetName = args[1];
try
{
target_name = getPlayer(target_name).getName();
targetName = getPlayer(targetName).getName();
}
catch (PlayerNotFoundException ex)
{
}
if (!TFM_SuperadminList.getSuperadminNames().contains(target_name.toLowerCase()))
if (!TFM_SuperadminList.getSuperadminNames().contains(targetName.toLowerCase()))
{
playerMsg("Superadmin not found: " + target_name);
playerMsg("Superadmin not found: " + targetName);
return true;
}
TFM_Util.adminAction(sender.getName(), "Removing " + target_name + " from the superadmin list", true);
TFM_SuperadminList.removeSuperadmin(target_name);
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
TFM_SuperadminList.removeSuperadmin(targetName);
if (!TotalFreedomMod.twitterbotEnabled)
{
@ -157,10 +157,10 @@ public class Command_saconfig extends TFM_Command
// Twitterbot
TFM_TwitterHandler twitterbot = TFM_TwitterHandler.getInstance(plugin);
String reply = twitterbot.delTwitter(target_name);
String reply = twitterbot.delTwitter(targetName);
if ("ok".equals(reply))
{
TFM_Util.adminAction(sender.getName(), "Removing " + target_name + " from TwitterBot", true);
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from TwitterBot", true);
}
else if ("disabled".equals(reply))
{
@ -184,7 +184,7 @@ public class Command_saconfig extends TFM_Command
}
else if ("notfound".equals(reply))
{
TFM_Util.playerMsg(sender, target_name + " did not have a twitter handle registered to their name.", ChatColor.GREEN);
TFM_Util.playerMsg(sender, targetName + " did not have a twitter handle registered to their name.", ChatColor.GREEN);
}
}

View File

@ -51,13 +51,13 @@ public class Command_smite extends TFM_Command
player.getInventory().clear();
//Strike with lightning effect:
final Location target_pos = player.getLocation();
final Location targetPos = player.getLocation();
final World world = player.getWorld();
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
final Location strike_pos = new Location(world, target_pos.getBlockX() + x, target_pos.getBlockY(), target_pos.getBlockZ() + z);
final Location strike_pos = new Location(world, targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
world.strikeLightning(strike_pos);
}
}

View File

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
@ -42,9 +41,9 @@ public class Command_survival extends TFM_Command
return true;
}
for (Player target_player : server.getOnlinePlayers())
for (Player targetPlayer : server.getOnlinePlayers())
{
target_player.setGameMode(GameMode.SURVIVAL);
targetPlayer.setGameMode(GameMode.SURVIVAL);
}
TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to survival", false);

View File

@ -122,21 +122,21 @@ public class TFM_PlayerListener implements Listener
{
if (TFM_SuperadminList.isSeniorAdmin(player, true))
{
Block target_block;
Block targetBlock;
if (event.getAction().equals(Action.LEFT_CLICK_AIR))
{
target_block = player.getTargetBlock(null, 120);
targetBlock = player.getTargetBlock(null, 120);
}
else
{
target_block = event.getClickedBlock();
targetBlock = event.getClickedBlock();
}
if (target_block != null)
if (targetBlock != null)
{
player.getWorld().createExplosion(target_block.getLocation(), 4F, true);
player.getWorld().strikeLightning(target_block.getLocation());
player.getWorld().createExplosion(targetBlock.getLocation(), 4F, true);
player.getWorld().strikeLightning(targetBlock.getLocation());
}
else
{
@ -160,10 +160,10 @@ public class TFM_PlayerListener implements Listener
Vector player_dir = player_location.getDirection().normalize();
double distance = 150.0;
Block target_block = player.getTargetBlock(null, Math.round((float) distance));
if (target_block != null)
Block targetBlock = player.getTargetBlock(null, Math.round((float) distance));
if (targetBlock != null)
{
distance = player_location.distance(target_block.getLocation());
distance = player_location.distance(targetBlock.getLocation());
}
final List<Block> affected = new ArrayList<Block>();
@ -305,26 +305,26 @@ public class TFM_PlayerListener implements Listener
if (playerdata.isCaged())
{
Location target_pos = player.getLocation().add(0, 1, 0);
Location targetPos = player.getLocation().add(0, 1, 0);
boolean out_of_cage;
if (!target_pos.getWorld().equals(playerdata.getCagePos().getWorld()))
if (!targetPos.getWorld().equals(playerdata.getCagePos().getWorld()))
{
out_of_cage = true;
}
else
{
out_of_cage = target_pos.distanceSquared(playerdata.getCagePos()) > (2.5 * 2.5);
out_of_cage = targetPos.distanceSquared(playerdata.getCagePos()) > (2.5 * 2.5);
}
if (out_of_cage)
{
playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER), playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
playerdata.setCaged(true, targetPos, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER), playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
playerdata.regenerateHistory();
playerdata.clearHistory();
TFM_Util.buildHistory(target_pos, 2, playerdata);
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER));
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
TFM_Util.buildHistory(targetPos, 2, playerdata);
TFM_Util.generateCube(targetPos, 2, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.OUTER));
TFM_Util.generateCube(targetPos, 1, playerdata.getCageMaterial(TFM_PlayerData.CageLayer.INNER));
}
}