mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 12:33:03 +00:00
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:
parent
3512c4c8e6
commit
4ff9fe8666
4 changed files with 16 additions and 3 deletions
|
@ -80,7 +80,14 @@ public class EssentialsPlayerListener implements Listener {
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
if (user.isMuted()) {
|
if (user.isMuted()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (user.getMuteReason ().equals ("")) {
|
||||||
user.sendMessage(tl("voiceSilenced"));
|
user.sendMessage(tl("voiceSilenced"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
user.sendMessage(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ()));
|
||||||
|
}
|
||||||
|
|
||||||
LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage()));
|
LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage()));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -537,6 +537,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||||
setMuteTimeout(0);
|
setMuteTimeout(0);
|
||||||
sendMessage(tl("canTalkAgain"));
|
sendMessage(tl("canTalkAgain"));
|
||||||
setMuted(false);
|
setMuted(false);
|
||||||
|
setMuteReason ("");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,8 +521,12 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMuteReason (String reason) {
|
public void setMuteReason (String reason) {
|
||||||
|
if (reason.equals("")) {
|
||||||
|
config.removeProperty ("muteReason");
|
||||||
|
} else {
|
||||||
muteReason = reason;
|
muteReason = reason;
|
||||||
config.setProperty ("muteReason", reason);
|
config.setProperty ("muteReason", reason);
|
||||||
|
}
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
versionMismatch=\u00a74Version mismatch\! Please update {0} to the same version.
|
||||||
versionMismatchAll=\u00a74Version mismatch\! Please update all Essentials jars to the same version.
|
versionMismatchAll=\u00a74Version mismatch\! Please update all Essentials jars to the same version.
|
||||||
voiceSilenced=\u00a76Your voice has been silenced\!
|
voiceSilenced=\u00a76Your voice has been silenced\!
|
||||||
|
muteFormat=\u00a74 Reason: {0}
|
||||||
walking=walking
|
walking=walking
|
||||||
warpDeleteError=\u00a74Problem deleting the warp file.
|
warpDeleteError=\u00a74Problem deleting the warp file.
|
||||||
warpList={0}
|
warpList={0}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue