diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-06-16 13:53:46 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-06-16 13:53:46 +0100 |
commit | 14586716b15e91340db9c7282583ca41afa63044 (patch) | |
tree | 9ee9cf94f91a0c3a0119bf2c2d87cfa33e162880 | |
parent | 1a42284ed7b1a27a7bdcc0493f45efa7ea4f10e3 (diff) | |
download | Essentials-14586716b15e91340db9c7282583ca41afa63044.tar Essentials-14586716b15e91340db9c7282583ca41afa63044.tar.gz Essentials-14586716b15e91340db9c7282583ca41afa63044.tar.lz Essentials-14586716b15e91340db9c7282583ca41afa63044.tar.xz Essentials-14586716b15e91340db9c7282583ca41afa63044.zip |
Make /vanish follow the same rules as /fly, /god and /gamemode
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 13 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandvanish.java | 19 |
2 files changed, 18 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 06cf375a1..0598b57cf 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -636,11 +636,11 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser { return vanished; } - - public void toggleVanished() + + public void setVanished(final boolean set) { - vanished = !vanished; - if (vanished) + vanished = set; + if (set) { for (Player p : ess.getServer().getOnlinePlayers()) { @@ -662,4 +662,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser ess.getVanishedPlayers().remove(getName()); } } + + public void toggleVanished() + { + final boolean set = !vanished; + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java index 865940b30..c81a96912 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java @@ -19,27 +19,26 @@ public class Commandvanish extends EssentialsCommand if (args.length < 1) { user.toggleVanished(); - if (!user.isVanished()) + if (user.isVanished()) { - user.sendMessage(_("unvanished")); + user.sendMessage(_("vanished")); } else { - user.sendMessage(_("vanished")); + user.sendMessage(_("unvanished")); } } - if (args.length > 0) + else { - if (args[0].contains("on") && !user.isVanished()) + if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1")) { - user.toggleVanished(); - user.sendMessage(_("vanished")); + user.setVanished(true); } - if (args[0].contains("off") && user.isVanished()) + else { - user.toggleVanished(); - user.sendMessage(_("unvanished")); + user.setVanished(false); } + user.sendMessage(user.isVanished() ? _("vanished") : _("unvanished")); } } } |