If the time is 0, then send a different message.
This commit is contained in:
parent
4c13948549
commit
b005248deb
@ -30,6 +30,8 @@ public enum LangString {
|
||||
MUTED ("jailing"),
|
||||
/** The message sent to the prisoner when they try to do something but it is protected. */
|
||||
PROTECTIONMESSAGE ("jailing"),
|
||||
/** The message sent to the prisoner when they try to do something and it is protected, but no penalty. */
|
||||
PROTECTIONMESSAGENOPENALTY ("jailing"),
|
||||
/** The message sent when players are released from jail. */
|
||||
UNJAILED ("jailing"),
|
||||
|
||||
|
@ -43,11 +43,18 @@ public class ProtectionListener implements Listener {
|
||||
long add = Util.getTime(pl.getConfig().getString(Settings.BLOCKBREAKPENALTY.getPath()));
|
||||
pl.getJailManager().getPrisoner(event.getPlayer().getName()).addTime(add);
|
||||
|
||||
//Generate the protection message, provide the method with two arguments
|
||||
//First is the time in minutes and second is the thing we are protecting against
|
||||
String msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGE,
|
||||
new String[] { String.valueOf(TimeUnit.MINUTES.convert(add, TimeUnit.MILLISECONDS)),
|
||||
pl.getJailIO().getLanguageString(LangString.BLOCKBREAKING) });
|
||||
String msg = "";
|
||||
if(add == 0L) {
|
||||
//Generate the protection message, provide the method with one argument
|
||||
//which is the thing we are protecting against
|
||||
msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGENOPENALTY, pl.getJailIO().getLanguageString(LangString.BLOCKBREAKING));
|
||||
}else {
|
||||
//Generate the protection message, provide the method with two arguments
|
||||
//First is the time in minutes and second is the thing we are protecting against
|
||||
msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGE,
|
||||
new String[] { String.valueOf(TimeUnit.MINUTES.convert(add, TimeUnit.MILLISECONDS)),
|
||||
pl.getJailIO().getLanguageString(LangString.BLOCKBREAKING) });
|
||||
}
|
||||
|
||||
//Send the message
|
||||
event.getPlayer().sendMessage(msg);
|
||||
@ -82,11 +89,18 @@ public class ProtectionListener implements Listener {
|
||||
long add = Util.getTime(pl.getConfig().getString(Settings.BLOCKPLACEPENALTY.getPath()));
|
||||
pl.getJailManager().getPrisoner(event.getPlayer().getName()).addTime(add);
|
||||
|
||||
//Generate the protection message, provide the method with two arguments
|
||||
//First is the time in minutes and second is the thing we are protecting against
|
||||
String msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGE,
|
||||
new String[] { String.valueOf(TimeUnit.MINUTES.convert(add, TimeUnit.MILLISECONDS)),
|
||||
pl.getJailIO().getLanguageString(LangString.BLOCKPLACING) });
|
||||
String msg = "";
|
||||
if(add == 0L) {
|
||||
//Generate the protection message, provide the method with one argument
|
||||
//which is the thing we are protecting against
|
||||
msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGENOPENALTY, pl.getJailIO().getLanguageString(LangString.BLOCKPLACING));
|
||||
}else {
|
||||
//Generate the protection message, provide the method with two arguments
|
||||
//First is the time in minutes and second is the thing we are protecting against
|
||||
msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGE,
|
||||
new String[] { String.valueOf(TimeUnit.MINUTES.convert(add, TimeUnit.MILLISECONDS)),
|
||||
pl.getJailIO().getLanguageString(LangString.BLOCKPLACING) });
|
||||
}
|
||||
|
||||
//Send the message
|
||||
event.getPlayer().sendMessage(msg);
|
||||
@ -121,11 +135,18 @@ public class ProtectionListener implements Listener {
|
||||
long add = Util.getTime(pl.getConfig().getString(Settings.COMMANDPENALTY.getPath()));
|
||||
pl.getJailManager().getPrisoner(event.getPlayer().getName()).addTime(add);
|
||||
|
||||
//Generate the protection message, provide the method with two arguments
|
||||
//First is the time in minutes and second is the thing we are protecting against
|
||||
String msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGE,
|
||||
new String[] { String.valueOf(TimeUnit.MINUTES.convert(add, TimeUnit.MILLISECONDS)),
|
||||
pl.getJailIO().getLanguageString(LangString.COMMAND) });
|
||||
String msg = "";
|
||||
if(add == 0L) {
|
||||
//Generate the protection message, provide the method with one argument
|
||||
//which is the thing we are protecting against
|
||||
msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGENOPENALTY, pl.getJailIO().getLanguageString(LangString.COMMAND));
|
||||
}else {
|
||||
//Generate the protection message, provide the method with two arguments
|
||||
//First is the time in minutes and second is the thing we are protecting against
|
||||
msg = pl.getJailIO().getLanguageString(LangString.PROTECTIONMESSAGE,
|
||||
new String[] { String.valueOf(TimeUnit.MINUTES.convert(add, TimeUnit.MILLISECONDS)),
|
||||
pl.getJailIO().getLanguageString(LangString.COMMAND) });
|
||||
}
|
||||
|
||||
//Send the message
|
||||
event.getPlayer().sendMessage(msg);
|
||||
|
@ -18,6 +18,7 @@ language:
|
||||
jailedwithreason: '&cYou have been jailed for: %0%'
|
||||
muted: '&cStop talking, you are in jail.'
|
||||
protectionmessage: '&c%0% minutes has been added to your time for %1%.'
|
||||
protectionmessagenopenalty: '&cProtection enabled for %0%, do not do it again.'
|
||||
unjailed: '&2You have been released! Please respect the server rules.'
|
||||
handcuffing:
|
||||
cantbehandcuffed: '&9%0% &ccan not be handcuffed.'
|
||||
|
Loading…
Reference in New Issue
Block a user