Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Avoid reflection in MaskTraverser if possible
Dieser Commit ist enthalten in:
Ursprung
dd4d405b36
Commit
57a4c993a1
@ -2,6 +2,7 @@ package com.boydti.fawe.util;
|
||||
|
||||
import com.boydti.fawe.object.mask.ResettableMask;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collection;
|
||||
@ -26,12 +27,17 @@ public class MaskTraverser {
|
||||
}
|
||||
Class<?> current = mask.getClass();
|
||||
while (current.getSuperclass() != null) {
|
||||
if (mask instanceof AbstractExtentMask) {
|
||||
AbstractExtentMask mask1 = (AbstractExtentMask) mask;
|
||||
mask1.setExtent(newExtent);
|
||||
} else {
|
||||
try {
|
||||
Field field = current.getDeclaredField("extent");
|
||||
field.setAccessible(true);
|
||||
field.set(mask, newExtent);
|
||||
} catch (NoSuchFieldException | IllegalAccessException ignored) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
Field field = current.getDeclaredField("mask");
|
||||
field.setAccessible(true);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren