Fix IllegalArgumentException with watchable objects
Dieser Commit ist enthalten in:
Ursprung
e6c87129bd
Commit
368ed76677
@ -424,7 +424,8 @@ public class MinecraftReflection {
|
||||
* @return TRUE if it can, FALSE otherwise.
|
||||
*/
|
||||
public static boolean isBlockPosition(Object obj) {
|
||||
return obj != null && getBlockPositionClass().isAssignableFrom(obj.getClass());
|
||||
Class<?> blockPosition = getBlockPositionClass();
|
||||
return obj != null && blockPosition != null && blockPosition.isAssignableFrom(obj.getClass());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1179,7 +1180,8 @@ public class MinecraftReflection {
|
||||
try {
|
||||
return getMinecraftClass("ChunkPosition");
|
||||
} catch (RuntimeException e) {
|
||||
/* Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
||||
try {
|
||||
Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
||||
|
||||
// ChunkPosition a(net.minecraft.server.World world, String string, int i, int i1, int i2) {
|
||||
FuzzyMethodContract selected = FuzzyMethodContract.newBuilder()
|
||||
@ -1191,19 +1193,24 @@ public class MinecraftReflection {
|
||||
.parameterExactType(int.class, 4)
|
||||
.build();
|
||||
|
||||
return setMinecraftClass("ChunkPosition", FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType()); */
|
||||
return setMinecraftClass("ChunkPosition",
|
||||
FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
||||
} catch (Throwable ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the BlockPosition class.
|
||||
*
|
||||
* @return The BlockPosition class.
|
||||
*/
|
||||
public static Class<?> getBlockPositionClass() {
|
||||
try {
|
||||
return getMinecraftClass("BlockPosition");
|
||||
} catch (RuntimeException e) {
|
||||
try {
|
||||
Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
||||
|
||||
// BlockPosition findNearestMapFeature(World, String, BlockPosition)
|
||||
@ -1216,6 +1223,9 @@ public class MinecraftReflection {
|
||||
|
||||
return setMinecraftClass("BlockPosition",
|
||||
FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
||||
} catch (Throwable ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren