mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 05:26:29 +01:00
Fix entity combustion; resolves #832
This commit is contained in:
parent
cfd3e026bb
commit
87fad40095
@ -20,7 +20,10 @@ import de.erethon.dungeonsxl.DungeonsXL;
|
||||
import de.erethon.dungeonsxl.api.world.EditWorld;
|
||||
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
@ -75,22 +78,16 @@ public class DMobListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
// Zombie / Skeleton combustion from the sun.
|
||||
// Prevent undead combustion from the sun.
|
||||
@EventHandler
|
||||
public void onEntityCombust(EntityCombustEvent event) {
|
||||
if (plugin.getGameWorld(event.getEntity().getWorld()) != null) {
|
||||
if (event instanceof EntityCombustByEntityEvent) {
|
||||
return;
|
||||
}
|
||||
Entity entity = event.getEntity();
|
||||
if ((entity instanceof Skeleton || entity instanceof Zombie) && plugin.getGameWorld(entity.getWorld()) != null) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Allow other combustion
|
||||
@EventHandler
|
||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||
if (plugin.getGameWorld(event.getEntity().getWorld()) != null) {
|
||||
if (event.isCancelled()) {
|
||||
event.setCancelled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user