Skip to content

Commit

Permalink
- Fix issue with the WorldGuard flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven65 committed Mar 10, 2021
1 parent 304a291 commit 25d7eeb
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 35 deletions.
2 changes: 1 addition & 1 deletion modules/1_10_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_11_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_12_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_13_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_13_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_14_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_15_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_16_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_16_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_16_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_8_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_8_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_8_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_9_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/1_9_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/Dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/Plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<artifactId>Slabbo-parent</artifactId>
<groupId>xyz.mackan</groupId>
<version>1.0.23</version>
<version>1.0.24</version>
<relativePath>../../</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ 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 {
return new ShopAction(ShopAction.ShopActionType.OPEN_CLIENT_GUI, shop);
}
}

if (!holdingStick && shopExists && (canUseShop || canCreateShop)) {
if (!holdingStick && shopExists && canUseShop) {
if (isShopOwner) {
return new ShopAction(ShopAction.ShopActionType.OPEN_ADMIN_GUI, shop);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -67,19 +62,19 @@ public static boolean canCreateShop (Location location, Player player) {

Set<ProtectedRegion> 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;
}
}
Expand All @@ -93,19 +88,19 @@ public static boolean canUseShop (Location location, Player player) {

Set<ProtectedRegion> 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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>xyz.mackan</groupId>
<artifactId>Slabbo-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
<packaging>pom</packaging>
<name>Slabbo</name>

Expand Down

0 comments on commit 25d7eeb

Please sign in to comment.