Added 8 new messages for "...Reason" versions of mute messages and implemented em.

This commit is contained in:
delbertina 2017-12-20 00:35:51 -06:00
parent 67d17472e0
commit db19788e21
8 changed files with 17 additions and 20 deletions

View File

@ -81,8 +81,7 @@ public class EssentialsPlayerListener implements Listener {
if (user.isMuted()) {
event.setCancelled(true);
user.sendMessage(tl("voiceSilenced") + (user.hasMuteReason() ?
(" " + tl("muteReason", user.getMuteReason())) : ""));
user.sendMessage(user.hasMuteReason() ? tl("voiceSilencedReason", user.getMuteReason()) : tl("voiceSilenced"));
LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage()));
}

View File

@ -51,8 +51,7 @@ public class Commandafk extends EssentialsCommand {
private void toggleAfk(User sender, User user, String message) throws Exception {
if (message != null && sender != null) {
if (sender.isMuted()) {
throw new Exception(tl("voiceSilenced") + (sender.hasMuteReason() ?
(" " + tl("muteReason", sender.getMuteReason())) : ""));
throw new Exception(sender.hasMuteReason() ? tl("voiceSilencedReason", sender.getMuteReason()) : tl("voiceSilenced"));
}
if (!sender.isAuthorized("essentials.afk.message")) {
throw new Exception(tl("noPermToAFKMessage"));

View File

@ -48,8 +48,7 @@ public class Commandmail extends EssentialsCommand {
}
if (user.isMuted()) {
throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ?
(" " + tl("muteReason", user.getMuteReason())) : ""));
throw new Exception(user.hasMuteReason() ? tl("voiceSilencedReason", user.getMuteReason()) : tl("voiceSilenced"));
}
User u = getPlayer(server, args[1], true, true);

View File

@ -24,8 +24,7 @@ public class Commandme extends EssentialsCommand {
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception {
if (user.isMuted()) {
throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ?
(" " + tl("muteReason", user.getMuteReason())) : ""));
throw new Exception(user.hasMuteReason() ? tl("voiceSilencedReason", user.getMuteReason()) : tl("voiceSilenced"));
}
if (args.length < 1) {

View File

@ -72,8 +72,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("muteReason",user.getMuteReason()));
user.sendMessage(tl("playerMutedFor", muteTime) + " " + tl("muteReason",user.getMuteReason()));
sender.sendMessage(tl("mutedPlayerForReason", user.getDisplayName(), muteTime, user.getMuteReason()));
user.sendMessage(tl("playerMutedForReason", muteTime, user.getMuteReason()));
}
} else {
if (user.getMuteReason ().equals ("")) {
@ -82,9 +82,9 @@ public class Commandmute extends EssentialsCommand {
user.sendMessage(tl("playerMuted"));
}
else {
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()) + " " + tl("muteReason",user.getMuteReason()));
sender.sendMessage(tl("mutedPlayerReason", user.getDisplayName(), user.getMuteReason()));
/** Send the player a message, why they were muted **/
user.sendMessage(tl("playerMuted") + " " + tl("muteReason",user.getMuteReason()));
user.sendMessage(tl("playerMutedReason", user.getMuteReason()));
}
}
final String message;
@ -93,14 +93,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("muteReason",user.getMuteReason()));
message = (tl("muteNotifyForReason", sender.getSender().getName(), user.getName(), muteTime, 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("muteReason",user.getMuteReason()));
message = (tl("muteNotifyReason", sender.getSender().getName(), user.getName(), user.getMuteReason()));
}
}
server.getLogger().log(Level.INFO, message);

View File

@ -28,8 +28,7 @@ public class Commandr extends EssentialsCommand {
User user = ess.getUser(sender.getPlayer());
if (user.isMuted()) {
throw new Exception(tl("voiceSilenced") + (user.hasMuteReason() ?
(" " + tl("muteReason", user.getMuteReason())) : ""));
throw new Exception(user.hasMuteReason() ? tl("voiceSilencedReason", user.getMuteReason()) : tl("voiceSilenced"));
}
message = FormatUtil.formatMessage(user, "essentials.msg", message);

View File

@ -117,8 +117,9 @@ public class Commandseen extends EssentialsCommand {
sender.sendMessage(tl("whoisJail", (user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tl("true"))));
}
if (user.isMuted()) {
sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))) + (user.hasMuteReason() ?
(" " + tl("muteReason", user.getMuteReason())) : ""));
sender.sendMessage(user.hasMuteReason() ? (tl("whoisMutedReason", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true")), user.getMuteReason())) :
tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))));
sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))));
}
final String location = user.getGeoLocation();
if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) {

View File

@ -56,8 +56,9 @@ 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"))));
sender.sendMessage(tl("whoisMuted") + (user.hasMuteReason() ?
(" " + tl("muteReason", user.getMuteReason())) : ""));
sender.sendMessage(user.hasMuteReason() ? tl("whoisMutedReason", (user.isMuted() ? user.getMuteTimeout() > 0 ?
DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false")),user.getMuteReason()) : tl("whoisMuted", (user.isMuted() ?
user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))));
}
@Override