mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Remove end exit island deletion
Reverts that part because it causes an endless loop of chunk reloading and block placement.
This commit is contained in:
parent
446028fbae
commit
93e95b42a0
@ -3,13 +3,13 @@ package world.bentobox.bentobox.listeners;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
@ -35,7 +35,7 @@ public class BlockEndDragon implements Listener {
|
||||
}
|
||||
|
||||
/**
|
||||
* This handles end dragon spawning prevention
|
||||
* This handles end dragon spawning prevention. Does not kill dragon because that generates random portal placement
|
||||
*
|
||||
* @param e - event
|
||||
* @return true if dragon can spawn, false if not
|
||||
@ -53,11 +53,7 @@ public class BlockEndDragon implements Listener {
|
||||
|
||||
|
||||
/**
|
||||
* This listener aims to delete the end trophy from the end when it is generated
|
||||
* It is added by special code in the server that can't be overidden so the only
|
||||
* option is to delete it manually. This means that any island at 0,0 will have
|
||||
* a dead zone of a few blocks directly above it. Hopefully this will not be a
|
||||
* major issue.
|
||||
* This listener moves the end exit island high up in the sky
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@ -67,29 +63,16 @@ public class BlockEndDragon implements Listener {
|
||||
|| !plugin.getIWM().inWorld(e.getWorld())
|
||||
|| !plugin.getIWM().isEndGenerate(e.getWorld())
|
||||
|| !plugin.getIWM().isEndIslands(e.getWorld())
|
||||
|| !CHUNKS.contains(new Pair<Integer, Integer>(e.getChunk().getX(), e.getChunk().getZ()))) {
|
||||
|| !(e.getChunk().getX() == 0 && e.getChunk().getZ() == 0)) {
|
||||
return;
|
||||
}
|
||||
// Setting a bedrock block here forces the spike to be placed as high as possible
|
||||
if (e.getChunk().getX() == 0 && e.getChunk().getZ() == 0) {
|
||||
e.getChunk().getBlock(0, 255, 0).setType(Material.BEDROCK);
|
||||
}
|
||||
// Remove trophy spike / exit portal after a while
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = DEAD_ZONE_Y; y < e.getWorld().getMaxHeight(); y++) {
|
||||
e.getChunk().getBlock(x, y, z).setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 20L);
|
||||
e.getChunk().getBlock(0, 255, 0).setType(Material.BEDROCK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Silently prevents block placing in the dead zone.
|
||||
* This is just a simple protection. If the player uses fancy ways to get blocks
|
||||
* into the dead zone it'll just mean they get deleted next time the chunks are loaded.
|
||||
* This is just a simple protection.
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@ -106,4 +89,24 @@ public class BlockEndDragon implements Listener {
|
||||
}
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Silently prevents block breaking in the dead zone.
|
||||
* This is just a simple protection.
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onEndBlockBreak(BlockBreakEvent e) {
|
||||
if (!Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(e.getBlock().getWorld())
|
||||
|| e.getBlock().getY() < DEAD_ZONE_Y
|
||||
|| !e.getBlock().getWorld().getEnvironment().equals(Environment.THE_END)
|
||||
|| !plugin.getIWM().inWorld(e.getBlock().getWorld())
|
||||
|| !plugin.getIWM().isEndGenerate(e.getBlock().getWorld())
|
||||
|| !plugin.getIWM().isEndIslands(e.getBlock().getWorld())
|
||||
|| !CHUNKS.contains(new Pair<Integer, Integer>(e.getBlock().getChunk().getX(), e.getBlock().getChunk().getZ()))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user