Merge pull request #10 from CreedTheFreak/commit_squashing

Final Implementation and the squasing of many commits
This commit is contained in:
Taylor 2017-09-17 16:55:14 -05:00 committed by GitHub
commit 1664da55a4
34 changed files with 141 additions and 16 deletions

View File

@ -80,7 +80,14 @@ public class EssentialsPlayerListener implements Listener {
final User user = ess.getUser(event.getPlayer());
if (user.isMuted()) {
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()));
}
try {

View File

@ -537,6 +537,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
setMuteTimeout(0);
sendMessage(tl("canTalkAgain"));
setMuted(false);
setMuteReason ("");
return true;
}
}

View File

@ -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();
@ -491,6 +492,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
}
private boolean muted;
private String muteReason;
public boolean _getMuted() {
return config.getBoolean("muted", false);
@ -510,6 +512,30 @@ public abstract class UserData extends PlayerExtension implements IConf {
config.save();
}
public String _getMuteReason() {
return config.getString("muteReason");
}
public String getMuteReason() {
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);
}
config.save();
}
private long muteTimeout;
private long _getMuteTimeout() {

View File

@ -51,7 +51,12 @@ public class Commandafk extends EssentialsCommand {
private void toggleAfk(User sender, User user, String message) throws Exception {
if (message != null && sender != null) {
if (sender.isMuted()) {
throw new Exception(tl("voiceSilenced"));
if (sender.getMuteReason ().equals ("")) {
throw new Exception(tl("voiceSilenced"));
}
else {
throw new Exception(tl("voiceSilenced") + tl("muteFormat", sender.getMuteReason ()));
}
}
if (!sender.isAuthorized("essentials.afk.message")) {
throw new Exception(tl("noPermToAFKMessage"));

View File

@ -48,7 +48,12 @@ public class Commandmail extends EssentialsCommand {
}
if (user.isMuted()) {
throw new Exception(tl("voiceSilenced"));
if (user.getMuteReason ().equals ("")) {
throw new Exception(tl("voiceSilenced"));
}
else {
throw new Exception(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ()));
}
}
User u = getPlayer(server, args[1], true, true);

View File

@ -24,7 +24,12 @@ public class Commandme extends EssentialsCommand {
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception {
if (user.isMuted()) {
throw new Exception(tl("voiceSilenced"));
if (user.getMuteReason ().equals ("")) {
throw new Exception(tl("voiceSilenced"));
}
else {
throw new Exception(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ()));
}
}
if (args.length < 1) {

View File

@ -50,11 +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);
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();
@ -66,17 +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()));
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);

View File

@ -28,7 +28,12 @@ public class Commandr extends EssentialsCommand {
User user = ess.getUser(sender.getPlayer());
if (user.isMuted()) {
throw new Exception(tl("voiceSilenced"));
if (user.getMuteReason ().equals ("")) {
throw new Exception(tl("voiceSilenced"));
}
else {
throw new Exception(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ()));
}
}
message = FormatUtil.formatMessage(user, "essentials.msg", message);

View File

@ -117,7 +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(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))));
if (user.getMuteReason ().equals ("")) {
sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))));
}
else {
sender.sendMessage(tl("whoisMuted", (user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true"))) + tl("muteFormat", user.getMuteReason ()));
}
}
final String location = user.getGeoLocation();
if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) {

View File

@ -56,8 +56,12 @@ 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(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))));
if (user.getMuteReason ().equals ("")) {
sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))));
}
else {
sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))+ tl("muteFormat", user.getMuteReason ())));
}
}
@Override

View File

@ -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.
versionMismatchAll=\u00a74Version mismatch\! Please update all Essentials jars to the same version.
voiceSilenced=\u00a76Your voice has been silenced\!
muteFormat=\u00a74 Reason: {0}
walking=walking
warpDeleteError=\u00a74Problem deleting the warp file.
warpList={0}
@ -597,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -587,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -588,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -597,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -596,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -581,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -581,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -596,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}

View File

@ -584,3 +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=\u00a76 Reason: \u00a7c{0}