Add isJailedForever to the prisoner & use it in pay

This commit is contained in:
graywolf336 2015-06-10 16:05:24 -05:00
parent e598b0c424
commit 4c7166251f
2 changed files with 9 additions and 4 deletions

View File

@ -15,7 +15,7 @@ import com.graywolf336.jail.enums.Lang;
* *
* @author graywolf336 * @author graywolf336
* @since 2.x.x * @since 2.x.x
* @version 3.1.0 * @version 3.1.1
*/ */
public class Prisoner { public class Prisoner {
private String uuid, name, jailer, reason, inventory, armor; private String uuid, name, jailer, reason, inventory, armor;
@ -226,6 +226,11 @@ public class Prisoner {
this.muted = muted; this.muted = muted;
this.changed = true; this.changed = true;
} }
/** Gets whether the prisoner is jailed forever or not. */
public boolean isJailedForever() {
return this.time == -1;
}
/** Gets the remaining time the prisoner has. */ /** Gets the remaining time the prisoner has. */
public long getRemainingTime() { public long getRemainingTime() {

View File

@ -139,13 +139,13 @@ public class JailPayCommand implements Command {
if(jm.isPlayerJailedByLastKnownUsername(args[2])) { if(jm.isPlayerJailedByLastKnownUsername(args[2])) {
Prisoner p = jm.getPrisonerByLastKnownName(args[2]); Prisoner p = jm.getPrisonerByLastKnownName(args[2]);
if(p.getRemainingTime() > 0) { if(p.isJailedForever()) {
if(!pm.isTimedEnabled()) { if(!pm.isInfiniteEnabled()) {
sender.sendMessage(Lang.PAYNOTENABLED.get()); sender.sendMessage(Lang.PAYNOTENABLED.get());
return true; return true;
} }
}else { }else {
if(!pm.isInfiniteEnabled()) { if(!pm.isTimedEnabled()) {
sender.sendMessage(Lang.PAYNOTENABLED.get()); sender.sendMessage(Lang.PAYNOTENABLED.get());
return true; return true;
} }