mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Few misc command fixes.
This commit is contained in:
@ -80,10 +80,7 @@ class BukkitCommandInspector implements CommandInspector {
|
||||
InjectedValueStore store = MapBackedValueStore.create();
|
||||
store.injectValue(Key.of(Actor.class), context ->
|
||||
Optional.of(plugin.wrapCommandSender(sender)));
|
||||
CommandParameters parameters = NoInputCommandParameters.builder()
|
||||
.injectedValues(MemoizingValueAccess.wrap(store))
|
||||
.build();
|
||||
return mapping.get().getCondition().satisfied(parameters);
|
||||
return mapping.get().getCondition().satisfied(store);
|
||||
} else {
|
||||
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
||||
return false;
|
||||
|
@ -77,14 +77,11 @@ public class WorldEditListener implements Listener {
|
||||
InjectedValueStore store = MapBackedValueStore.create();
|
||||
store.injectValue(Key.of(Actor.class), context ->
|
||||
Optional.of(plugin.wrapCommandSender(event.getPlayer())));
|
||||
CommandParameters parameters = NoInputCommandParameters.builder()
|
||||
.injectedValues(MemoizingValueAccess.wrap(store))
|
||||
.build();
|
||||
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
|
||||
event.getCommands().removeIf(name ->
|
||||
// remove if in the manager and not satisfied
|
||||
commandManager.getCommand(name)
|
||||
.filter(command -> !command.getCondition().satisfied(parameters))
|
||||
.filter(command -> !command.getCondition().satisfied(store))
|
||||
.isPresent()
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user