Fix convert function in AbstractDirectionConverter

Dieser Commit ist enthalten in:
Aurora 2020-09-07 20:11:14 +02:00 committet von Aurora
Ursprung ee49627e51
Commit ddff407f18

Datei anzeigen

@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableSet;
import com.sk89q.worldedit.UnknownDirectionException; import com.sk89q.worldedit.UnknownDirectionException;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.entity.Player; 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.Direction;
import com.sk89q.worldedit.internal.annotation.MultiDirection; import com.sk89q.worldedit.internal.annotation.MultiDirection;
import com.sk89q.worldedit.internal.annotation.OptionalArg; import com.sk89q.worldedit.internal.annotation.OptionalArg;
@ -93,8 +94,7 @@ public abstract class AbstractDirectionConverter<D> implements ArgumentConverter
@Override @Override
public ConversionResult<D> convert(String argument, InjectedValueAccess context) { public ConversionResult<D> convert(String argument, InjectedValueAccess context) {
Player player = context.injectedValue(Key.of(Player.class, OptionalArg.class)) Player player = context.injectedValue(Key.of(Actor.class)).filter(Player.class::isInstance).map(Player.class::cast).orElse(null);
.orElse(null);
try { try {
return SuccessfulConversion.fromSingle(convertDirection(argument, player, includeDiagonals)); return SuccessfulConversion.fromSingle(convertDirection(argument, player, includeDiagonals));
} catch (Exception e) { } catch (Exception e) {