From c820406e8c8f3680f92b9fd2e22ded3ae3ac431c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 1 Apr 2019 23:55:15 +1100 Subject: [PATCH] Fix binding order --- .../worldedit/function/operation/ForwardExtentCopy.java | 2 +- .../worldedit/util/command/parametric/BindingMap.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index 0504c6bae..d22285d22 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -357,7 +357,7 @@ public class ForwardExtentCopy implements Operation { .stream() .filter(entity -> entity.getState() != null && !entity.getState().getType().getId().equals("minecraft:player") && - region.contains(entity.getLocation().toVector())) + region.contains(entity.getLocation().toBlockPoint())) .collect(Collectors.toList()); } else { entities = new ArrayList<>(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java index 6ff1589e4..de1896397 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java @@ -115,21 +115,26 @@ public class BindingMap implements Binding { */ private BoundMethod match(ParameterData pd) { Type type = pd.getType(); + BoundMethod result = null; while (type != null) { List methods = bindings.get(type); if (methods != null) { for (BoundMethod binding : methods) { if (binding.classifier != null) { if (pd.getClassifier() != null && pd.getClassifier().annotationType().equals(binding.classifier)) { - if (binding.type == null || binding.type.equals(type)) { + if (binding.type == null) { + result = binding; + } else if (binding.type.equals(type)) { return binding; } + } } else if (binding.type.equals(type)) { - return binding; + if (result == null) result = binding; } } } + if (result != null) return result; type = (type instanceof Class) ? ((Class) type).getSuperclass() : null; } throw new RuntimeException("Unknown type " + pd.getType());