mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-24 18:19:03 +01:00
Fix for minecart naming
This commit is contained in:
parent
f67ad6478c
commit
92bb3948a6
@ -36,7 +36,6 @@
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.MinecartTNT;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
@ -91,6 +90,8 @@ public class WorldGuardEntityListener implements Listener {
|
||||
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
private EntityType tntMinecartType;
|
||||
|
||||
/**
|
||||
* Construct the object;
|
||||
*
|
||||
@ -98,6 +99,7 @@ public class WorldGuardEntityListener implements Listener {
|
||||
*/
|
||||
public WorldGuardEntityListener(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
tntMinecartType = BukkitUtil.tryEnum(EntityType.class, "MINECART_TNT");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,7 +276,7 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker instanceof TNTPrimed || attacker instanceof MinecartTNT) {
|
||||
if (attacker instanceof TNTPrimed || attacker.getType() == tntMinecartType) {
|
||||
|
||||
// The check for explosion damage should be handled already... But... What ever...
|
||||
if (wcfg.blockTNTExplosions) {
|
||||
@ -600,7 +602,7 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ent instanceof TNTPrimed || ent instanceof MinecartTNT) {
|
||||
} else if (ent instanceof TNTPrimed || (ent != null && ent.getType() == tntMinecartType)) {
|
||||
if (wcfg.blockTNTBlockDamage) {
|
||||
event.blockList().clear();
|
||||
return;
|
||||
@ -731,7 +733,8 @@ public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (event.getEntityType() == EntityType.PRIMED_TNT) {
|
||||
} else if (event.getEntityType() == EntityType.PRIMED_TNT
|
||||
|| event.getEntityType() == tntMinecartType) {
|
||||
if (wcfg.blockTNTExplosions) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user