From a134e99c8c1cb958d2c50b50e1ae6b22045ecba4 Mon Sep 17 00:00:00 2001 From: Matthew Steglinski Date: Wed, 28 Oct 2015 11:35:29 -0400 Subject: [PATCH] [Fix] Listen to PortalCreateEvent to cancel portal creation by fire. Fixes #164 --- .../protect/EssentialsProtectBlockListener.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index 266feae15..c052d5521 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -10,6 +10,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.world.PortalCreateEvent; public class EssentialsProtectBlockListener implements Listener { @@ -77,4 +78,11 @@ public class EssentialsProtectBlockListener implements Listener { event.setCancelled(true); } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onPortalLight(PortalCreateEvent event) { + if (event.getReason() == PortalCreateEvent.CreateReason.FIRE) { + event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_portal_creation)); + } + } }