From d674e65c1139707cf7f4be24e34809967f608937 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 4 Nov 2012 21:49:48 +0000 Subject: Allow the 'userIsNotAway' and 'userIsAway' translation messages to be empty. --- Essentials/src/com/earth2me/essentials/User.java | 16 ++++++++++++---- .../src/com/earth2me/essentials/commands/Commandafk.java | 9 +++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index f74e11f25..2aeeba0ac 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -70,8 +70,8 @@ public class User extends UserData implements Comparable, IReplyTo, IUser } return result; } - - private boolean isAuthorizedCheck(final String node) + + private boolean isAuthorizedCheck(final String node) { if (base instanceof OfflinePlayer) @@ -538,7 +538,11 @@ public class User extends UserData implements Comparable, IReplyTo, IUser if (broadcast && !isHidden()) { setDisplayNick(); - ess.broadcastMessage(this, _("userIsNotAway", getDisplayName())); + final String msg = _("userIsNotAway", getDisplayName()); + if (!msg.isEmpty()) + { + ess.broadcastMessage(this, msg); + } } } lastActivity = System.currentTimeMillis(); @@ -571,7 +575,11 @@ public class User extends UserData implements Comparable, IReplyTo, IUser if (!isHidden()) { setDisplayNick(); - ess.broadcastMessage(this, _("userIsAway", getDisplayName())); + final String msg = _("userIsAway", getDisplayName()); + if (!msg.isEmpty()) + { + ess.broadcastMessage(this, msg); + } } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java index c71883571..6a5d6dc26 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java @@ -32,12 +32,13 @@ public class Commandafk extends EssentialsCommand private void toggleAfk(User user) { user.setDisplayNick(); + String msg = ""; if (!user.toggleAfk()) { //user.sendMessage(_("markedAsNotAway")); if (!user.isHidden()) { - ess.broadcastMessage(user, _("userIsNotAway", user.getDisplayName())); + msg = _("userIsNotAway", user.getDisplayName()); } user.updateActivity(false); } @@ -46,8 +47,12 @@ public class Commandafk extends EssentialsCommand //user.sendMessage(_("markedAsAway")); if (!user.isHidden()) { - ess.broadcastMessage(user, _("userIsAway", user.getDisplayName())); + msg = _("userIsAway", user.getDisplayName()); } } + if (!msg.isEmpty()) + { + ess.broadcastMessage(user, msg); + } } } -- cgit v1.2.3