Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 21:10:05 +01:00
Fix for minecart naming
Dieser Commit ist enthalten in:
Ursprung
9ac04f8cfe
Commit
0d52d22bd8
@ -65,7 +65,6 @@ import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.MinecartTNT;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
@ -115,6 +114,18 @@ public class BukkitWorld extends LocalWorld {
|
||||
private static Method nmsGetMethod;
|
||||
private static Method nmsSetSafeMethod;
|
||||
|
||||
// copied from WG
|
||||
private static <T extends Enum<T>> T tryEnum(Class<T> enumType, String ... values) {
|
||||
for (String val : values) {
|
||||
try {
|
||||
return Enum.valueOf(enumType, val);
|
||||
} catch (IllegalArgumentException e) {}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private static org.bukkit.entity.EntityType tntMinecartType;
|
||||
private static boolean checkMinecartType = true;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
* @param world
|
||||
@ -122,6 +133,10 @@ public class BukkitWorld extends LocalWorld {
|
||||
public BukkitWorld(World world) {
|
||||
this.world = world;
|
||||
|
||||
if (checkMinecartType) {
|
||||
tntMinecartType = tryEnum(org.bukkit.entity.EntityType.class, "MINECART_TNT");
|
||||
checkMinecartType = false;
|
||||
}
|
||||
// check if we have a class we can use for nms access
|
||||
|
||||
// only run once per server startup
|
||||
@ -1032,7 +1047,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
++num;
|
||||
}
|
||||
} else if (type == EntityType.TNT) {
|
||||
if (ent instanceof TNTPrimed || ent instanceof MinecartTNT) {
|
||||
if (ent instanceof TNTPrimed || ent.getType() == tntMinecartType) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren