fix: 修复Sponge命令参数存在空字符串的问题

merge/2/HEAD
coding 2018-05-17 12:35:38 +00:00
parent c095593c41
commit f94653249d
1 changed files with 2 additions and 8 deletions

View File

@ -31,11 +31,11 @@ var SimpleCommandCallable = function (command) {
this.callable = new CommandCallable({
//CommandResult process(CommandSource source, String arguments) throws CommandException;
process: function (src, args) {
return that.cmd(src, that.name, args.length === 0 ? [] : args.split(" ")) ? CommandResult.success() : CommandResult.empty();
return that.cmd(src, that.name, args.length === 0 ? [] : args.split(" ").filter(function (e) { return e; })) ? CommandResult.success() : CommandResult.empty();
},
//List<String> getSuggestions(CommandSource source, String arguments, @Nullable Location<World> targetPosition) throws CommandException;
getSuggestions: function (src, args, target) {
return that.tab(src, that.name, args.length === 0 ? [] : args.split(" "));
return that.tab(src, that.name, args.length === 0 ? [] : args.split(" ").filter(function (e) { return e; }));
},
//boolean testPermission(CommandSource source);
testPermission: function () {
@ -121,12 +121,6 @@ function on(jsp, name, exec) {
}
}
Sponge.getCommandManager().getOwnedBy(plugin).forEach(function (commandMapping) {
if (!commandMapping.getAllAliases().contains("ms")) {
Sponge.getCommandManager().removeMapping(commandMapping);
}
});
exports = module.exports = {
enable: enable,
on: on,