diff --git a/pom.xml b/pom.xml index 7986b95..4ebfc30 100644 --- a/pom.xml +++ b/pom.xml @@ -53,12 +53,12 @@ UTF-8 UTF-8 - 16 + 17 2.0.9 1.19.4-R0.1-SNAPSHOT - 1.23.0-SNAPSHOT + 1.23.0 ${build.version}-SNAPSHOT @@ -196,7 +196,7 @@ maven-resources-plugin 3.1.0 - + org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5 @@ -207,19 +207,29 @@ --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED - --add-opens java.base/java.util.stream=ALL-UNNAMED + --add-opens + java.base/java.util.stream=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED - --add-opens java.base/java.util.regex=ALL-UNNAMED - --add-opens java.base/java.nio.channels.spi=ALL-UNNAMED + --add-opens + java.base/java.util.regex=ALL-UNNAMED + --add-opens + java.base/java.nio.channels.spi=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED - --add-opens java.base/java.util.concurrent=ALL-UNNAMED + --add-opens + java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/sun.nio.fs=ALL-UNNAMED --add-opens java.base/sun.nio.cs=ALL-UNNAMED --add-opens java.base/java.nio.file=ALL-UNNAMED - --add-opens java.base/java.nio.charset=ALL-UNNAMED - --add-opens java.base/java.lang.reflect=ALL-UNNAMED - --add-opens java.logging/java.util.logging=ALL-UNNAMED + --add-opens + java.base/java.nio.charset=ALL-UNNAMED + --add-opens + java.base/java.lang.reflect=ALL-UNNAMED + --add-opens + java.logging/java.util.logging=ALL-UNNAMED + --add-opens java.base/java.lang.ref=ALL-UNNAMED + --add-opens java.base/java.util.jar=ALL-UNNAMED + --add-opens java.base/java.util.zip=ALL-UNNAMED @@ -241,7 +251,7 @@ org.jacoco jacoco-maven-plugin - 0.8.3 + 0.8.7 true @@ -252,16 +262,21 @@ - pre-unit-test + prepare-agent prepare-agent - post-unit-test + report report + + + XML + + diff --git a/src/main/java/world/bentobox/limits/listeners/EntityLimitListener.java b/src/main/java/world/bentobox/limits/listeners/EntityLimitListener.java index 9bf49aa..3f3cf3e 100644 --- a/src/main/java/world/bentobox/limits/listeners/EntityLimitListener.java +++ b/src/main/java/world/bentobox/limits/listeners/EntityLimitListener.java @@ -403,10 +403,6 @@ public class EntityLimitListener implements Listener { // We have to count the entities if (limitAmount >= 0) { -// int count = (int) ent.getWorld().getEntities().stream() -// .filter(e -> e.getType().equals(ent.getType())) -// .filter(e -> island.inIslandSpace(e.getLocation())) -// .count(); int count = (int) ent.getWorld().getNearbyEntities(island.getBoundingBox()).stream() .filter(e -> e.getType().equals(ent.getType())) .count(); @@ -427,9 +423,9 @@ public class EntityLimitListener implements Listener { for (Map.Entry group : groupsLimits.entrySet()) { //do not use lambda if (group.getValue() < 0) continue; -// int count = (int) ent.getWorld().getEntities().stream() -// .filter(e -> group.getKey().contains(e.getType())) -// .filter(e -> island.inIslandSpace(e.getLocation())).count(); + // int count = (int) ent.getWorld().getEntities().stream() + // .filter(e -> group.getKey().contains(e.getType())) + // .filter(e -> island.inIslandSpace(e.getLocation())).count(); int count = (int) ent.getWorld().getNearbyEntities(island.getBoundingBox()).stream() .filter(e -> group.getKey().contains(e.getType())) .count(); diff --git a/src/test/java/bentobox/addon/limits/listeners/JoinListenerTest.java b/src/test/java/bentobox/addon/limits/listeners/JoinListenerTest.java index c0ca01a..eccda2f 100644 --- a/src/test/java/bentobox/addon/limits/listeners/JoinListenerTest.java +++ b/src/test/java/bentobox/addon/limits/listeners/JoinListenerTest.java @@ -298,7 +298,7 @@ public class JoinListenerTest { when(player.getEffectivePermissions()).thenReturn(perms); PlayerJoinEvent e = new PlayerJoinEvent(player, "welcome"); jl.onPlayerJoin(e); - verify(addon).logError("Player tastybento has permission: 'bskyblock.island.limit.STONE.abc' but the last part MUST be a number! Ignoring..."); + verify(addon).logError("Player tastybento has permission: 'bskyblock.island.limit.STONE.abc' but the last part MUST be an integer! Ignoring..."); } /** diff --git a/src/test/java/world/bentobox/limits/listeners/EntityLimitListenerTest.java b/src/test/java/world/bentobox/limits/listeners/EntityLimitListenerTest.java index a5e6da4..2e3c3c2 100644 --- a/src/test/java/world/bentobox/limits/listeners/EntityLimitListenerTest.java +++ b/src/test/java/world/bentobox/limits/listeners/EntityLimitListenerTest.java @@ -19,6 +19,7 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; +import org.bukkit.util.BoundingBox; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -80,15 +81,11 @@ public class EntityLimitListenerTest { collection.add(ent); collection.add(ent); collection.add(ent); - when(world.getEntities()).thenReturn(collection); + when(world.getNearbyEntities(any())).thenReturn(collection); ell = new EntityLimitListener(addon); } - @After - public void tearDown() { - } - /** * Test for {@link EntityLimitListener#atLimit(Island, Entity)} */