diff --git a/Essentials/src/main/resources/config.yml b/Essentials/src/main/resources/config.yml index 771d9372b64..bf00febde36 100644 --- a/Essentials/src/main/resources/config.yml +++ b/Essentials/src/main/resources/config.yml @@ -78,7 +78,7 @@ change-tab-complete-name: false #add-prefix-in-playerlist: true # When this option is enabled, player suffixes will be shown in the (tab) player list. -# This feature only works for Minecraft version 1.8 and higher. +# This feature only works for Minecraft version 1.8 and higher. # The value of 'change-playerlist' above must be true. #add-suffix-in-playerlist: true @@ -566,7 +566,7 @@ custom-quit-message: "none" # Set this to "none" to use the 'custom-join-message' setting for every join. # # Available placeholders: -# {PLAYER} - The player's display name. +# {PLAYER} - The player's display name. # {USERNAME} - The player's username. # {OLDUSERNAME} - The player's old username. # {PREFIX} - The player's prefix. @@ -923,7 +923,7 @@ chat: # You can add command costs for shout/question by adding 'chat-shout' and 'chat-question' to the 'command-costs' section above. radius: 0 - # Chat formatting can be configured in two ways: + # Chat formatting can be configured in two ways: # - A standard format for all chat ('format' section) # - Group-specific chat formats for extra variation ('group-formats' section) # @@ -1027,6 +1027,7 @@ protect: fireball-fire: false fireball-playerdamage: false fireball-itemdamage: false + windcharge-explosion: false witherskull-explosion: false witherskull-playerdamage: false witherskull-itemdamage: false @@ -1256,7 +1257,7 @@ random-respawn-location: "none" spawn-on-join: false # The following value of 'guests' states that all players in the 'guests' group will be teleported to spawn when joining. #spawn-on-join: guests -# The following list value states that all players in the 'guests' or 'admin' groups will be teleported to spawn when joining. +# The following list value states that all players in the 'guests' or 'admin' groups will be teleported to spawn when joining. #spawn-on-join: # - guests # - admin diff --git a/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtect.java index 49cb62b1b54..8524774f016 100644 --- a/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtect.java @@ -64,6 +64,11 @@ private void initialize(final PluginManager pm, final Plugin essPlugin) { pm.registerEvents(blockListener_1_16_r1, this); } + if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_21_3_R01)){ + final EssentialsProtectEntityListener_1_21_3_R1 entityListener_1_21_3_r1 = new EssentialsProtectEntityListener_1_21_3_R1(this); + pm.registerEvents(entityListener_1_21_3_r1, this); + } + final EssentialsProtectWeatherListener weatherListener = new EssentialsProtectWeatherListener(this); pm.registerEvents(weatherListener, this); } diff --git a/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index e94a83324c5..f6bbe830e18 100644 --- a/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -180,7 +180,7 @@ public void onEntityExplode(final EntityExplodeEvent event) { } else if (entity instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion)) { event.setCancelled(true); - } else if (entity instanceof Fireball && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion)) { + } else if (entity instanceof Fireball && !entity.getClass().getSimpleName().equals("CraftWindCharge") && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion)) { event.setCancelled(true); } else if ((entity instanceof WitherSkull) && prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion)) { diff --git a/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtectEntityListener_1_21_3_R1.java b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtectEntityListener_1_21_3_R1.java new file mode 100644 index 00000000000..4389477758a --- /dev/null +++ b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/EssentialsProtectEntityListener_1_21_3_R1.java @@ -0,0 +1,25 @@ +package com.earth2me.essentials.protect; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.WindCharge; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityExplodeEvent; + +public class EssentialsProtectEntityListener_1_21_3_R1 implements Listener { + private final IProtect prot; + + EssentialsProtectEntityListener_1_21_3_R1(final IProtect prot) { + this.prot = prot; + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onEntityExplode(final EntityExplodeEvent event) { + final Entity entity = event.getEntity(); + + if (entity instanceof WindCharge && prot.getSettingBool(ProtectConfig.prevent_windcharge_explosion)) { + event.setCancelled(true); + } + } +} diff --git a/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/ProtectConfig.java index 4e6485ae9c7..6fd2ddbdcb9 100644 --- a/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/main/java/com/earth2me/essentials/protect/ProtectConfig.java @@ -34,6 +34,7 @@ public enum ProtectConfig { prevent_fireball_fire("protect.prevent.fireball-fire", false), prevent_fireball_playerdmg("protect.prevent.fireball-playerdamage", false), prevent_fireball_itemdmg("protect.prevent.fireball-itemdamage", false), + prevent_windcharge_explosion("protect.prevent.windcharge-explosion", false), prevent_witherskull_explosion("protect.prevent.witherskull-explosion", false), prevent_witherskull_playerdmg("protect.prevent.witherskull-playerdamage", false), prevent_witherskull_itemdmg("protect.prevent.witherskull-itemdamage", false),