Skip to content

Commit

Permalink
Renamed @command to @commandHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
greghaynes committed Nov 14, 2009
1 parent a8ba6f2 commit b17cb00
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/pyscripts/Bans/bans.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from xsbs.colors import red, colordict
from xsbs.ui import insufficientPermissions, error, info
from xsbs.db import dbmanager
from xsbs.commands import command
from xsbs.commands import commandHandler
from xsbs.events import triggerServerEvent, registerServerEventHandler, registerPolicyEventHandler, execLater
from UserPrivilege.userpriv import masterRequired
from xsbs.net import ipLongToString, ipStringToLong
Expand Down Expand Up @@ -124,7 +124,7 @@ def onBanCmd(cn, text):
except (ValueError, KeyError):
sbserver.playerMessage(cn, error('Usage: #ban <cn> (duration) (reason)'))

@command('recentbans')
@commandHandler('recentbans')
@masterRequired
def onRecentBans(cn, args):
if args != '':
Expand All @@ -142,14 +142,14 @@ def allowClient(cn, pwd):
def onKick(cn, tcn):
ban(tcn, 14500, 'Unspecified reason', cn)

@command('kick')
@commandHandler('kick')
@masterRequired
def onKickCommand(cn, args):
tcn = int(args)
sbserver.message(info(kick_message.substitute(colordict, name=sbserver.playerName(tcn))))
sbserver.playerKick(tcn)

@command('insertban')
@commandHandler('insertban')
@masterRequired
def onInsertBan(cn, args):
args = args.split(' ')
Expand All @@ -168,7 +168,7 @@ def onInsertBan(cn, args):
session.commit()
sbserver.playerMessage(cn, info('Inserted ban for %s for %i seconds for %s.' % (ipLongToString(ip), length, reason)))

@command('banname')
@commandHandler('banname')
@masterRequired
def onBanName(cn, args):
'''@description Ban name from the server'''
Expand All @@ -195,7 +195,7 @@ def reqClearBans(cn):
clearBans()
sbserver.message(info('Bans cleared'))

@command('clearbans')
@commandHandler('clearbans')
@masterRequired
def onClearBansCmd(cn, args):
clearBans()
Expand Down
10 changes: 5 additions & 5 deletions src/pyscripts/Mute/mute.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from xsbs.events import registerPolicyEventHandler, registerServerEventHandler
from xsbs.players import player
from xsbs.settings import PluginConfig
from xsbs.commands import command
from xsbs.commands import commandHandler
from UserPrivilege.userpriv import masterRequired
import string

Expand All @@ -29,7 +29,7 @@ def allowMsg(cn, text):
pass
return True

@command('mutespectators')
@commandHandler('mutespectators')
@masterRequired
def onMuteSpectatorsCmd(cn, args):
if args == '':
Expand All @@ -41,7 +41,7 @@ def onMuteSpectatorsCmd(cn, args):
else:
player(cn).message(error('Usage: #mutespectators'))

@command('unmutespectators')
@commandHandler('unmutespectators')
@masterRequired
def onUnMuteSpectatorsCmd(cn, args):
if args == '':
Expand All @@ -53,7 +53,7 @@ def onUnMuteSpectatorsCmd(cn, args):
else:
player(cn).message(error('Usage: #unmutespectators'))

@command('mute')
@commandHandler('mute')
@masterRequired
def onMuteCommand(cn, args):
try:
Expand All @@ -79,7 +79,7 @@ def onMuteCommand(cn, args):
except KeyError:
sbserver.playerMessage(cn, error('Usage: #mute <cn>'))

@command('unmute')
@commandHandler('unmute')
@masterRequired
def onUnmuteCommand(cn, args):
try:
Expand Down
2 changes: 1 addition & 1 deletion src/pyscripts/xsbs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def registerCommandHandler(command, func):
xsbs.help.loadCommandInfo(command, func)
commandmanager.register(command, func)

class command(object):
class commandHandler(object):
def __init__(self, name):
self.command_name = name
def __call__(self, f):
Expand Down

0 comments on commit b17cb00

Please sign in to comment.