We have added the ability for the Mute to contain a reason, which is stored for the duration of the mute in the user's data file. Currently we need to add in the mute reason code into some other commands such as /afk and /me and /seen ect. We will also need to fix a problem with the reason when we dont add in a time frame for the mute, which should mute the player indefinatly rather then cancelling the mute and throwing a DataFormat exception.

This commit is contained in:
CreedTheFreak 2017-09-03 14:41:32 -07:00
parent 3512c4c8e6
commit 4ff9fe8666
4 changed files with 16 additions and 3 deletions

View File

@ -80,7 +80,14 @@ public class EssentialsPlayerListener implements Listener {
final User user = ess.getUser(event.getPlayer());
if (user.isMuted()) {
event.setCancelled(true);
user.sendMessage(tl("voiceSilenced"));
if (user.getMuteReason ().equals ("")) {
user.sendMessage(tl("voiceSilenced"));
}
else {
user.sendMessage(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ()));
}
LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage()));
}
try {

View File

@ -537,6 +537,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
setMuteTimeout(0);
sendMessage(tl("canTalkAgain"));
setMuted(false);
setMuteReason ("");
return true;
}
}

View File

@ -521,8 +521,12 @@ public abstract class UserData extends PlayerExtension implements IConf {
}
public void setMuteReason (String reason) {
muteReason = reason;
config.setProperty ("muteReason", reason);
if (reason.equals("")) {
config.removeProperty ("muteReason");
} else {
muteReason = reason;
config.setProperty ("muteReason", reason);
}
config.save();
}

View File

@ -494,6 +494,7 @@ 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}