Skip to content
Permalink
Browse files

Fixed permissions checks on command completion

  • Loading branch information
DarkArc committed Jan 4, 2020
1 parent 4faae0f commit bd4b27f21e3542dab0f6650a8b4f18c615398ad6
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/main/java/com/sk89q/commandbook/BukkitCommandInspector.java
@@ -1,7 +1,9 @@
package com.sk89q.commandbook;

import com.sk89q.bukkit.util.CommandInspector;
import com.sk89q.commandbook.util.WorldEditAdapter;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.enginehub.piston.CommandManager;
@@ -55,7 +57,7 @@ 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(CommandSender.class), context -> Optional.of(sender));
store.injectValue(Key.of(Actor.class), context -> Optional.of(WorldEditAdapter.adapt(sender)));
return mapping.get().getCondition().satisfied(store);
} else {
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");

0 comments on commit bd4b27f

Please sign in to comment.
You can’t perform that action at this time.