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:
CreedTheFreak 2017-09-02 20:04:16 -07:00
parent 430f08b25f
commit 3512c4c8e6
2 changed files with 19 additions and 0 deletions

View File

@ -73,6 +73,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
godmode = _getGodModeEnabled(); godmode = _getGodModeEnabled();
muted = _getMuted(); muted = _getMuted();
muteTimeout = _getMuteTimeout(); muteTimeout = _getMuteTimeout();
muteReason = _getMuteReason ();
jailed = _getJailed(); jailed = _getJailed();
jailTimeout = _getJailTimeout(); jailTimeout = _getJailTimeout();
lastLogin = _getLastLogin(); lastLogin = _getLastLogin();
@ -491,6 +492,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
} }
private boolean muted; private boolean muted;
private String muteReason;
public boolean _getMuted() { public boolean _getMuted() {
return config.getBoolean("muted", false); return config.getBoolean("muted", false);
@ -510,6 +512,20 @@ public abstract class UserData extends PlayerExtension implements IConf {
config.save(); 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 muteTimeout;
private long _getMuteTimeout() { private long _getMuteTimeout() {

View File

@ -52,7 +52,9 @@ public class Commandmute extends EssentialsCommand {
if (args.length > 1) { if (args.length > 1) {
final String time = getFinalArg(args, 1); final String time = getFinalArg(args, 1);
muteTimestamp = DateUtil.parseDateDiff(time, true); muteTimestamp = DateUtil.parseDateDiff(time, true);
String muteReason = DateUtil.removeTimePattern (time);
user.setMuted(true); user.setMuted(true);
user.setMuteReason (muteReason);
} else { } else {
user.setMuted(!user.getMuted()); user.setMuted(!user.getMuted());
} }
@ -70,6 +72,7 @@ public class Commandmute extends EssentialsCommand {
user.sendMessage(tl("playerMutedFor", muteTime)); user.sendMessage(tl("playerMutedFor", muteTime));
} else { } else {
sender.sendMessage(tl("mutedPlayer", user.getDisplayName())); sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
/** Send the player a message, why they were muted **/
user.sendMessage(tl("playerMuted")); user.sendMessage(tl("playerMuted"));
} }
final String message; final String message;