From 26df99a4cfa626c953710a13c1bb55f1fa6f466a Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 9 May 2017 16:27:43 +0100 Subject: [PATCH] Don't spawn combat NPCs in the lobby --- .../mineplex/gemhunters/safezone/SafezoneModule.java | 12 ++++++++++++ .../src/mineplex/gemhunters/shop/ShopModule.java | 6 +----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java index b9e1ce380..627581b5b 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.UUID; import mineplex.core.recharge.Recharge; +import mineplex.gemhunters.death.event.QuitNPCSpawnEvent; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.HumanEntity; @@ -130,6 +131,17 @@ public class SafezoneModule extends MiniPlugin _currentSafezone.remove(player.getUniqueId()); } + @EventHandler + public void quitNpcSpawn(QuitNPCSpawnEvent event) + { + String safezone = getSafezone(event.getPlayer().getLocation()); + + if (safezone != null && safezone.contains(SAFEZONE_DATA_IGNORE)) + { + event.setCancelled(true); + } + } + @EventHandler(priority = EventPriority.HIGHEST) public void entityDamage(EntityDamageEvent event) { diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java index cfe5b13cb..59707f452 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java @@ -77,7 +77,7 @@ public class ShopModule extends MiniPlugin _npcs = new ArrayList<>(); _spawnedIndexes = new HashMap<>(); - runSyncLater(() -> updateVillagerTrades(), 20); + runSyncLater(this::updateVillagerTrades, 20); } public void updateVillagerTrades() @@ -111,8 +111,6 @@ public class ShopModule extends MiniPlugin { SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); } - - continue; } } continue; @@ -135,8 +133,6 @@ public class ShopModule extends MiniPlugin { SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); } - - continue; } }