mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-16 03:14:04 +00:00
Work on adding converters for some arguments
This commit is contained in:
@@ -27,7 +27,10 @@ import org.bukkit.command.CommandSender;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
import org.enginehub.piston.NoInputCommandParameters;
|
||||
import org.enginehub.piston.inject.InjectedValueStore;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.inject.MapBackedValueStore;
|
||||
import org.enginehub.piston.inject.MemoizingValueAccess;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -74,10 +77,11 @@ class BukkitCommandInspector implements CommandInspector {
|
||||
public boolean testPermission(CommandSender sender, Command command) {
|
||||
Optional<org.enginehub.piston.Command> mapping = dispatcher.getCommand(command.getName());
|
||||
if (mapping.isPresent()) {
|
||||
InjectedValueStore store = MapBackedValueStore.create();
|
||||
store.injectValue(Key.of(Actor.class), context ->
|
||||
Optional.of(plugin.wrapCommandSender(sender)));
|
||||
CommandParameters parameters = NoInputCommandParameters.builder()
|
||||
.injectedValues(ImmutableMap.of(
|
||||
Key.of(Actor.class), plugin.wrapCommandSender(sender)
|
||||
))
|
||||
.injectedValues(MemoizingValueAccess.wrap(store))
|
||||
.build();
|
||||
return mapping.get().getCondition().satisfied(parameters);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user