If the time of the prisoner on joining is 0, then unjail them. Also,
ignore the sleeping state if enabled in the config.
This commit is contained in:
parent
abb3e70bdf
commit
d691f1104b
@ -58,7 +58,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//If the config has recieve messages set to false, let's remove all the prisoners
|
//If the config has receive messages set to false, let's remove all the prisoners
|
||||||
//from getting the chat messages.
|
//from getting the chat messages.
|
||||||
if(!pl.getConfig().getBoolean(Settings.RECIEVEMESSAGES.getPath())) {
|
if(!pl.getConfig().getBoolean(Settings.RECIEVEMESSAGES.getPath())) {
|
||||||
if(pl.inDebug()) pl.getLogger().info("Debug - There are " + event.getRecipients().size() + " players getting the message before.");
|
if(pl.inDebug()) pl.getLogger().info("Debug - There are " + event.getRecipients().size() + " players getting the message before.");
|
||||||
@ -77,10 +77,23 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void checkForOfflineJail(PlayerJoinEvent event) {
|
public void checkForOfflineJailStuff(PlayerJoinEvent event) {
|
||||||
|
//Let's check if the player is jailed
|
||||||
if(pl.getJailManager().isPlayerJailed(event.getPlayer().getName())) {
|
if(pl.getJailManager().isPlayerJailed(event.getPlayer().getName())) {
|
||||||
if(pl.getJailManager().getJailPlayerIsIn(event.getPlayer().getName()).getPrisoner(event.getPlayer().getName()).isOfflinePending()) {
|
//Get the prisoner object
|
||||||
|
Prisoner p = pl.getJailManager().getJailPlayerIsIn(event.getPlayer().getName()).getPrisoner(event.getPlayer().getName());
|
||||||
|
//Check if they're offline pending, as if this is true then they were jailed offline
|
||||||
|
if(p.isOfflinePending()) {
|
||||||
|
//Proceed with jailing the prisoner
|
||||||
pl.getPrisonerManager().jailPrisoner(event.getPlayer().getName());
|
pl.getPrisonerManager().jailPrisoner(event.getPlayer().getName());
|
||||||
|
}else if(p.getRemainingTime() == 0L) {
|
||||||
|
//If their remaining time is 0, let's unjail them
|
||||||
|
pl.getPrisonerManager().releasePrisoner(event.getPlayer(), p);
|
||||||
|
}
|
||||||
|
|
||||||
|
//if we are ignoring a prisoner's sleeping state, then let's set that
|
||||||
|
if(pl.getConfig().getBoolean(Settings.IGNORESLEEPINGSTATE.getPath())) {
|
||||||
|
event.getPlayer().setSleepingIgnored(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user