Fixed commands not working.
This commit is contained in:
parent
9126c9d295
commit
6e6e4d3fe0
|
@ -137,19 +137,23 @@ public class SimpleCommandMap implements CommandMap {
|
|||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
target.timings.startTiming(); // Spigot
|
||||
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
|
||||
if (target.timings == null) {
|
||||
target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length));
|
||||
target.timings.stopTiming(); // Spigot
|
||||
} catch (CommandException ex) {
|
||||
target.timings.stopTiming(); // Spigot
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
target.timings.stopTiming(); // Spigot
|
||||
throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
|
||||
} else {
|
||||
try {
|
||||
target.timings.startTiming(); // Spigot
|
||||
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
|
||||
target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length));
|
||||
target.timings.stopTiming(); // Spigot
|
||||
} catch (CommandException ex) {
|
||||
target.timings.stopTiming(); // Spigot
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
target.timings.stopTiming(); // Spigot
|
||||
String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
|
||||
throw new CommandException(msg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
// return true as command was handled
|
||||
return true;
|
||||
}
|
||||
|
@ -224,7 +228,8 @@ public class SimpleCommandMap implements CommandMap {
|
|||
} catch (CommandException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
|
||||
String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
|
||||
throw new CommandException(msg, ex);
|
||||
}
|
||||
}
|
||||
// PaperSpigot end
|
||||
|
|
Loading…
Reference in New Issue