diff options
7 files changed, 48 insertions, 31 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 8e9345660..089d64536 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -118,12 +118,16 @@ public class Commandexp extends EssentialsCommand private void showMatch(final Server server, final CommandSender sender, final String match) throws NotEnoughArgumentsException
{
boolean foundUser = false;
- final List<Player> matchedPlayers = server.matchPlayer(match);
- for (Player matchPlayer : matchedPlayers)
+ final List<Player> matchedPlayers = server.matchPlayer(match);
+ for (Player matchPlayer : matchedPlayers)
{
+ final User player = ess.getUser(matchPlayer);
+ if (player.isHidden())
+ {
+ continue;
+ }
foundUser = true;
- final User target = ess.getUser(matchPlayer);
- showExp(sender, target);
+ showExp(sender, player);
}
if (!foundUser)
{
@@ -134,12 +138,16 @@ public class Commandexp extends EssentialsCommand private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException
{
boolean foundUser = false;
- final List<Player> matchedPlayers = server.matchPlayer(match);
- for (Player matchPlayer : matchedPlayers)
+ final List<Player> matchedPlayers = server.matchPlayer(match);
+ for (Player matchPlayer : matchedPlayers)
{
+ final User player = ess.getUser(matchPlayer);
+ if (player.isHidden())
+ {
+ continue;
+ }
foundUser = true;
- final User target = ess.getUser(matchPlayer);
- setExp(sender, target, amount, give);
+ setExp(sender, player, amount, give);
}
if (!foundUser)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index a611102c8..28313a814 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -45,6 +45,11 @@ public class Commandext extends EssentialsCommand final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { + final User player = ess.getUser(matchPlayer); + if (player.isHidden()) + { + continue; + } foundUser = true; matchPlayer.setFireTicks(0); sender.sendMessage(_("extinguishOthers", matchPlayer.getDisplayName())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java index b6efc27cf..0d8a43776 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -36,7 +36,8 @@ public class Commandfeed extends EssentialsCommand final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { - if (ess.getUser(matchPlayer).isHidden()) + final User player = ess.getUser(matchPlayer); + if (player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 85f3af7a1..5dbe09da7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -77,26 +77,26 @@ public class Commandgamemode extends EssentialsCommand user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); } - private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String player) throws NotEnoughArgumentsException + private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException { //TODO: TL this - if (player.trim().length() < 2 || gameMode == null) + if (name.trim().length() < 2 || gameMode == null) { throw new NotEnoughArgumentsException("You need to specify a valid player/mode."); } boolean foundUser = false; - final List<Player> matchedPlayers = server.matchPlayer(player); + final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { - final User user = ess.getUser(matchPlayer); - if (user.isHidden()) + final User player = ess.getUser(matchPlayer); + if (player.isHidden()) { continue; } foundUser = true; - user.setGameMode(gameMode); - sender.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); + player.setGameMode(gameMode); + sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); } if (!foundUser) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java index b26d5bdfd..a68b2eac9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java @@ -55,7 +55,8 @@ public class Commandheal extends EssentialsCommand final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { - if (ess.getUser(matchPlayer).isHidden()) + final User player = ess.getUser(matchPlayer); + if (player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index 70d4f6fdb..8af20e888 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -22,7 +22,7 @@ public class Commandpay extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - + //TODO: TL this. if (args[0].trim().length() < 2) { @@ -30,19 +30,19 @@ public class Commandpay extends EssentialsCommand } double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); - + boolean foundUser = false; - final List<Player> matchedPlayers = server.matchPlayer(args[0]); + final List<Player> matchedPlayers = server.matchPlayer(args[0]); for (Player matchPlayer : matchedPlayers) { - User u = ess.getUser(matchPlayer); - if (u.isHidden()) + User player = ess.getUser(matchPlayer); + if (player.isHidden()) { continue; } foundUser = true; - user.payUser(u, amount); - Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), u.getName(), new Trade(amount, ess), user.getLocation(), ess); + user.payUser(player, amount); + Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess); } if (!foundUser) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java index 4152d8e1f..97719fc08 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java @@ -53,7 +53,7 @@ public class Commandspeed extends EssentialsCommand return; } } - + if (isFly) { user.setFlySpeed(getRealMoveSpeed(speed, isFly, isBypass)); @@ -66,10 +66,10 @@ public class Commandspeed extends EssentialsCommand } } - private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String target) throws NotEnoughArgumentsException + private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String name) throws NotEnoughArgumentsException { boolean foundUser = false; - final List<Player> matchedPlayers = server.matchPlayer(target); + final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); @@ -94,17 +94,19 @@ public class Commandspeed extends EssentialsCommand throw new NotEnoughArgumentsException(_("playerNotFound")); } } - + private Boolean flyPermCheck(User user, boolean input) throws Exception { boolean canFly = user.isAuthorized("essentials.speed.fly"); boolean canWalk = user.isAuthorized("essentials.speed.walk"); - if (input && canFly || !input && canWalk || !canFly && !canWalk) { + if (input && canFly || !input && canWalk || !canFly && !canWalk) + { return input; } - else if (canWalk) { + else if (canWalk) + { return false; - } + } return true; } |