Added command intercepter tool, used it for //calc #49

Closed
Dico200 wants to merge 8 commits from command-intercepter into dev
2 changed files with 8 additions and 5 deletions
Showing only changes of commit 8b5131f8ae - Show all commits

View File

@ -2,3 +2,6 @@ name: RedstonerUtils
main: main.py main: main.py
version: 3.1.0 version: 3.1.0
author: redstone_sheep author: redstone_sheep
commands:
serversigns:

View File

@ -395,16 +395,16 @@ def can_build2(player, block):
def check_all_signs_and_intercept_command(): def check_all_signs_and_intercept_command():
try: try:
CommandInterceptions = shared["modules"]["misc"].CommandInterceptions #CommandInterceptions = shared["modules"]["misc"].CommandInterceptions
rsutils_cmd = CommandInterceptions.cmd_map.get("redstonerutils:serversigns") #rsutils_cmd = CommandInterceptions.cmd_map.get("redstonerutils:serversigns")
label = rsutils_cmd.getLabel() #label = rsutils_cmd.getLabel()
def interception(sender, args): def interception(sender, args):
rsutils_cmd.execute(sender, label, args) svs_command(sender, None, None, args)
return False return False
def tab_completion(original, sender, alias, args): def tab_completion(original, sender, alias, args):
return rsutils_cmd.tabComplete(sender, alias, args) return None
shared["modules"]["misc"].CommandInterceptions.register("serversigns", "serversigns", interception, tab_completion) shared["modules"]["misc"].CommandInterceptions.register("serversigns", "serversigns", interception, tab_completion)
except: except: