Merge pull request #12 from delbertina/mutes385

Address requested changes to formatting and logic
This commit is contained in:
CreedTheFreak 2017-12-16 19:40:27 -08:00 committed by GitHub
commit bcd66fec39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 50 additions and 72 deletions

View File

@ -81,11 +81,11 @@ public class EssentialsPlayerListener implements Listener {
if (user.isMuted()) {
event.setCancelled(true);
if (user.getMuteReason ().equals ("")) {
if (user.getMuteReason().equals ("")) {
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()));

View File

@ -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;
@ -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() {

View File

@ -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("muteFormat", sender.getMuteReason ()));
}
throw new Exception(tl("voiceSilenced") + (sender.hasMuteReason() ?
tl("muteReason", sender.getMuteReason()) : ""));
}
if (!sender.isAuthorized("essentials.afk.message")) {
throw new Exception(tl("noPermToAFKMessage"));

View File

@ -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("muteFormat", user.getMuteReason ()));
}
throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ?
tl("muteReason", user.getMuteReason()) : ""));
}
User u = getPlayer(server, args[1], true, true);

View File

@ -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("muteFormat", user.getMuteReason ()));
}
throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ?
tl("muteReason", user.getMuteReason()) : ""));
}
if (args.length < 1) {

View File

@ -82,10 +82,9 @@ public class Commandmute extends EssentialsCommand {
if (user.getMuteReason ().equals ("")) {
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()));
} else {
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 ("")) {
@ -94,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;
@ -105,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);

View File

@ -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("muteFormat", user.getMuteReason ()));
}
throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ?
tl("muteReason", user.getMuteReason()) : ""));
}
message = FormatUtil.formatMessage(user, "essentials.msg", message);

View File

@ -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("muteFormat", 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"))) {

View File

@ -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("muteFormat", user.getMuteReason ())));
}
throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ?
tl("muteReason", user.getMuteReason()) : ""));
}
@Override

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}