mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-10 10:28:22 +01:00
Started work on implementing the mute reason, and decided to write it to the UserData just like the Ban and TempBan reasons
This commit is contained in:
parent
430f08b25f
commit
3512c4c8e6
@ -73,6 +73,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
godmode = _getGodModeEnabled();
|
||||
muted = _getMuted();
|
||||
muteTimeout = _getMuteTimeout();
|
||||
muteReason = _getMuteReason ();
|
||||
jailed = _getJailed();
|
||||
jailTimeout = _getJailTimeout();
|
||||
lastLogin = _getLastLogin();
|
||||
@ -491,6 +492,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
}
|
||||
|
||||
private boolean muted;
|
||||
private String muteReason;
|
||||
|
||||
public boolean _getMuted() {
|
||||
return config.getBoolean("muted", false);
|
||||
@ -510,6 +512,20 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
config.save();
|
||||
}
|
||||
|
||||
public String _getMuteReason() {
|
||||
return config.getString("muteReason");
|
||||
}
|
||||
|
||||
public String getMuteReason() {
|
||||
return muteReason;
|
||||
}
|
||||
|
||||
public void setMuteReason (String reason) {
|
||||
muteReason = reason;
|
||||
config.setProperty ("muteReason", reason);
|
||||
config.save();
|
||||
}
|
||||
|
||||
private long muteTimeout;
|
||||
|
||||
private long _getMuteTimeout() {
|
||||
|
@ -52,7 +52,9 @@ public class Commandmute extends EssentialsCommand {
|
||||
if (args.length > 1) {
|
||||
final String time = getFinalArg(args, 1);
|
||||
muteTimestamp = DateUtil.parseDateDiff(time, true);
|
||||
String muteReason = DateUtil.removeTimePattern (time);
|
||||
user.setMuted(true);
|
||||
user.setMuteReason (muteReason);
|
||||
} else {
|
||||
user.setMuted(!user.getMuted());
|
||||
}
|
||||
@ -70,6 +72,7 @@ public class Commandmute extends EssentialsCommand {
|
||||
user.sendMessage(tl("playerMutedFor", muteTime));
|
||||
} else {
|
||||
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
|
||||
/** Send the player a message, why they were muted **/
|
||||
user.sendMessage(tl("playerMuted"));
|
||||
}
|
||||
final String message;
|
||||
|
Loading…
Reference in New Issue
Block a user