Entity limiting was happening in BentoBox worlds not specified in config

This commit is contained in:
tastybento 2021-02-21 19:02:50 -08:00
parent a730daf6a8
commit dc4efb2a0c
2 changed files with 9 additions and 2 deletions

View File

@ -170,6 +170,9 @@ public class BlockLimitsListener implements Listener {
}
private void handleBreak(Event e, Block b) {
if (!addon.inGameModeWorld(b.getWorld())) {
return;
}
Material mat = b.getType();
// Check for stackable plants
if (STACKABLE.contains(b.getType())) {

View File

@ -71,7 +71,8 @@ public class EntityLimitListener implements Listener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onMinecart(VehicleCreateEvent e) {
// Return if not in a known world
if (!addon.getPlugin().getIWM().inWorld(e.getVehicle().getWorld())) {
if (!addon.inGameModeWorld(e.getVehicle().getWorld())) {
return;
}
if (justSpawned.contains(e.getVehicle().getUniqueId())) {
@ -116,7 +117,7 @@ public class EntityLimitListener implements Listener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onCreatureSpawn(final CreatureSpawnEvent e) {
// Return if not in a known world
if (!addon.getPlugin().getIWM().inWorld(e.getLocation())) {
if (!addon.inGameModeWorld(e.getLocation().getWorld())) {
return;
}
if (justSpawned.contains(e.getEntity().getUniqueId())) {
@ -176,6 +177,9 @@ public class EntityLimitListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlock(HangingPlaceEvent e) {
if (!addon.inGameModeWorld(e.getBlock().getWorld())) {
return;
}
Player player = e.getPlayer();
if (player == null) return;
addon.getIslands().getIslandAt(e.getEntity().getLocation()).ifPresent(island -> {