Code cleanup

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1572 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-06-02 14:23:50 +00:00
parent 09e17a4d6c
commit 3e359b5b48
4 changed files with 21 additions and 18 deletions

View File

@ -249,7 +249,7 @@ public class Essentials extends JavaPlugin implements IEssentials
}
String[] retval = new String[lines.size()];
if (lines == null || lines.isEmpty() || lines.get(0) == null)
if (lines.isEmpty() || lines.get(0) == null)
{
try
{

View File

@ -23,10 +23,9 @@ public class Commandantioch extends EssentialsCommand
ess.broadcastMessage(user.getName(), "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
ess.broadcastMessage(user.getName(), "who being naughty in My sight, shall snuff it.");
Location loc = user.getLocation();
World world = ((CraftWorld)user.getWorld()).getHandle();
loc = new TargetBlock(user).getTargetBlock().getLocation();
EntityTNTPrimed tnt = new EntityTNTPrimed(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
final World world = ((CraftWorld)user.getWorld()).getHandle();
final Location loc = new TargetBlock(user).getTargetBlock().getLocation();
final EntityTNTPrimed tnt = new EntityTNTPrimed(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
world.addEntity(tnt);
world.makeSound(tnt, "random.fuse", 1.0F, 1.0F);
}

View File

@ -22,7 +22,6 @@ public class Commandban extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
User p = null;
if (server.matchPlayer(args[0]).isEmpty())
{
((CraftServer)server).getHandle().a(args[0]);
@ -30,15 +29,20 @@ public class Commandban extends EssentialsCommand
}
else
{
p = ess.getUser(server.matchPlayer(args[0]).get(0));
String banReason = Util.i18n("defaultBanReason");
if(args.length > 1) {
final User player = ess.getUser(server.matchPlayer(args[0]).get(0));
String banReason;
if (args.length > 1)
{
banReason = getFinalArg(args, 1);
p.setBanReason(commandLabel);
player.setBanReason(commandLabel);
}
p.kickPlayer(banReason);
((CraftServer)server).getHandle().a(p.getName());
sender.sendMessage(Util.format("playerBanned", p.getName()));
else
{
banReason = Util.i18n("defaultBanReason");
}
player.kickPlayer(banReason);
((CraftServer)server).getHandle().a(player.getName());
sender.sendMessage(Util.format("playerBanned", player.getName()));
}
ess.loadBanList();
}

View File

@ -17,7 +17,7 @@ public class Commandbigtree extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
TreeType tree = TreeType.TREE;
TreeType tree;
if (args.length > 0 && args[0].equalsIgnoreCase("redwood"))
{
tree = TreeType.TALL_REDWOOD;
@ -36,7 +36,7 @@ public class Commandbigtree extends EssentialsCommand
double z = user.getLocation().getZ();
// offset tree in direction player is facing
int r = (int)user.getCorrectedYaw();
final int r = (int)user.getCorrectedYaw();
if (r < 68 || r > 292) // north
{
x -= 3.0D;
@ -54,8 +54,8 @@ public class Commandbigtree extends EssentialsCommand
z += 3.0D;
}
Location safeLocation = Util.getSafeDestination(new Location(user.getWorld(), x, y, z));
boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
final Location safeLocation = Util.getSafeDestination(new Location(user.getWorld(), x, y, z));
final boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
if (success)
{
charge(user);