Don't spawn combat NPCs in the lobby

This commit is contained in:
Sam 2017-05-09 16:27:43 +01:00
parent 1fbeaa6ecd
commit 26df99a4cf
2 changed files with 13 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.gemhunters.death.event.QuitNPCSpawnEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
@ -130,6 +131,17 @@ public class SafezoneModule extends MiniPlugin
_currentSafezone.remove(player.getUniqueId()); _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) @EventHandler(priority = EventPriority.HIGHEST)
public void entityDamage(EntityDamageEvent event) public void entityDamage(EntityDamageEvent event)
{ {

View File

@ -77,7 +77,7 @@ public class ShopModule extends MiniPlugin
_npcs = new ArrayList<>(); _npcs = new ArrayList<>();
_spawnedIndexes = new HashMap<>(); _spawnedIndexes = new HashMap<>();
runSyncLater(() -> updateVillagerTrades(), 20); runSyncLater(this::updateVillagerTrades, 20);
} }
public void updateVillagerTrades() public void updateVillagerTrades()
@ -111,8 +111,6 @@ public class ShopModule extends MiniPlugin
{ {
SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row);
} }
continue;
} }
} }
continue; continue;
@ -135,8 +133,6 @@ public class ShopModule extends MiniPlugin
{ {
SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row);
} }
continue;
} }
} }