Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d40b154902
@ -27,13 +27,7 @@ public class KillButton implements IButton
|
||||
{
|
||||
if (clickType == clickType.SHIFT_RIGHT)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "The host has closed this Mineplex Private Server.");
|
||||
other.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
_arcade.GetPortal().SendPlayerToServer(other, "Lobby");
|
||||
}
|
||||
_manager.setHostExpired(true);
|
||||
_manager.setHostExpired(true, "The host has closed this Mineplex Private Server.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,16 +158,47 @@ public class GameHostManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void updateHostExpired(UpdateEvent event)
|
||||
{
|
||||
if (!isPrivateServer())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() != null && Manager.GetGame().GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (_hostExpired)
|
||||
return;
|
||||
|
||||
if (UtilTime.elapsed(_lastOnline, _expireTime))
|
||||
setHostExpired(true, Manager.GetServerConfig().HostName + " has abandoned the server. Thanks for playing!");
|
||||
|
||||
else if (UtilTime.elapsed(_serverStartTime, _serverExpireTime))
|
||||
setHostExpired(true, "This server has expired! Thank you for playing!");
|
||||
}
|
||||
|
||||
|
||||
public boolean isHostExpired()
|
||||
{
|
||||
if (Manager.GetHost() == null || Manager.GetHost().length() == 0)
|
||||
if (!isPrivateServer())
|
||||
return false;
|
||||
|
||||
return _hostExpired || UtilTime.elapsed(_lastOnline, _expireTime) || UtilTime.elapsed(_serverStartTime, _serverExpireTime);
|
||||
return _hostExpired;
|
||||
}
|
||||
|
||||
public void setHostExpired(boolean expired)
|
||||
public void setHostExpired(boolean expired, String string)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(other, C.cGold + C.Bold + string);
|
||||
other.playSound(other.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
Manager.GetPortal().SendPlayerToServer(other, "Lobby");
|
||||
}
|
||||
|
||||
_hostExpired = expired;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user