mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-03-02 10:31:23 +01:00
Remove debug message, add EntityCreatePortalEvent specifically for 1.8
This commit is contained in:
parent
373f287999
commit
e4a0d6c451
@ -22,6 +22,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.EntityCreatePortalEvent;
|
||||
import org.bukkit.event.world.PortalCreateEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -551,7 +552,6 @@ public class Block implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onStructureCreate(StructureGrowEvent event) {
|
||||
Bukkit.broadcastMessage(event.getEventName());
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
|
||||
@ -604,6 +604,33 @@ public class Block implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityCreatePortal(EntityCreatePortalEvent event) {
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
|
||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection"))
|
||||
return;
|
||||
|
||||
if (event.getBlocks().isEmpty())
|
||||
return;
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(event.getBlocks().get(0).getLocation());
|
||||
if (island == null)
|
||||
return;
|
||||
|
||||
// Check spawn block protection
|
||||
IslandWorld world = worldManager.getIslandWorld(event.getBlocks().get(0).getWorld());
|
||||
Location islandLocation = island.getLocation(world, IslandEnvironment.Main);
|
||||
|
||||
for (org.bukkit.block.BlockState block : event.getBlocks()) {
|
||||
if (LocationUtil.isLocationAffectingLocation(block.getLocation(), islandLocation)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDispenserDispenseBlock(BlockDispenseEvent event) {
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
Loading…
Reference in New Issue
Block a user