Simple way of stopping players from getting respawned outside the jail.
Something more complicated might be needed, but I will add that as the time arises.
This commit is contained in:
parent
1cfd64164c
commit
4e06336c99
@ -13,6 +13,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
|||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
|
||||||
import com.graywolf336.jail.JailMain;
|
import com.graywolf336.jail.JailMain;
|
||||||
import com.graywolf336.jail.JailManager;
|
import com.graywolf336.jail.JailManager;
|
||||||
@ -116,4 +117,17 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
|
if(pl.getJailManager().isPlayerJailed(event.getPlayer().getName())) {
|
||||||
|
Jail j = pl.getJailManager().getJailPlayerIsIn(event.getPlayer().getName());
|
||||||
|
|
||||||
|
if(j.isJailedInACell(event.getPlayer().getName())) {
|
||||||
|
event.setRespawnLocation(j.getCellPrisonerIsIn(event.getPlayer().getName()).getTeleport());
|
||||||
|
}else {
|
||||||
|
event.setRespawnLocation(j.getTeleportIn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user