Fix binding order

Dieser Commit ist enthalten in:
Jesse Boyd 2019-04-01 23:55:15 +11:00
Ursprung 64a134a9ee
Commit c820406e8c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
2 geänderte Dateien mit 8 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -357,7 +357,7 @@ public class ForwardExtentCopy implements Operation {
.stream() .stream()
.filter(entity -> entity.getState() != null && .filter(entity -> entity.getState() != null &&
!entity.getState().getType().getId().equals("minecraft:player") && !entity.getState().getType().getId().equals("minecraft:player") &&
region.contains(entity.getLocation().toVector())) region.contains(entity.getLocation().toBlockPoint()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} else { } else {
entities = new ArrayList<>(); entities = new ArrayList<>();

Datei anzeigen

@ -115,21 +115,26 @@ public class BindingMap implements Binding {
*/ */
private BoundMethod match(ParameterData pd) { private BoundMethod match(ParameterData pd) {
Type type = pd.getType(); Type type = pd.getType();
BoundMethod result = null;
while (type != null) { while (type != null) {
List<BoundMethod> methods = bindings.get(type); List<BoundMethod> methods = bindings.get(type);
if (methods != null) { if (methods != null) {
for (BoundMethod binding : methods) { for (BoundMethod binding : methods) {
if (binding.classifier != null) { if (binding.classifier != null) {
if (pd.getClassifier() != null && pd.getClassifier().annotationType().equals(binding.classifier)) { 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; return binding;
} }
} }
} else if (binding.type.equals(type)) { } 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; type = (type instanceof Class) ? ((Class) type).getSuperclass() : null;
} }
throw new RuntimeException("Unknown type " + pd.getType()); throw new RuntimeException("Unknown type " + pd.getType());