From ddff407f189af195a5feafcc6d670260b4eec091 Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 7 Sep 2020 20:11:14 +0200 Subject: [PATCH] Fix convert function in AbstractDirectionConverter --- .../command/argument/AbstractDirectionConverter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java index 1765d94e6..4ecbe2879 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java @@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableSet; import com.sk89q.worldedit.UnknownDirectionException; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.MultiDirection; import com.sk89q.worldedit.internal.annotation.OptionalArg; @@ -93,8 +94,7 @@ public abstract class AbstractDirectionConverter implements ArgumentConverter @Override public ConversionResult convert(String argument, InjectedValueAccess context) { - Player player = context.injectedValue(Key.of(Player.class, OptionalArg.class)) - .orElse(null); + Player player = context.injectedValue(Key.of(Actor.class)).filter(Player.class::isInstance).map(Player.class::cast).orElse(null); try { return SuccessfulConversion.fromSingle(convertDirection(argument, player, includeDiagonals)); } catch (Exception e) {