added messages for when server is expired
This commit is contained in:
parent
78d94320a8
commit
f4c5922b05
@ -27,13 +27,7 @@ public class KillButton implements IButton
|
||||
{
|
||||
if (clickType == clickType.SHIFT_RIGHT)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(other, C.cGold + C.Bold + "The host has closed this Mineplex Private Server.");
|
||||
other.playSound(other.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,44 @@ 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 (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