mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-25 09:31:52 +01:00
Implemented the ability to add a reason while muting a
player. The form of the mute is /mute [Player] [Time] [Reason] or /mute [Player] [Reason] or /mute [Player] [Time] or /mute [Player]. These are the various forms of the mute command and acts exactly like the old command just with a reason. The final adjustments to the MuteReason
This commit is contained in:
commit
f8ea7f5e1f
@ -517,12 +517,18 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
}
|
||||
|
||||
public String getMuteReason() {
|
||||
return muteReason;
|
||||
if (muteReason != null) {
|
||||
return muteReason;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setMuteReason (String reason) {
|
||||
if (reason.equals("")) {
|
||||
config.removeProperty ("muteReason");
|
||||
muteReason = null;
|
||||
} else {
|
||||
muteReason = reason;
|
||||
config.setProperty ("muteReason", reason);
|
||||
|
@ -50,13 +50,24 @@ public class Commandmute extends EssentialsCommand {
|
||||
long muteTimestamp = 0;
|
||||
|
||||
if (args.length > 1) {
|
||||
final String time = getFinalArg(args, 1);
|
||||
muteTimestamp = DateUtil.parseDateDiff(time, true);
|
||||
String muteReason = DateUtil.removeTimePattern (time);
|
||||
user.setMuted(true);
|
||||
final String time = args[1];
|
||||
String muteReason;
|
||||
try {
|
||||
muteTimestamp = DateUtil.parseDateDiff(time, true);
|
||||
muteReason = getFinalArg (args, 2);
|
||||
} catch (Exception e) {
|
||||
user.setMuted ((!user.getMuted ()));
|
||||
muteReason = getFinalArg (args, 1);
|
||||
}
|
||||
|
||||
user.setMuteReason (muteReason);
|
||||
user.setMuted(true);
|
||||
|
||||
} else {
|
||||
user.setMuted(!user.getMuted());
|
||||
if (!user.getMuted ()) {
|
||||
user.setMuteReason ("");
|
||||
}
|
||||
}
|
||||
user.setMuteTimeout(muteTimestamp);
|
||||
final boolean muted = user.getMuted();
|
||||
@ -68,18 +79,41 @@ public class Commandmute extends EssentialsCommand {
|
||||
|
||||
if (muted) {
|
||||
if (muteTimestamp > 0) {
|
||||
sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime));
|
||||
user.sendMessage(tl("playerMutedFor", muteTime));
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime));
|
||||
user.sendMessage(tl("playerMutedFor", muteTime));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(tl("mutedPlayerFor", user.getDisplayName(), muteTime) + tl("muteFormat",user.getMuteReason()));
|
||||
user.sendMessage(tl("playerMutedFor", muteTime) + tl("muteFormat",user.getMuteReason()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
|
||||
/** Send the player a message, why they were muted **/
|
||||
user.sendMessage(tl("playerMuted"));
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
|
||||
/** Send the player a message, why they were muted **/
|
||||
user.sendMessage(tl("playerMuted"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()) + tl("muteFormat",user.getMuteReason()));
|
||||
/** Send the player a message, why they were muted **/
|
||||
user.sendMessage(tl("playerMuted")+ tl("muteFormat",user.getMuteReason()));
|
||||
}
|
||||
}
|
||||
final String message;
|
||||
if (muteTimestamp > 0) {
|
||||
message = tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime);
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
message = tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime);
|
||||
}
|
||||
else {
|
||||
message = (tl("muteNotifyFor", sender.getSender().getName(), user.getName(), muteTime) + tl("muteFormat",user.getMuteReason()));
|
||||
}
|
||||
} else {
|
||||
message = tl("muteNotify", sender.getSender().getName(), user.getName());
|
||||
if (user.getMuteReason ().equals ("")) {
|
||||
message = tl("muteNotify", sender.getSender().getName(), user.getName());
|
||||
}
|
||||
else {
|
||||
message = (tl("muteNotify", sender.getSender().getName(), user.getName()) + tl("muteFormat",user.getMuteReason()));
|
||||
}
|
||||
}
|
||||
server.getLogger().log(Level.INFO, message);
|
||||
ess.broadcastMessage("essentials.mute.notify", message);
|
||||
|
@ -598,4 +598,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -587,4 +587,4 @@ createKitFailed=\u00a74Beim Erstellen des Kits ist ein Fehler aufgetreten {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Erstelltes Kit: \u00a7f{0}\n\u00a76Verz\u00F6gerung: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Kopiere Inhalte aus dem oben stehenden Link in deine config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -588,4 +588,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Ocurrio un error durante la creacion del kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Kit creado: \u00a7f{0}\n\u00a76Tiempo de espera: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copia el contenido del link de arriba en tu archivo config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -597,4 +597,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -596,4 +596,4 @@ createKitFailed=\u00a74Si \u00E8 verificato un errore creando il kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Kit Creato: \u00a7f{0}\n\u00a76Attesa: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copia i contenuti nel link sopra nella tua config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -581,4 +581,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -581,4 +581,4 @@ createKitFailed=\u00a74Um erro ocorreu ao criar o kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Kit criado: \u00a7f{0}\n\u00a76Tempo: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copie o conte\u00FAdo do link acima para a config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -596,4 +596,4 @@ createKitFailed=\u00a74\u521b\u5efa\u793c\u5305\u51fa\u9519 {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76\u521b\u5efa\u793c\u5305: \u00a7f{0}\n\u00a76\u4f7f\u7528\u6b21\u6570: \u00a7f{1}\n\u00a76\u4fe1\u606f: \u00a7f{2}\n\u00a76\u590d\u5236\u4e0b\u9762\u7684\u4fe1\u606f\u5230config\u91cc\u9762.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
@ -584,4 +584,4 @@ createKitFailed=\u00a74Error occurred whilst creating kit {0}.
|
||||
createKitSeparator=\u00a7m-----------------------
|
||||
createKitSuccess=\u00a76Created Kit: \u00a7f{0}\n\u00a76Delay: \u00a7f{1}\n\u00a76Link: \u00a7f{2}\n\u00a76Copy contents in the link above into your config.yml.
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
muteFormat=\u00a74 Reason: {0}
|
||||
muteFormat=\u00a76 Reason: \u00a7c{0}
|
||||
|
Loading…
Reference in New Issue
Block a user