remove players from closed game, on update
This commit is contained in:
parent
961163c135
commit
a2df64787f
@ -91,6 +91,7 @@ public class UHC extends TeamGame
|
||||
private long _createTime;
|
||||
private long _serverTime;
|
||||
private boolean _joinable = false;
|
||||
private boolean _ended = false;
|
||||
|
||||
private boolean xrayDebug = false;
|
||||
|
||||
@ -1123,7 +1124,7 @@ public class UHC extends TeamGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void setJoinable(UpdateEvent event)
|
||||
public void returnToHub(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
@ -1145,25 +1146,23 @@ public class UHC extends TeamGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerJoinable(final PlayerJoinEvent event)
|
||||
public void kickPlayers(UpdateEvent event)
|
||||
{
|
||||
if (!_joinable || GetState() != GameState.Recruit)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), " ");
|
||||
UtilPlayer.message(event.getPlayer(), C.cGold + C.Bold + "This UHC game is not joinable yet!");
|
||||
UtilPlayer.message(event.getPlayer(), " ");
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
if (!_ended)
|
||||
if (_joinable)
|
||||
return;
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
|
||||
for (final Player player : UtilServer.getPlayers())
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Manager.GetPortal().SendPlayerToServer(event.getPlayer(), "Lobby");
|
||||
}
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "This UHC game is closed!");
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
} , 5);
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
Manager.GetPortal().SendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1220,7 +1219,7 @@ public class UHC extends TeamGame
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void returnToLobby(final GameStateChangeEvent event)
|
||||
public void setEnded(final GameStateChangeEvent event)
|
||||
{
|
||||
if (!Manager.IsRewardItems())
|
||||
return;
|
||||
@ -1232,15 +1231,7 @@ public class UHC extends TeamGame
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "This UHC game has ended!");
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
Manager.GetPortal().SendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
_ended = true;
|
||||
}
|
||||
}, 360);
|
||||
//Delay 18 Seconds
|
||||
|
Loading…
Reference in New Issue
Block a user