mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-26 18:11:52 +01:00
Merge pull request #1 from CreedTheFreak/mute/jail_reason_issue#385
Mute reason issue#385
This commit is contained in:
commit
86315fed8d
@ -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);
|
||||||
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()));
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,24 @@ 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) {
|
||||||
|
if (reason.equals("")) {
|
||||||
|
config.removeProperty ("muteReason");
|
||||||
|
} else {
|
||||||
|
muteReason = reason;
|
||||||
|
config.setProperty ("muteReason", reason);
|
||||||
|
}
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
|
||||||
private long muteTimeout;
|
private long muteTimeout;
|
||||||
|
|
||||||
private long _getMuteTimeout() {
|
private long _getMuteTimeout() {
|
||||||
|
@ -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;
|
||||||
|
@ -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…
Reference in New Issue
Block a user