@EventHandler
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
Player p = event.getPlayer();
ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
// Is the current player playing
if(am.isInArena(p)) {
ArenaPlayer ap = am.getPlayer(p);
// Is the player in the lobby of the arena
if(ap.isInLobby()) {
// Has the player a arena spawn assigned
if(ap.hasAssignedAreanSpawn()) {
// Cancel the event and send a status message
event.setCancelled(true);
p.sendMessage(ChatColor.DARK_RED + "You aren't tired enough to enter the bed inside the lobby of an arena!");
}
}
// The player may not sleep
if(ap.isPlaying()) {
event.setCancelled(true);
p.sendMessage(ChatColor.DARK_RED + "You can't sleep while in the arena!");
}
// Is the player an spectators
if(ap.isSpectator()) {
event.setCancelled(true);
ap.sendMessage(ChatColor.DARK_RED + "You can't sleep while spectating!");
}
}
}
SSGPlayerListener.java 文件源码
java
阅读 38
收藏 0
点赞 0
评论 0
项目:simple-survival-games
作者:
评论列表
文章目录