From 671d422683be9cea7bc8bc25107d53f1fa12843a Mon Sep 17 00:00:00 2001 From: SuperRonanCraft Date: Thu, 11 May 2023 23:05:53 -0400 Subject: [PATCH] location command fix when UseLocationsInSameWorld is enabled locations can be used in another world with bypass perm when UseLocationsInSameWorld is enabled --- BetterRTPAddons/pom.xml | 6 ++++++ pom.xml | 2 +- .../BetterRTP/player/commands/types/CmdLocation.java | 4 +++- .../BetterRTP/references/PermissionNode.java | 1 + src/main/resources/config.yml | 2 +- src/main/resources/locations.yml | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/BetterRTPAddons/pom.xml b/BetterRTPAddons/pom.xml index a609bf9..649b1ee 100644 --- a/BetterRTPAddons/pom.xml +++ b/BetterRTPAddons/pom.xml @@ -125,5 +125,11 @@ 1.18.22 provided + + org.jetbrains + annotations + 19.0.0 + compile + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ec27e2e..2c1f898 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ me.SuperRonanCraft BetterRTP jar - 3.6.8-4 + 3.6.8-3-DEVBUILD diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdLocation.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdLocation.java index 8c63c7f..7fc515f 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdLocation.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdLocation.java @@ -89,11 +89,13 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable { HashMap locations = new HashMap<>(); boolean needPermission = BetterRTP.getInstance().getSettings().isLocationNeedPermission(); boolean needSameWorld = BetterRTP.getInstance().getSettings().isUseLocationsInSameWorld(); + if (needSameWorld) + needSameWorld = !PermissionNode.BYPASS_LOCATION.check(sendi); for (Map.Entry location : BetterRTP.getInstance().getRTP().getRTPworldLocations().entrySet()) { boolean add = true; if (needPermission) //Do we need permission to go to this location? add = PermissionCheck.getLocation(sendi, location.getKey()); - if (add && needSameWorld) //Can be added and needs same world (if not same world, we don't care to check) + if (add && needSameWorld) //Can be added and needs same world (if not same world, we don't check) add = world == null || location.getValue().getWorld().equals(world); if (add) //Location can be added to list locations.put(location.getKey(), location.getValue()); diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/references/PermissionNode.java b/src/main/java/me/SuperRonanCraft/BetterRTP/references/PermissionNode.java index 0930edd..a996380 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/PermissionNode.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/PermissionNode.java @@ -16,6 +16,7 @@ public enum PermissionNode implements PermissionCheck { BYPASS_HUNGER("bypass.hunger"), BYPASS_COOLDOWN("bypass.cooldown"), BYPASS_DELAY("bypass.delay"), + BYPASS_LOCATION("bypass.location"), //Ability to bypass `UseLocationsInSameWorld` if enabled in location.yml RELOAD("reload"), SETTINGS("settings"), INFO("info"), diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0d91186..58688fc 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -61,7 +61,7 @@ Settings: DisableUpdater: false Logger: Enabled: true #Log all things rtp related to the log.log file - LogToConsole: true + LogToConsole: false Format: 'yyyy-MM-dd HH:mm:ss' Default: diff --git a/src/main/resources/locations.yml b/src/main/resources/locations.yml index 086dccf..c574877 100644 --- a/src/main/resources/locations.yml +++ b/src/main/resources/locations.yml @@ -14,6 +14,7 @@ Enabled: false #enable the locations feature RequirePermission: false #Require players to have `betterrtp.location.` UseLocationIfAvailable: true #Will choose a location upon `/rtp` if location(s) is available in the world UseLocationsInSameWorld: true #Will only choose locations in same world rtp'ing in +# If UseLocationsInSameWorld is set to true, use `betterrtp.bypass.location` to allow rtp'ing to locations in other worlds Locations: - main_loc: