New shutdown script, uses the system update timer packet, idk what easiest
:hutdown 120 for 2 minutes,
Code:
from com.rs2hd.event import Event
# event that runs after 'time' ms
# shuts down the server
class shutdownEvent(Event):
def __init__(self, time):
Event.__init__(self, time)
def execute(self):
World.getInstance().engine().setIsRunning(False)
Event.stop(self)
# shuts down the server gracefully
def command_shutdown(player, command):
if player.getRights() >= 2:
# sends the update packet
player.getActionSender().sendSystemUpdate(int(int(command[1])/0.6))
# register the shutdown event
World.getInstance().registerEvent(shutdownEvent(int(command[1])*1000))
just practicing python a bit as i never did anything in it
also make sure your system update packet loops through all players
Code:
public void sendSystemUpdate(int time) {
for(Player all : World.getInstance().getPlayerList())
all.getSession().write(new StaticPacketBuilder().setId(8).addLEShortA(time).toPacket());
}