From 283c088b21c9eef4cc0bf34e30fc4a9361284465 Mon Sep 17 00:00:00 2001 From: pop4959 Date: Thu, 30 Apr 2020 12:39:00 -0700 Subject: [PATCH] Add protect option for disabling ender crystal explosions (#3210) Closes #587. --- Essentials/src/config.yml | 1 + .../essentials/protect/EssentialsProtectEntityListener.java | 3 +++ .../src/com/earth2me/essentials/protect/ProtectConfig.java | 1 + 3 files changed, 5 insertions(+) diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 5f5c2d8a7..31a699d90 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -799,6 +799,7 @@ protect: creeper-explosion: false creeper-playerdamage: false creeper-blockdamage: false + ender-crystal-explosion: false enderdragon-blockdamage: true enderman-pickup: false villager-death: false diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index 0be93bab1..9c78346fb 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.protect; import com.earth2me.essentials.User; import net.ess3.api.IEssentials; import org.bukkit.entity.Creeper; +import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -185,6 +186,8 @@ public class EssentialsProtectEntityListener implements Listener { event.setCancelled(true); } else if ((entity instanceof ExplosiveMinecart) && prot.getSettingBool(ProtectConfig.prevent_tntminecart_explosion)) { event.setCancelled(true); + } else if (entity instanceof EnderCrystal && prot.getSettingBool(ProtectConfig.prevent_ender_crystal_explosion)) { + event.setCancelled(true); } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java index 365401eff..16fecd572 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -38,6 +38,7 @@ public enum ProtectConfig { prevent_creeper_explosion("protect.prevent.creeper-explosion", true), prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false), prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false), + prevent_ender_crystal_explosion("protect.prevent.ender-crystal-explosion", false), prevent_enderman_pickup("protect.prevent.enderman-pickup", false), prevent_villager_death("protect.prevent.villager-death", false), prevent_enderdragon_blockdmg("protect.prevent.enderdragon-blockdamage", true),