Skip to content

Commit 4baa4aa

Browse files
AttributeModifier$Operation only to be fetched if viable (#773)
1 parent 7a4a285 commit 4baa4aa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/com/comphenix/protocol/wrappers/WrappedAttributeModifier.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
* @author Kristian
2323
*/
2424
public class WrappedAttributeModifier extends AbstractWrapper {
25-
private static final Class<?> OPERATION_CLASS = MinecraftReflection.getMinecraftClass("AttributeModifier$Operation");
2625
private static final boolean OPERATION_ENUM = MinecraftVersion.atOrAbove(MinecraftVersion.VILLAGE_UPDATE);
27-
private static final EquivalentConverter<Operation> OPERATION_CONVERTER = new IndexedEnumConverter<>(Operation.class, OPERATION_CLASS);
26+
private static final Class<?> OPERATION_CLASS;
27+
private static final EquivalentConverter<Operation> OPERATION_CONVERTER;
2828

2929
private static class IndexedEnumConverter<T extends Enum<T>> implements EquivalentConverter<T> {
3030
private Class<T> specificClass;
@@ -65,6 +65,11 @@ public Class<T> getSpecificType() {
6565
}
6666
}
6767

68+
static {
69+
OPERATION_CLASS = OPERATION_ENUM ? MinecraftReflection.getMinecraftClass("AttributeModifier$Operation") : null;
70+
OPERATION_CONVERTER = OPERATION_ENUM ? new IndexedEnumConverter<>(Operation.class, OPERATION_CLASS) : null;
71+
}
72+
6873
/**
6974
* Represents the different modifier operations.
7075
* <p>

0 commit comments

Comments
 (0)