mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00: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
1518db17f8
commit
9378df0ff2
2 changed files with 19 additions and 0 deletions
|
@ -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();
|
||||
|
@ -492,6 +493,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
|||
}
|
||||
|
||||
private boolean muted;
|
||||
private String muteReason;
|
||||
|
||||
public boolean _getMuted() {
|
||||
return config.getBoolean("muted", false);
|
||||
|
@ -511,6 +513,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 a new issue