From f4af446e2fcd9f7bba6d451e4d2ad93c1589c9dd Mon Sep 17 00:00:00 2001 From: BONNe Date: Fri, 17 May 2019 16:22:10 +0300 Subject: [PATCH 1/2] Moved less intensive checks in front when blocking end dragon spawn (#684) This comes from #676, but it will not fix issue in given case, as these checks do not take so much time and they often fails in 0.01 miliseconds. Anyway, adding checks in this order will improve performance for this checks in skyblock end world with enabled flag apx 80% for non-0;0 chunk. ( --- .../bentobox/listeners/BlockEndDragon.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java b/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java index 500f1d2c7..c7c6c3908 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java +++ b/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java @@ -27,14 +27,19 @@ public class BlockEndDragon implements Listener { */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onEnd(ChunkLoadEvent e) { - if (!Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(e.getWorld()) - || !e.getWorld().getEnvironment().equals(Environment.THE_END) - || !plugin.getIWM().inWorld(e.getWorld()) + if (!e.getWorld().getEnvironment().equals(Environment.THE_END) + || e.getChunk().getX() != 0 + || e.getChunk().getZ() != 0 + || !Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(e.getWorld()) + || !plugin.getIWM().inWorld(e.getWorld()) || !plugin.getIWM().isEndGenerate(e.getWorld()) || !plugin.getIWM().isEndIslands(e.getWorld()) - || !(e.getChunk().getX() == 0 && e.getChunk().getZ() == 0)) { + || e.getChunk().getBlock(0, 255, 0).getType().equals(Material.END_PORTAL)) + { + // No need to process. return; } + // Setting a End Portal at the top will trick dragon legacy check. e.getChunk().getBlock(0, 255, 0).setType(Material.END_PORTAL); } @@ -46,12 +51,12 @@ public class BlockEndDragon implements Listener { */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onEndBlockPlace(BlockPlaceEvent e) { - if (!Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(e.getBlock().getWorld()) - || e.getBlock().getY() != 255 + if (e.getBlock().getY() != 255 || e.getBlock().getX() != 0 || e.getBlock().getZ() != 0 || !e.getBlock().getType().equals(Material.END_PORTAL) || !e.getBlock().getWorld().getEnvironment().equals(Environment.THE_END) + || !Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(e.getBlock().getWorld()) || !plugin.getIWM().inWorld(e.getBlock().getWorld()) || !plugin.getIWM().isEndGenerate(e.getBlock().getWorld()) || !plugin.getIWM().isEndIslands(e.getBlock().getWorld())) { @@ -67,12 +72,12 @@ public class BlockEndDragon implements Listener { */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onEndBlockBreak(BlockBreakEvent e) { - if (!Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(e.getBlock().getWorld()) - || e.getBlock().getY() != 255 + if (e.getBlock().getY() != 255 || e.getBlock().getX() != 0 || e.getBlock().getZ() != 0 || !e.getBlock().getType().equals(Material.END_PORTAL) || !e.getBlock().getWorld().getEnvironment().equals(Environment.THE_END) + || !Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(e.getBlock().getWorld()) || !plugin.getIWM().inWorld(e.getBlock().getWorld()) || !plugin.getIWM().isEndGenerate(e.getBlock().getWorld()) || !plugin.getIWM().isEndIslands(e.getBlock().getWorld())) { From 50592de1369c759194c9bb89116a9d4efde6c8d3 Mon Sep 17 00:00:00 2001 From: barpec12 Date: Sat, 18 May 2019 00:37:43 +0200 Subject: [PATCH 2/2] Allow to load blueprints with lowercase names (#686) Restore the possibility to load blueprints with lowercase names --- .../world/bentobox/bentobox/managers/BlueprintsManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/managers/BlueprintsManager.java b/src/main/java/world/bentobox/bentobox/managers/BlueprintsManager.java index 55549adc4..2dd5ff447 100644 --- a/src/main/java/world/bentobox/bentobox/managers/BlueprintsManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/BlueprintsManager.java @@ -135,7 +135,7 @@ public class BlueprintsManager { * @param addon the {@link GameModeAddon} to get the blueprint bundles. */ public Map getBlueprintBundles(@NonNull GameModeAddon addon) { - return blueprintBundles.getOrDefault(addon, new HashMap<>()); + return blueprintBundles.getOrDefault(addon, new TreeMap<>(String.CASE_INSENSITIVE_ORDER)); } /** @@ -153,7 +153,7 @@ public class BlueprintsManager { * @param addon the {@link GameModeAddon} to load the blueprints of. */ public void loadBlueprintBundles(@NonNull GameModeAddon addon) { - blueprintBundles.put(addon, new HashMap<>()); + blueprintBundles.put(addon, new TreeMap<>(String.CASE_INSENSITIVE_ORDER)); // See if there are any schems that need converting new SchemToBlueprint(plugin).convertSchems(addon);