diff --git a/pom.xml b/pom.xml index 1b50de1..130ec45 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 17 2.0.9 - 1.19.3-R0.1-SNAPSHOT + 1.20.3-R0.1-SNAPSHOT 2.0.0-SNAPSHOT ${build.version}-SNAPSHOT @@ -120,21 +120,14 @@ - - - org.spigotmc - spigot-api - ${spigot.version} - provided - - - - org.mockito - mockito-core - 3.11.1 - test - + + + org.javassist + javassist + 3.30.2-GA + + org.powermock powermock-module-junit4 ${powermock.version} @@ -146,12 +139,25 @@ ${powermock.version} test + + org.mockito + mockito-core + 3.11.1 + test + world.bentobox bentobox ${bentobox.version} provided + + + org.spigotmc + spigot-api + ${spigot.version} + provided + @@ -270,6 +276,8 @@ **/*Names* + + org/bukkit/Material* diff --git a/src/main/java/world/bentobox/border/Settings.java b/src/main/java/world/bentobox/border/Settings.java index 83b0cf6..5fd7ed8 100644 --- a/src/main/java/world/bentobox/border/Settings.java +++ b/src/main/java/world/bentobox/border/Settings.java @@ -35,6 +35,11 @@ public class Settings implements ConfigObject { @ConfigEntry(path = "return-teleport") private boolean returnTeleport = true; + @ConfigComment("") + @ConfigComment("Place a safety block under the player if they get teleported back into a non-safe spot.") + @ConfigEntry(path = "return-teleport-safety-block") + private boolean returnTeleportBlock = true; + @ConfigComment("") @ConfigComment("Barrier blocks on/off. Only applies if the border type is BARRIER.") @ConfigComment("If false, the border is indicated by particles only.") @@ -173,4 +178,18 @@ public void setBarrierOffset(int barrierOffset) { this.barrierOffset = barrierOffset; getBarrierOffset(); } + + /** + * @return the returnTeleportBlock + */ + public boolean isReturnTeleportBlock() { + return returnTeleportBlock; + } + + /** + * @param returnTeleportBlock the returnTeleportBlock to set + */ + public void setReturnTeleportBlock(boolean returnTeleportBlock) { + this.returnTeleportBlock = returnTeleportBlock; + } } diff --git a/src/main/java/world/bentobox/border/listeners/PlayerListener.java b/src/main/java/world/bentobox/border/listeners/PlayerListener.java index 9bc361d..0cb89a3 100644 --- a/src/main/java/world/bentobox/border/listeners/PlayerListener.java +++ b/src/main/java/world/bentobox/border/listeners/PlayerListener.java @@ -155,7 +155,7 @@ public void onPlayerLeaveIsland(PlayerMoveEvent e) { if (r != null) { inTeleport.add(p.getUniqueId()); Location targetPos = r.getHitPosition().toLocation(p.getWorld(), p.getLocation().getYaw(), p.getLocation().getPitch()); - if (!addon.getIslands().isSafeLocation(targetPos)) { + if (addon.getSettings().isReturnTeleportBlock() && !addon.getIslands().isSafeLocation(targetPos)) { switch (targetPos.getWorld().getEnvironment()) { case NETHER: targetPos.getBlock().getRelative(BlockFace.DOWN).setType(Material.NETHERRACK); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c821a87..b19ac3b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,30 +1,43 @@ -# Border addon configuration file +# Border addon configuration file {$version} # See the documentation at https://docs.bentobox.world/en/latest/addons/Border/ -# +# # This list stores GameModes in which Border addon should not work. # To disable addon it is necessary to write its name in new line that starts with -. Example: # disabled-gamemodes: # - BSkyBlock disabled-gamemodes: [] -# -# Use vanilla world border. -use-vanilla: true -# +# +# Border type. Options are VANILLA, which uses the vanillia-style board or BARRIER, +# which uses particles and barrier blocks. If players have permission to use the barrier type +# they may override this option. If they do not have permission or lose the permission +# then this setting will be used. +type: VANILLA +# # Teleport players back inside the border if they somehow get outside. # This will teleport players back inside if they toggle the border with a command. return-teleport: true -# -# Only applies if vanilla isn't used. -# Use barrier blocks. If false, the border is indicated by particles only. +# +# Place a safety block under the player if they get teleported back into a non-safe spot. +return-teleport-safety-block: true +# +# Barrier blocks on/off. Only applies if the border type is BARRIER. +# If false, the border is indicated by particles only. use-barrier-blocks: true -# -# Default border behavior +# +# Turn on barrier by default. show-by-default: true -# -# Only applies if vanilla isn't used. +# +# Only applies if VANILLA type isn't used. # Show max-protection range border. This is a visual border only and not a barrier. +# This setting is useful for game modes where the protection range can move around, like Boxed show-max-border: true -# -# Only applies if vanilla isn't used. +# +# Only applies if VANILLA type isn't used. # Enables/disables all types of wall particles shown by the addon show-particles: true +# +# Barrier offset. +# The barrier normally occurs at the protection range limit but this value extends it outwards. +# This does not extend the protection range, but will enable players to go outside their protected area. +# The barrier will not go further than the island distance. Minimum and default value is 0. +barrier-offset: 0