[Fix] Listen to PortalCreateEvent to cancel portal creation by fire. Fixes #164

This commit is contained in:
Matthew Steglinski 2015-10-28 11:35:29 -04:00
parent fb4af9fefc
commit a134e99c8c
1 changed files with 8 additions and 0 deletions

View File

@ -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));
}
}
}