1+ from twisted .internet import reactor
12from base_plugin import SimpleCommandPlugin , BasePlugin
23from core_plugins .player_manager import permissions , UserLevels
34from packets import chat_sent
@@ -10,7 +11,7 @@ class UserCommandPlugin(SimpleCommandPlugin):
1011 """
1112 name = "user_management_commands"
1213 depends = ['command_dispatcher' , 'player_manager' ]
13- commands = ["who" , "whois" , "promote" , "kick" , "ban" , "give_item" , "planet" , "mute" , "unmute" , "passthrough" ]
14+ commands = ["who" , "whois" , "promote" , "kick" , "ban" , "give_item" , "planet" , "mute" , "unmute" , "passthrough" , "shutdown" ]
1415 auto_activate = True
1516
1617 def activate (self ):
@@ -201,11 +202,17 @@ def unmute(self, data):
201202 target_protocol .send_chat_message ("You have been unmuted." )
202203 self .protocol .send_chat_message ("%s has been unmuted." % name )
203204
204- @permissions (UserLevels .OWNER )
205+ @permissions (UserLevels .ADMIN )
205206 def passthrough (self , data ):
206207 """Sets the server to passthrough mode. *This is irreversible without restart.* Syntax: /passthrough"""
207208 self .config .passthrough = True
208209
210+ @permissions (UserLevels .ADMIN )
211+ def shutdown (self , data ):
212+ """Shutdown the server in n seconds. Syntax: /shutdown [number of seconds] (>0)"""
213+ x = float (data [0 ])
214+ self .protocol .factory .broadcast ("SERVER ANNOUNCEMENT: Server is shutting down in %s seconds!" % data [0 ])
215+ reactor .callLater (x , reactor .stop )
209216
210217class MuteManager (BasePlugin ):
211218 name = "mute_manager"
0 commit comments