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 _createTime;
|
||||||
private long _serverTime;
|
private long _serverTime;
|
||||||
private boolean _joinable = false;
|
private boolean _joinable = false;
|
||||||
|
private boolean _ended = false;
|
||||||
|
|
||||||
private boolean xrayDebug = false;
|
private boolean xrayDebug = false;
|
||||||
|
|
||||||
@ -1123,7 +1124,7 @@ public class UHC extends TeamGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void setJoinable(UpdateEvent event)
|
public void returnToHub(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
@ -1145,25 +1146,23 @@ public class UHC extends TeamGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerJoinable(final PlayerJoinEvent event)
|
public void kickPlayers(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (!_joinable || GetState() != GameState.Recruit)
|
if (event.getType() != UpdateType.SEC)
|
||||||
{
|
return;
|
||||||
UtilPlayer.message(event.getPlayer(), " ");
|
|
||||||
UtilPlayer.message(event.getPlayer(), C.cGold + C.Bold + "This UHC game is not joinable yet!");
|
|
||||||
UtilPlayer.message(event.getPlayer(), " ");
|
|
||||||
|
|
||||||
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
|
UtilPlayer.message(player, " ");
|
||||||
public void run()
|
UtilPlayer.message(player, C.cGold + C.Bold + "This UHC game is closed!");
|
||||||
{
|
UtilPlayer.message(player, " ");
|
||||||
Manager.GetPortal().SendPlayerToServer(event.getPlayer(), "Lobby");
|
|
||||||
}
|
|
||||||
|
|
||||||
} , 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)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void returnToLobby(final GameStateChangeEvent event)
|
public void setEnded(final GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (!Manager.IsRewardItems())
|
if (!Manager.IsRewardItems())
|
||||||
return;
|
return;
|
||||||
@ -1232,15 +1231,7 @@ public class UHC extends TeamGame
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
for (Player player : UtilServer.getPlayers())
|
_ended = true;
|
||||||
{
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 360);
|
}, 360);
|
||||||
//Delay 18 Seconds
|
//Delay 18 Seconds
|
||||||
|
Loading…
Reference in New Issue
Block a user