Changed all CommandExecutor arguments
Added arguments command and label to all command executor functions,
hopefully for massive performance increase.
This is due to the following mess in PythonLoader:
``` Java
@Override
public boolean onCommand(CommandSender sender, Command command, String
label, String[] args) {
boolean result;
if (argcount == -1) {
try {
result = call(4, sender, command, label, args);
argcount = 4;
} catch (PyException e) {
//this could goof up someone ... they'll probably yell at us and
eventually read this code ... fuck them
if (e.type == Py.TypeError && (e.value.toString().endsWith("takes
exactly 3 arguments (4 given)") || e.value.toString().endsWith("takes
exactly 4 arguments (5 given)"))) {
result = call(3, sender, command, label, args);
argcount = 3;
} else if (e.type == Py.TypeError && (e.value.toString().endsWith("takes
exactly 2 arguments (4 given)") || e.value.toString().endsWith("takes
exactly 3 arguments (5 given)"))) {
result = call(2, sender, command, label, args);
argcount = 2;
} else {
throw e;
}
}
} else {
result = call(argcount, sender, command, label, args);
}
return result;
}
```
Note: Still WIP on reports - I'm working on making it keep solved
reports to fix issue 10
This commit is contained in:
12
misc.py
12
misc.py
@@ -39,7 +39,7 @@ def on_join(event):
|
||||
|
||||
|
||||
@hook.command("sudo")
|
||||
def on_sudo_command(sender, args):
|
||||
def on_sudo_command(sender, command, label, args):
|
||||
"""
|
||||
/sudo
|
||||
execute command/chat *as* a player/console
|
||||
@@ -68,7 +68,7 @@ def on_sudo_command(sender, args):
|
||||
|
||||
#Temporary solution for /me
|
||||
@hook.command("me")
|
||||
def on_me_command(sender, args):
|
||||
def on_me_command(sender, command, label, args):
|
||||
if not sender.hasPermission("essentials.me"):
|
||||
noperm(sender)
|
||||
return True
|
||||
@@ -133,7 +133,7 @@ def on_player_entity_interact(event):
|
||||
|
||||
|
||||
@hook.command("pluginversions")
|
||||
def on_pluginversions_command(sender, args):
|
||||
def on_pluginversions_command(sender, command, label, args):
|
||||
"""
|
||||
/pluginversions
|
||||
print all plugins + versions; useful when updating plugins
|
||||
@@ -148,7 +148,7 @@ def on_pluginversions_command(sender, args):
|
||||
|
||||
|
||||
@hook.command("echo")
|
||||
def on_echo_command(sender, args):
|
||||
def on_echo_command(sender, command, label, args):
|
||||
"""
|
||||
/echo
|
||||
essentials echo sucks and prints mail alerts sometimes
|
||||
@@ -175,7 +175,7 @@ def eval_thread(sender, code):
|
||||
|
||||
|
||||
@hook.command("pyeval")
|
||||
def on_pyeval_command(sender, args):
|
||||
def on_pyeval_command(sender, command, label, args):
|
||||
"""
|
||||
/pyeval
|
||||
run python code ingame
|
||||
@@ -191,7 +191,7 @@ def on_pyeval_command(sender, args):
|
||||
|
||||
|
||||
@hook.command("modules")
|
||||
def on_modules_command(sender, args):
|
||||
def on_modules_command(sender, command, label, args):
|
||||
"""
|
||||
/modules
|
||||
list all modules, unloaded modules in red
|
||||
|
||||
Reference in New Issue
Block a user