mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-25 09:31:52 +01:00
Merge branch 'mute_reason_changes' into final_mute_reason_issue#385
Updating local changes made on mute_reason_changes into the final branch
This commit is contained in:
commit
3444c8b0d6
@ -538,7 +538,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
setMuteTimeout(0);
|
||||
sendMessage(tl("canTalkAgain"));
|
||||
setMuted(false);
|
||||
setMuteReason ("");
|
||||
setMuteReason(null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
godmode = _getGodModeEnabled();
|
||||
muted = _getMuted();
|
||||
muteTimeout = _getMuteTimeout();
|
||||
muteReason = _getMuteReason ();
|
||||
muteReason = _getMuteReason();
|
||||
jailed = _getJailed();
|
||||
jailTimeout = _getJailTimeout();
|
||||
lastLogin = _getLastLogin();
|
||||
@ -518,27 +518,22 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
}
|
||||
|
||||
public String getMuteReason() {
|
||||
if (muteReason != null) {
|
||||
return muteReason;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
return muteReason;
|
||||
}
|
||||
|
||||
public void setMuteReason(String reason) {
|
||||
if (reason.equals("")) {
|
||||
config.removeProperty ("muteReason");
|
||||
if (reason == null) {
|
||||
config.removeProperty("muteReason");
|
||||
muteReason = null;
|
||||
} else {
|
||||
muteReason = reason;
|
||||
config.setProperty ("muteReason", reason);
|
||||
config.setProperty("muteReason", reason);
|
||||
}
|
||||
config.save();
|
||||
}
|
||||
|
||||
public boolean hasMuteReason(){
|
||||
return !getMuteReason().equals("");
|
||||
return muteReason != null;
|
||||
}
|
||||
|
||||
private long muteTimeout;
|
||||
|
@ -54,19 +54,19 @@ public class Commandmute extends EssentialsCommand {
|
||||
String muteReason;
|
||||
try {
|
||||
muteTimestamp = DateUtil.parseDateDiff(time, true);
|
||||
muteReason = getFinalArg (args, 2);
|
||||
muteReason = getFinalArg(args, 2);
|
||||
} catch (Exception e) {
|
||||
user.setMuted ((!user.getMuted ()));
|
||||
muteReason = getFinalArg (args, 1);
|
||||
user.setMuted((!user.getMuted()));
|
||||
muteReason = getFinalArg(args, 1);
|
||||
}
|
||||
|
||||
user.setMuteReason (muteReason);
|
||||
user.setMuteReason(muteReason.isEmpty() ? null : muteReason);
|
||||
user.setMuted(true);
|
||||
|
||||
} else {
|
||||
user.setMuted(!user.getMuted());
|
||||
if (!user.getMuted ()) {
|
||||
user.setMuteReason ("");
|
||||
if (!user.getMuted()) {
|
||||
user.setMuteReason(null);
|
||||
}
|
||||
}
|
||||
user.setMuteTimeout(muteTimestamp);
|
||||
@ -79,7 +79,7 @@ public class Commandmute extends EssentialsCommand {
|
||||
|
||||
if (muted) {
|
||||
if (muteTimestamp > 0) {
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
if (!user.hasMuteReason()) {
|
||||
sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime));
|
||||
user.sendMessage(tl("playerMutedFor", muteTime));
|
||||
} else {
|
||||
@ -87,31 +87,26 @@ public class Commandmute extends EssentialsCommand {
|
||||
user.sendMessage(tl("playerMutedForReason", muteTime, user.getMuteReason()));
|
||||
}
|
||||
} else {
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
if (!user.hasMuteReason()) {
|
||||
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
|
||||
/** Send the player a message, why they were muted **/
|
||||
user.sendMessage(tl("playerMuted"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(tl("mutedPlayerReason", user.getDisplayName(), user.getMuteReason()));
|
||||
/** Send the player a message, why they were muted **/
|
||||
user.sendMessage(tl("playerMutedReason", user.getMuteReason()));
|
||||
}
|
||||
}
|
||||
final String message;
|
||||
if (muteTimestamp > 0) {
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
if (!user.hasMuteReason()) {
|
||||
message = tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime);
|
||||
}
|
||||
else {
|
||||
message = (tl("muteNotifyForReason", sender.getSender().getName(), user.getName(), muteTime, user.getMuteReason()));
|
||||
} else {
|
||||
message = tl("muteNotifyForReason", sender.getSender().getName(), user.getName(), muteTime, user.getMuteReason());
|
||||
}
|
||||
} else {
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
if (!user.hasMuteReason()) {
|
||||
message = tl("muteNotify", sender.getSender().getName(), user.getName());
|
||||
}
|
||||
else {
|
||||
message = (tl("muteNotifyReason", sender.getSender().getName(), user.getName(), user.getMuteReason()));
|
||||
} else {
|
||||
message = tl("muteNotifyReason", sender.getSender().getName(), user.getName(), user.getMuteReason());
|
||||
}
|
||||
}
|
||||
server.getLogger().log(Level.INFO, message);
|
||||
|
@ -117,8 +117,12 @@ public class Commandseen extends EssentialsCommand {
|
||||
sender.sendMessage(tl("whoisJail", (user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tl("true"))));
|
||||
}
|
||||
if (user.isMuted()) {
|
||||
sender.sendMessage(user.hasMuteReason() ? (tl("whoisMutedReason", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true")), user.getMuteReason())) :
|
||||
tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))));
|
||||
long muteTimeout = user.getMuteTimeout();
|
||||
if (!user.hasMuteReason()) {
|
||||
sender.sendMessage(tl("whoisMuted", (muteTimeout > 0 ? DateUtil.formatDateDiff(muteTimeout) : tl("true"))));
|
||||
} else {
|
||||
sender.sendMessage(tl("whoisMutedReason", (muteTimeout > 0 ? DateUtil.formatDateDiff(muteTimeout) : tl("true")), user.getMuteReason()));
|
||||
}
|
||||
}
|
||||
final String location = user.getGeoLocation();
|
||||
if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) {
|
||||
@ -160,6 +164,15 @@ public class Commandseen extends EssentialsCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (user.isMuted()) {
|
||||
long muteTimeout = user.getMuteTimeout();
|
||||
if (!user.hasMuteReason()) {
|
||||
sender.sendMessage(tl("whoisMuted", (muteTimeout > 0 ? DateUtil.formatDateDiff(muteTimeout) : tl("true"))));
|
||||
} else {
|
||||
sender.sendMessage(tl("whoisMutedReason", (muteTimeout > 0 ? DateUtil.formatDateDiff(muteTimeout) : tl("true")), user.getMuteReason()));
|
||||
}
|
||||
}
|
||||
|
||||
final String location = user.getGeoLocation();
|
||||
if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) {
|
||||
sender.sendMessage(tl("whoisGeoLocation", location));
|
||||
|
@ -56,9 +56,14 @@ public class Commandwhois extends EssentialsCommand {
|
||||
sender.sendMessage(tl("whoisAFK", tl("false")));
|
||||
}
|
||||
sender.sendMessage(tl("whoisJail", (user.isJailed() ? user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tl("true") : tl("false"))));
|
||||
sender.sendMessage(user.hasMuteReason() ? tl("whoisMutedReason", (user.isMuted() ? user.getMuteTimeout() > 0 ?
|
||||
DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false")),user.getMuteReason()) : tl("whoisMuted", (user.isMuted() ?
|
||||
user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))));
|
||||
|
||||
long muteTimeout = user.getMuteTimeout();
|
||||
if (!user.hasMuteReason()) {
|
||||
sender.sendMessage(tl("whoisMuted", (user.isMuted() ? (muteTimeout > 0 ? DateUtil.formatDateDiff(muteTimeout) : tl("true")) : tl("false"))));
|
||||
} else {
|
||||
sender.sendMessage(tl("whoisMutedReason", (user.isMuted() ? (muteTimeout > 0 ? DateUtil.formatDateDiff(muteTimeout) : tl("true")) : tl("false")),
|
||||
user.getMuteReason()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user