From 1054518831f7387a59094ecae9f7e45e3e18565e Mon Sep 17 00:00:00 2001 From: TreemanK Date: Fri, 21 Jun 2024 22:51:00 +1000 Subject: [PATCH 1/2] fix: fix create warp/sign in non-island world Currently, you can't create a warp in another world (even with permissions) as it goes into hasCorrectIslandRank. In this case, it is always false as there is no island at the block location meaning it will always go into this whilst creating a warp in other worlds. --- .../java/world/bentobox/warps/listeners/WarpSignsListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java b/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java index dce3236..80bcdf8 100644 --- a/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java +++ b/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java @@ -163,7 +163,7 @@ public class WarpSignsListener implements Listener { return; } - if(!hasCorrectIslandRank(b, user)) { + if (inWorld && !hasCorrectIslandRank(b, user)) { e.setLine(0, ChatColor.RED + addon.getSettings().getWelcomeLine()); user.sendMessage("warps.error.not-correct-rank"); return; From 599a6e1d0870bf8cbaaefb4c02bd67a84d5d8a53 Mon Sep 17 00:00:00 2001 From: TreemanK Date: Fri, 21 Jun 2024 23:57:24 +1000 Subject: [PATCH 2/2] style: added TODO Currently, `noLevelOrIsland and hasCorrectIslandRank` require the sign to be on an island. Currently this means the flag/level requirement are non-existent in the case of a sign being placed on a non-BSB island. This gives a possible solution if new API comes to light. --- .../world/bentobox/warps/listeners/WarpSignsListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java b/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java index 80bcdf8..5f25076 100644 --- a/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java +++ b/src/main/java/world/bentobox/warps/listeners/WarpSignsListener.java @@ -158,6 +158,11 @@ public class WarpSignsListener implements Listener { if (noPerms(user, b.getWorld(), inWorld)) { return; } + // TODO: These checks are useless if the sign is placed outside a BSB world. + // This will mean level and rank requirements are nil in the case of allow-in-other-worlds: true. + // I'm not sure if there is a better way around this without adding new API checking for primary + // or last island accessed with relevant permissions. + // ignored. if (inWorld && noLevelOrIsland(user, b.getWorld())) { e.setLine(0, ChatColor.RED + addon.getSettings().getWelcomeLine()); return;