From 25d7eeb54f01476b837fd80d3cb4606fc57618bf Mon Sep 17 00:00:00 2001 From: Sven65 Date: Wed, 10 Mar 2021 09:34:31 +0100 Subject: [PATCH] - Fix issue with the WorldGuard flags --- modules/1_10_R1/pom.xml | 2 +- modules/1_11_R1/pom.xml | 2 +- modules/1_12_R1/pom.xml | 2 +- modules/1_13_R1/pom.xml | 2 +- modules/1_13_R2/pom.xml | 2 +- modules/1_14_R1/pom.xml | 2 +- modules/1_15_R1/pom.xml | 2 +- modules/1_16_R1/pom.xml | 2 +- modules/1_16_R2/pom.xml | 2 +- modules/1_16_R3/pom.xml | 2 +- modules/1_8_R1/pom.xml | 2 +- modules/1_8_R2/pom.xml | 2 +- modules/1_8_R3/pom.xml | 2 +- modules/1_9_R1/pom.xml | 2 +- modules/1_9_R2/pom.xml | 2 +- modules/Dist/pom.xml | 2 +- modules/Plugin/pom.xml | 2 +- .../listeners/PlayerInteractListener.java | 4 +-- .../pluginsupport/WorldguardSupport.java | 25 ++++++++----------- pom.xml | 2 +- 20 files changed, 30 insertions(+), 35 deletions(-) diff --git a/modules/1_10_R1/pom.xml b/modules/1_10_R1/pom.xml index 6e69dfe..6b8e3e1 100644 --- a/modules/1_10_R1/pom.xml +++ b/modules/1_10_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_11_R1/pom.xml b/modules/1_11_R1/pom.xml index 15d2dd8..8959673 100644 --- a/modules/1_11_R1/pom.xml +++ b/modules/1_11_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_12_R1/pom.xml b/modules/1_12_R1/pom.xml index 431f9ca..415a769 100644 --- a/modules/1_12_R1/pom.xml +++ b/modules/1_12_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_13_R1/pom.xml b/modules/1_13_R1/pom.xml index b2a774f..3e69311 100644 --- a/modules/1_13_R1/pom.xml +++ b/modules/1_13_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_13_R2/pom.xml b/modules/1_13_R2/pom.xml index 8636f87..28bd0b5 100644 --- a/modules/1_13_R2/pom.xml +++ b/modules/1_13_R2/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_14_R1/pom.xml b/modules/1_14_R1/pom.xml index a009c2f..fea83f1 100644 --- a/modules/1_14_R1/pom.xml +++ b/modules/1_14_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_15_R1/pom.xml b/modules/1_15_R1/pom.xml index 85f6724..624bb4b 100644 --- a/modules/1_15_R1/pom.xml +++ b/modules/1_15_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_16_R1/pom.xml b/modules/1_16_R1/pom.xml index d3127ac..6c283d1 100644 --- a/modules/1_16_R1/pom.xml +++ b/modules/1_16_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_16_R2/pom.xml b/modules/1_16_R2/pom.xml index bde2f7c..76baf0f 100644 --- a/modules/1_16_R2/pom.xml +++ b/modules/1_16_R2/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_16_R3/pom.xml b/modules/1_16_R3/pom.xml index c2f16df..48acf39 100644 --- a/modules/1_16_R3/pom.xml +++ b/modules/1_16_R3/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_8_R1/pom.xml b/modules/1_8_R1/pom.xml index 55c0e6d..1fc10b4 100644 --- a/modules/1_8_R1/pom.xml +++ b/modules/1_8_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_8_R2/pom.xml b/modules/1_8_R2/pom.xml index f849bce..c4c5599 100644 --- a/modules/1_8_R2/pom.xml +++ b/modules/1_8_R2/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_8_R3/pom.xml b/modules/1_8_R3/pom.xml index c3e28b1..2cf4c0b 100644 --- a/modules/1_8_R3/pom.xml +++ b/modules/1_8_R3/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_9_R1/pom.xml b/modules/1_9_R1/pom.xml index 1a816d4..e1ab5e8 100644 --- a/modules/1_9_R1/pom.xml +++ b/modules/1_9_R1/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/1_9_R2/pom.xml b/modules/1_9_R2/pom.xml index 0128a83..0dbd218 100644 --- a/modules/1_9_R2/pom.xml +++ b/modules/1_9_R2/pom.xml @@ -13,7 +13,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/Dist/pom.xml b/modules/Dist/pom.xml index 9f9d86a..7eeb00e 100644 --- a/modules/Dist/pom.xml +++ b/modules/Dist/pom.xml @@ -12,7 +12,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 ../../ diff --git a/modules/Plugin/pom.xml b/modules/Plugin/pom.xml index a75f2cb..0af0ed5 100644 --- a/modules/Plugin/pom.xml +++ b/modules/Plugin/pom.xml @@ -12,7 +12,7 @@ Slabbo-parent xyz.mackan - 1.0.23 + 1.0.24 ../../ diff --git a/modules/Plugin/src/main/java/xyz/mackan/Slabbo/listeners/PlayerInteractListener.java b/modules/Plugin/src/main/java/xyz/mackan/Slabbo/listeners/PlayerInteractListener.java index d726e2c..8b83cf8 100644 --- a/modules/Plugin/src/main/java/xyz/mackan/Slabbo/listeners/PlayerInteractListener.java +++ b/modules/Plugin/src/main/java/xyz/mackan/Slabbo/listeners/PlayerInteractListener.java @@ -61,7 +61,7 @@ public ShopAction getRightClickAction (ItemStack itemInHand, Block clickedBlock, return new ShopAction(ShopAction.ShopActionType.CREATE); } - if (holdingStick && shopExists && (canUseShop || canCreateShop)) { + if (holdingStick && shopExists && canUseShop) { if (isShopOwner) { return new ShopAction(ShopAction.ShopActionType.OPEN_DELETION_GUI, shop); } else { @@ -69,7 +69,7 @@ public ShopAction getRightClickAction (ItemStack itemInHand, Block clickedBlock, } } - if (!holdingStick && shopExists && (canUseShop || canCreateShop)) { + if (!holdingStick && shopExists && canUseShop) { if (isShopOwner) { return new ShopAction(ShopAction.ShopActionType.OPEN_ADMIN_GUI, shop); } else { diff --git a/modules/Plugin/src/main/java/xyz/mackan/Slabbo/pluginsupport/WorldguardSupport.java b/modules/Plugin/src/main/java/xyz/mackan/Slabbo/pluginsupport/WorldguardSupport.java index 0b5f3ee..20f3f2a 100644 --- a/modules/Plugin/src/main/java/xyz/mackan/Slabbo/pluginsupport/WorldguardSupport.java +++ b/modules/Plugin/src/main/java/xyz/mackan/Slabbo/pluginsupport/WorldguardSupport.java @@ -6,21 +6,16 @@ import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.protection.ApplicableRegionSet; -import com.sk89q.worldguard.protection.flags.Flags; import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.flags.registry.FlagConflictException; import com.sk89q.worldguard.protection.flags.registry.FlagRegistry; import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.RegionContainer; -import com.sk89q.worldguard.protection.regions.RegionQuery; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.block.Block; import org.bukkit.entity.Player; -import xyz.mackan.Slabbo.Slabbo; -import java.util.LinkedList; import java.util.Set; public class WorldguardSupport { @@ -67,19 +62,19 @@ public static boolean canCreateShop (Location location, Player player) { Set regions = getRegions(location); - boolean isOwner = true; + boolean isOwner = false; boolean canOthersCreate = true; for (ProtectedRegion region : regions) { - if (!region.isOwner(localPlayer)) { - isOwner = false; + if (region.isOwner(localPlayer)) { + isOwner = true; } - Object createShopsValue = region.getFlag(CREATE_SHOPS); + String createShopsValue = region.getFlag(CREATE_SHOPS).toString(); if (createShopsValue == null) continue; - if (createShopsValue.equals("DENY")) { + if (createShopsValue.equalsIgnoreCase("DENY")) { canOthersCreate = false; } } @@ -93,19 +88,19 @@ public static boolean canUseShop (Location location, Player player) { Set regions = getRegions(location); - boolean isOwner = true; + boolean isOwner = false; boolean canOthersUse = true; for (ProtectedRegion region : regions) { - if (!region.isOwner(localPlayer)) { - isOwner = false; + if (region.isOwner(localPlayer)) { + isOwner = true; } - Object useShopsValue = region.getFlag(USE_SHOPS); + String useShopsValue = region.getFlag(USE_SHOPS).toString(); if (useShopsValue == null) continue; - if (useShopsValue.equals("DENY")) { + if (useShopsValue.equalsIgnoreCase("DENY")) { canOthersUse = false; } } diff --git a/pom.xml b/pom.xml index c7b45fd..c1d4c4a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ xyz.mackan Slabbo-parent - 1.0.23 + 1.0.24 pom Slabbo