mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-02-16 10:30:58 +00:00
location command fix when UseLocationsInSameWorld is enabled
locations can be used in another world with bypass perm when UseLocationsInSameWorld is enabled
This commit is contained in:
@@ -89,11 +89,13 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
|
||||
HashMap<String, RTPWorld> 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<String, RTPWorld> 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());
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -14,6 +14,7 @@ Enabled: false #enable the locations feature
|
||||
RequirePermission: false #Require players to have `betterrtp.location.<world_name>`
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user