diff --git a/api/src/main/java/net/thenextlvl/portals/view/PortalConfig.java b/api/src/main/java/net/thenextlvl/portals/view/PortalConfig.java index 8c75141..0898f66 100644 --- a/api/src/main/java/net/thenextlvl/portals/view/PortalConfig.java +++ b/api/src/main/java/net/thenextlvl/portals/view/PortalConfig.java @@ -45,16 +45,10 @@ public interface PortalConfig { */ boolean ignoreEntityMovement(); - /** - * Whether to push back entities that are denied entry. - * - * @return {@code true} if entities are pushed back, {@code false} otherwise - * @since 0.2.0 - */ - boolean pushBackOnEntryDenied(); - /** * Speed at which entities are pushed back. + *

+ * A value of 0 and below means this feature is disabled. * * @return the pushback speed * @since 0.2.0 diff --git a/src/main/java/net/thenextlvl/portals/PortalsPlugin.java b/src/main/java/net/thenextlvl/portals/PortalsPlugin.java index 3f67e05..7910d4a 100644 --- a/src/main/java/net/thenextlvl/portals/PortalsPlugin.java +++ b/src/main/java/net/thenextlvl/portals/PortalsPlugin.java @@ -54,7 +54,7 @@ public final class PortalsPlugin extends JavaPlugin { private final FileIO portalConfig = new GsonFile<>( IO.of(getDataPath().resolve("config.json")), - new SimplePortalConfig(false, true, false, true, 0.3), + new SimplePortalConfig(false, true, false, 0.3), SimplePortalConfig.class ).validate().save(); diff --git a/src/main/java/net/thenextlvl/portals/listener/PortalListener.java b/src/main/java/net/thenextlvl/portals/listener/PortalListener.java index f76def7..080064f 100644 --- a/src/main/java/net/thenextlvl/portals/listener/PortalListener.java +++ b/src/main/java/net/thenextlvl/portals/listener/PortalListener.java @@ -90,10 +90,10 @@ private boolean processMovement(Entity entity, Location to) { } private void pushAway(Entity entity, Location to) { - if (!plugin.config().pushBackOnEntryDenied()) return; - entity.getScheduler().run(plugin, task -> { + var speed = plugin.config().pushbackSpeed(); + if (speed > 0) entity.getScheduler().run(plugin, task -> { var direction = entity.getLocation().toVector().subtract(to.toVector()).normalize(); - entity.setVelocity(direction.multiply(plugin.config().pushbackSpeed())); + entity.setVelocity(direction.multiply(speed)); }, null); } diff --git a/src/main/java/net/thenextlvl/portals/model/SimplePortalConfig.java b/src/main/java/net/thenextlvl/portals/model/SimplePortalConfig.java index a168897..e91200b 100644 --- a/src/main/java/net/thenextlvl/portals/model/SimplePortalConfig.java +++ b/src/main/java/net/thenextlvl/portals/model/SimplePortalConfig.java @@ -6,7 +6,6 @@ public record SimplePortalConfig( boolean allowCaveSpawns, boolean entryCosts, boolean ignoreEntityMovement, - boolean pushBackOnEntryDenied, double pushbackSpeed ) implements PortalConfig { }