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.
|
* @return TRUE if it can, FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
public static boolean isBlockPosition(Object obj) {
|
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 {
|
try {
|
||||||
return getMinecraftClass("ChunkPosition");
|
return getMinecraftClass("ChunkPosition");
|
||||||
} catch (RuntimeException e) {
|
} 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) {
|
// ChunkPosition a(net.minecraft.server.World world, String string, int i, int i1, int i2) {
|
||||||
FuzzyMethodContract selected = FuzzyMethodContract.newBuilder()
|
FuzzyMethodContract selected = FuzzyMethodContract.newBuilder()
|
||||||
@ -1191,19 +1193,24 @@ public class MinecraftReflection {
|
|||||||
.parameterExactType(int.class, 4)
|
.parameterExactType(int.class, 4)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return setMinecraftClass("ChunkPosition", FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType()); */
|
return setMinecraftClass("ChunkPosition",
|
||||||
|
FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
||||||
|
} catch (Throwable ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the BlockPosition class.
|
* Retrieves the BlockPosition class.
|
||||||
|
*
|
||||||
* @return The BlockPosition class.
|
* @return The BlockPosition class.
|
||||||
*/
|
*/
|
||||||
public static Class<?> getBlockPositionClass() {
|
public static Class<?> getBlockPositionClass() {
|
||||||
try {
|
try {
|
||||||
return getMinecraftClass("BlockPosition");
|
return getMinecraftClass("BlockPosition");
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
try {
|
||||||
Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
||||||
|
|
||||||
// BlockPosition findNearestMapFeature(World, String, BlockPosition)
|
// BlockPosition findNearestMapFeature(World, String, BlockPosition)
|
||||||
@ -1216,6 +1223,9 @@ public class MinecraftReflection {
|
|||||||
|
|
||||||
return setMinecraftClass("BlockPosition",
|
return setMinecraftClass("BlockPosition",
|
||||||
FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren