From 6f7af904885ca19549018085f21297df25b6979d Mon Sep 17 00:00:00 2001 From: delbertina Date: Sun, 26 Nov 2017 00:55:05 -0600 Subject: [PATCH 1/4] Fixed easy style issues. --- .../src/com/earth2me/essentials/EssentialsPlayerListener.java | 2 +- Essentials/src/com/earth2me/essentials/UserData.java | 2 +- .../src/com/earth2me/essentials/commands/Commandmute.java | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 71eff6fb7..f06526a03 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -81,7 +81,7 @@ public class EssentialsPlayerListener implements Listener { if (user.isMuted()) { event.setCancelled(true); - if (user.getMuteReason ().equals ("")) { + if (user.getMuteReason().equals ("")) { user.sendMessage(tl("voiceSilenced")); } else { diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 16ed25386..6bcbcfa73 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -525,7 +525,7 @@ public abstract class UserData extends PlayerExtension implements IConf { } } - public void setMuteReason (String reason) { + public void setMuteReason(String reason) { if (reason.equals("")) { config.removeProperty ("muteReason"); muteReason = null; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index 13198d6ee..ce32908d6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -82,8 +82,7 @@ public class Commandmute extends EssentialsCommand { if (user.getMuteReason ().equals ("")) { sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime)); user.sendMessage(tl("playerMutedFor", muteTime)); - } - else { + } else { sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime) + tl("muteFormat",user.getMuteReason())); user.sendMessage(tl("playerMutedFor", muteTime) + tl("muteFormat",user.getMuteReason())); } From 43cbab37f06350c47399a2f35a3c5f55f9f2bfb0 Mon Sep 17 00:00:00 2001 From: delbertina Date: Sun, 26 Nov 2017 01:32:22 -0600 Subject: [PATCH 2/4] Changed muteFormat to muteReason. Removed space at beginning of muteReason. --- .../essentials/EssentialsPlayerListener.java | 2 +- .../com/earth2me/essentials/commands/Commandafk.java | 2 +- .../earth2me/essentials/commands/Commandmail.java | 2 +- .../com/earth2me/essentials/commands/Commandme.java | 2 +- .../earth2me/essentials/commands/Commandmute.java | 12 ++++++------ .../com/earth2me/essentials/commands/Commandr.java | 2 +- .../earth2me/essentials/commands/Commandseen.java | 2 +- .../earth2me/essentials/commands/Commandwhois.java | 2 +- Essentials/src/messages.properties | 3 +-- Essentials/src/messages_cs.properties | 2 +- Essentials/src/messages_da.properties | 2 +- Essentials/src/messages_de.properties | 2 +- Essentials/src/messages_en.properties | 2 +- Essentials/src/messages_es.properties | 2 +- Essentials/src/messages_et.properties | 2 +- Essentials/src/messages_fi.properties | 2 +- Essentials/src/messages_fr.properties | 2 +- Essentials/src/messages_hu.properties | 2 +- Essentials/src/messages_it.properties | 2 +- Essentials/src/messages_ko.properties | 2 +- Essentials/src/messages_lt.properties | 2 +- Essentials/src/messages_nl.properties | 2 +- Essentials/src/messages_pl.properties | 2 +- Essentials/src/messages_pt.properties | 2 +- Essentials/src/messages_pt_BR.properties | 2 +- Essentials/src/messages_ro.properties | 2 +- Essentials/src/messages_ru.properties | 2 +- Essentials/src/messages_sv.properties | 2 +- Essentials/src/messages_tr.properties | 2 +- Essentials/src/messages_zh.properties | 2 +- Essentials/src/messages_zh_HK.properties | 2 +- Essentials/src/messages_zh_TW.properties | 2 +- 32 files changed, 37 insertions(+), 38 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index f06526a03..3a6b5868b 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -85,7 +85,7 @@ public class EssentialsPlayerListener implements Listener { user.sendMessage(tl("voiceSilenced")); } else { - user.sendMessage(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ())); + user.sendMessage(tl("voiceSilenced") + tl("muteReason", user.getMuteReason ())); } LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java index c89478382..2d78628a3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java @@ -55,7 +55,7 @@ public class Commandafk extends EssentialsCommand { throw new Exception(tl("voiceSilenced")); } else { - throw new Exception(tl("voiceSilenced") + tl("muteFormat", sender.getMuteReason ())); + throw new Exception(tl("voiceSilenced") + tl("muteReason", sender.getMuteReason ())); } } if (!sender.isAuthorized("essentials.afk.message")) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index ead11b32c..b69568497 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -52,7 +52,7 @@ public class Commandmail extends EssentialsCommand { throw new Exception(tl("voiceSilenced")); } else { - throw new Exception(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ())); + throw new Exception(tl("voiceSilenced") + tl("muteReason", user.getMuteReason ())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandme.java b/Essentials/src/com/earth2me/essentials/commands/Commandme.java index 05baeb703..40796abf6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandme.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandme.java @@ -28,7 +28,7 @@ public class Commandme extends EssentialsCommand { throw new Exception(tl("voiceSilenced")); } else { - throw new Exception(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ())); + throw new Exception(tl("voiceSilenced") + tl("muteReason", user.getMuteReason ())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index ce32908d6..1fa988832 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -83,8 +83,8 @@ public class Commandmute extends EssentialsCommand { sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime)); user.sendMessage(tl("playerMutedFor", muteTime)); } else { - sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime) + tl("muteFormat",user.getMuteReason())); - user.sendMessage(tl("playerMutedFor", muteTime) + tl("muteFormat",user.getMuteReason())); + sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime) + tl("muteReason",user.getMuteReason())); + user.sendMessage(tl("playerMutedFor", muteTime) + tl("muteReason",user.getMuteReason())); } } else { if (user.getMuteReason ().equals ("")) { @@ -93,9 +93,9 @@ public class Commandmute extends EssentialsCommand { user.sendMessage(tl("playerMuted")); } else { - sender.sendMessage(tl("mutedPlayer", user.getDisplayName()) + tl("muteFormat",user.getMuteReason())); + sender.sendMessage(tl("mutedPlayer", user.getDisplayName()) + tl("muteReason",user.getMuteReason())); /** Send the player a message, why they were muted **/ - user.sendMessage(tl("playerMuted")+ tl("muteFormat",user.getMuteReason())); + user.sendMessage(tl("playerMuted")+ tl("muteReason",user.getMuteReason())); } } final String message; @@ -104,14 +104,14 @@ public class Commandmute extends EssentialsCommand { message = tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime); } else { - message = (tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime) + tl("muteFormat",user.getMuteReason())); + message = (tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime) + tl("muteReason",user.getMuteReason())); } } else { if (user.getMuteReason ().equals ("")) { message = tl("muteNotify", sender.getSender().getName(), user.getName()); } else { - message = (tl("muteNotify", sender.getSender().getName(), user.getName()) + tl("muteFormat",user.getMuteReason())); + message = (tl("muteNotify", sender.getSender().getName(), user.getName()) + tl("muteReason",user.getMuteReason())); } } server.getLogger().log(Level.INFO, message); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index 5030a7bc7..0542581d2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -32,7 +32,7 @@ public class Commandr extends EssentialsCommand { throw new Exception(tl("voiceSilenced")); } else { - throw new Exception(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ())); + throw new Exception(tl("voiceSilenced") + tl("muteReason", user.getMuteReason ())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index fec5e8d90..cbd83c2fb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -121,7 +121,7 @@ public class Commandseen extends EssentialsCommand { sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true")))); } else { - sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))) + tl("muteFormat", user.getMuteReason ())); + sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))) + tl("muteReason", user.getMuteReason ())); } } final String location = user.getGeoLocation(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index b09d1f1fc..1db31e831 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -60,7 +60,7 @@ public class Commandwhois extends EssentialsCommand { sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false")))); } else { - sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))+ tl("muteFormat", user.getMuteReason ()))); + sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))+ tl("muteReason", user.getMuteReason ()))); } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 504986cf9..c884c16ae 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -494,7 +494,6 @@ vanished=\u00a76You are now completely invisible to normal users, and hidden fro versionMismatch=\u00a74Version mismatch\! Please update {0} to the same version. versionMismatchAll=\u00a74Version mismatch\! Please update all Essentials jars to the same version. voiceSilenced=\u00a76Your voice has been silenced\! -muteFormat=\u00a74 Reason: {0} walking=walking warpDeleteError=\u00a74Problem deleting the warp file. warpList={0} @@ -598,4 +597,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 344e82e37..4d4a715dc 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 6510b318d..50bcd1586 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index e6eec16bf..0981405ef 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -587,4 +587,4 @@ createKitFailed=\u00a74Beim Erstellen des Kits ist ein Fehler aufgetreten {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Erstelltes Kit: \u00a7f{0}\n\u00a76Verz\u00F6gerung: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Kopiere Inhalte aus dem oben stehenden Link in deine config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 34dc0a248..ec7f1ee0f 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -588,4 +588,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 57e5b0d74..2f540d380 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Ocurrio un error durante la creacion del kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Kit creado: \u00a7f{0}\n\u00a76Tiempo de espera: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copia el contenido del link de arriba en tu archivo config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_et.properties b/Essentials/src/messages_et.properties index 3a1ec2b6d..3005dff0c 100644 --- a/Essentials/src/messages_et.properties +++ b/Essentials/src/messages_et.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 374f33b83..5ee25e926 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 9beb77962..cd8522c7d 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -597,4 +597,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_hu.properties b/Essentials/src/messages_hu.properties index 9579e19e0..24740bfde 100644 --- a/Essentials/src/messages_hu.properties +++ b/Essentials/src/messages_hu.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 86152cc8c..ee6050341 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -596,4 +596,4 @@ createKitFailed=\u00a74Si \u00E8 verificato un errore creando il kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Kit Creato: \u00a7f{0}\n\u00a76Attesa: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copia i contenuti nel link sopra nella tua config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_ko.properties b/Essentials/src/messages_ko.properties index 66dda06e5..78f171d6f 100644 --- a/Essentials/src/messages_ko.properties +++ b/Essentials/src/messages_ko.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_lt.properties b/Essentials/src/messages_lt.properties index 5232bb992..25857e235 100644 --- a/Essentials/src/messages_lt.properties +++ b/Essentials/src/messages_lt.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index b738c7750..8eb7f688f 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index e84e3087b..776391990 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index fed06e8c0..f1abc56d6 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -581,4 +581,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_pt_BR.properties b/Essentials/src/messages_pt_BR.properties index ed4221b97..8abca2790 100644 --- a/Essentials/src/messages_pt_BR.properties +++ b/Essentials/src/messages_pt_BR.properties @@ -581,4 +581,4 @@ createKitFailed=\u00a74Um erro ocorreu ao criar o kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Kit criado: \u00a7f{0}\n\u00a76Tempo: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copie o conte\u00FAdo do link acima para a config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_ro.properties b/Essentials/src/messages_ro.properties index 54e27e902..ab089939d 100644 --- a/Essentials/src/messages_ro.properties +++ b/Essentials/src/messages_ro.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_ru.properties b/Essentials/src/messages_ru.properties index 246608e6f..4a58a5ad6 100644 --- a/Essentials/src/messages_ru.properties +++ b/Essentials/src/messages_ru.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_sv.properties b/Essentials/src/messages_sv.properties index 12841c03f..187ec5926 100644 --- a/Essentials/src/messages_sv.properties +++ b/Essentials/src/messages_sv.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_tr.properties b/Essentials/src/messages_tr.properties index 3cfdd3b97..07ff2122c 100644 --- a/Essentials/src/messages_tr.properties +++ b/Essentials/src/messages_tr.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_zh.properties b/Essentials/src/messages_zh.properties index 6b19c7193..fb406c41c 100644 --- a/Essentials/src/messages_zh.properties +++ b/Essentials/src/messages_zh.properties @@ -596,4 +596,4 @@ createKitFailed=\u00a74\u521b\u5efa\u793c\u5305\u51fa\u9519 {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76\u521b\u5efa\u793c\u5305: \u00a7f{0}\n\u00a76\u4f7f\u7528\u6b21\u6570: \u00a7f{1}\n\u00a76\u4fe1\u606f: \u00a7f{2}\n\u00a76\u590d\u5236\u4e0b\u9762\u7684\u4fe1\u606f\u5230config\u91cc\u9762. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_zh_HK.properties b/Essentials/src/messages_zh_HK.properties index d85ca96a5..d0c84aed0 100644 --- a/Essentials/src/messages_zh_HK.properties +++ b/Essentials/src/messages_zh_HK.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} diff --git a/Essentials/src/messages_zh_TW.properties b/Essentials/src/messages_zh_TW.properties index 0408a8a3b..841f88286 100644 --- a/Essentials/src/messages_zh_TW.properties +++ b/Essentials/src/messages_zh_TW.properties @@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}. createKitSeparator=\u00a7m----------------------- createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml. whoisUuid=\u00a76 - UUID\:\u00a7r {0} -muteFormat=\u00a76 Reason: \u00a7c{0} +muteReason=\u00a76Reason: \u00a7c{0} From d555c1b081f5e6838b95eef2526028c7901adfa1 Mon Sep 17 00:00:00 2001 From: delbertina Date: Sat, 2 Dec 2017 19:46:46 -0600 Subject: [PATCH 3/4] Added method hasMuteReason in UserData. --- Essentials/src/com/earth2me/essentials/UserData.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 6bcbcfa73..85b98dcbb 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -536,6 +536,10 @@ public abstract class UserData extends PlayerExtension implements IConf { config.save(); } + public boolean hasMuteReason(){ + return getMuteReason().equals(""); + } + private long muteTimeout; private long _getMuteTimeout() { From 849b329213a541f14720bf1260ba8183d30c8c05 Mon Sep 17 00:00:00 2001 From: delbertina Date: Sat, 2 Dec 2017 20:35:44 -0600 Subject: [PATCH 4/4] Changed if else blocks to ternary operators. Not sure if way to avoid weird empty string usage. --- .../src/com/earth2me/essentials/commands/Commandafk.java | 8 ++------ .../src/com/earth2me/essentials/commands/Commandmail.java | 8 ++------ .../src/com/earth2me/essentials/commands/Commandme.java | 8 ++------ .../src/com/earth2me/essentials/commands/Commandr.java | 8 ++------ .../src/com/earth2me/essentials/commands/Commandseen.java | 8 ++------ .../com/earth2me/essentials/commands/Commandwhois.java | 8 ++------ 6 files changed, 12 insertions(+), 36 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java index 2d78628a3..0206dd00e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java @@ -51,12 +51,8 @@ public class Commandafk extends EssentialsCommand { private void toggleAfk(User sender, User user, String message) throws Exception { if (message != null && sender != null) { if (sender.isMuted()) { - if (sender.getMuteReason ().equals ("")) { - throw new Exception(tl("voiceSilenced")); - } - else { - throw new Exception(tl("voiceSilenced") + tl("muteReason", sender.getMuteReason ())); - } + throw new Exception(tl("voiceSilenced") + (sender.hasMuteReason() ? + tl("muteReason", sender.getMuteReason()) : "")); } if (!sender.isAuthorized("essentials.afk.message")) { throw new Exception(tl("noPermToAFKMessage")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index b69568497..5e4e5bbf3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -48,12 +48,8 @@ public class Commandmail extends EssentialsCommand { } if (user.isMuted()) { - if (user.getMuteReason ().equals ("")) { - throw new Exception(tl("voiceSilenced")); - } - else { - throw new Exception(tl("voiceSilenced") + tl("muteReason", user.getMuteReason ())); - } + throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ? + tl("muteReason", user.getMuteReason()) : "")); } User u = getPlayer(server, args[1], true, true); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandme.java b/Essentials/src/com/earth2me/essentials/commands/Commandme.java index 40796abf6..f41f09d0e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandme.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandme.java @@ -24,12 +24,8 @@ public class Commandme extends EssentialsCommand { @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { if (user.isMuted()) { - if (user.getMuteReason ().equals ("")) { - throw new Exception(tl("voiceSilenced")); - } - else { - throw new Exception(tl("voiceSilenced") + tl("muteReason", user.getMuteReason ())); - } + throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ? + tl("muteReason", user.getMuteReason()) : "")); } if (args.length < 1) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index 0542581d2..9b997ca1f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -28,12 +28,8 @@ public class Commandr extends EssentialsCommand { User user = ess.getUser(sender.getPlayer()); if (user.isMuted()) { - if (user.getMuteReason ().equals ("")) { - throw new Exception(tl("voiceSilenced")); - } - else { - throw new Exception(tl("voiceSilenced") + tl("muteReason", user.getMuteReason ())); - } + throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ? + tl("muteReason", user.getMuteReason()) : "")); } message = FormatUtil.formatMessage(user, "essentials.msg", message); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index cbd83c2fb..41a8f0501 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -117,12 +117,8 @@ public class Commandseen extends EssentialsCommand { sender.sendMessage(tl("whoisJail", (user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tl("true")))); } if (user.isMuted()) { - if (user.getMuteReason ().equals ("")) { - sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true")))); - } - else { - sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))) + tl("muteReason", user.getMuteReason ())); - } + throw new Exception(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))) + (user.hasMuteReason() ? + tl("muteReason", user.getMuteReason()) : "")); } final String location = user.getGeoLocation(); if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index 1db31e831..d9598f77c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -56,12 +56,8 @@ public class Commandwhois extends EssentialsCommand { sender.sendMessage(tl("whoisAFK", tl("false"))); } sender.sendMessage(tl("whoisJail", (user.isJailed() ? user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tl("true") : tl("false")))); - if (user.getMuteReason ().equals ("")) { - sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false")))); - } - else { - sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))+ tl("muteReason", user.getMuteReason ()))); - } + throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ? + tl("muteReason", user.getMuteReason()) : "")); } @Override