def unsetMaster(cn, args): '''@description Force release master from current master @usage @master''' if args != '': raise ExtraArgumentError() else: sbserver.setMaster(-1)
def masterCmd(cn, args): '''@description Claim master @usage @master''' if args != '': raise ExtraArgumentError() if currentAdmin() != None: raise StateError('Admin is present') if sbserver.playerPrivilege(cn) == 0: sbserver.setMaster(cn)
def onGiveMaster(cn, args): '''@description Give master to a client @usage cn @master''' if args == '': raise UsageError() return try: tcn = int(args) except TypeError: raise UsageError() return sbserver.playerMessage(cn, info('You have given master to %s') % sbserver.playerName(tcn)) sbserver.setMaster(tcn)
def setMaster(caller): """This command makes the caller the master of the server. This is denoted by the green color of the callers name. Also like with #admin it does not give the caller any powers beyond what the caller had before.""" if(caller[0]=="ingame"): return sbserver.setMaster(caller[1]) raise ServerError("You are not ingame.") return
def onAuthSuccess(cn, name): if currentAdmin() != None: sbserver.playerMessage(cn, error('Admin is present')) return sbserver.setMaster(cn)
def setMaster(caller): """Makes the caller the master of the server.""" if(caller[0]=="ingame"): return sbserver.setMaster(caller[1]) raise ServerError("You are not ingame.") return