From a402423b4b2004f4dbe947e9335a1d853004a55a Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 26 Apr 2020 15:21:18 +0200 Subject: [PATCH] Fix error if PlotSquared v5 is not installed --- .../external/PlotSquaredOldShopFlag.java | 16 +++++++--------- .../shopchest/external/PlotSquaredShopFlag.java | 9 ++++----- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/external/PlotSquaredOldShopFlag.java b/src/main/java/de/epiceric/shopchest/external/PlotSquaredOldShopFlag.java index d56205e..8eb8a27 100644 --- a/src/main/java/de/epiceric/shopchest/external/PlotSquaredOldShopFlag.java +++ b/src/main/java/de/epiceric/shopchest/external/PlotSquaredOldShopFlag.java @@ -11,16 +11,15 @@ import de.epiceric.shopchest.ShopChest; import java.util.Locale; public class PlotSquaredOldShopFlag { - - private static boolean registered = false; - public enum Group { OWNERS, MEMBERS, TRUSTED, EVERYONE, NONE } - public static GroupFlag CREATE_SHOP = new GroupFlag("create-shop"); - public static GroupFlag USE_SHOP = new GroupFlag("use-shop"); - public static GroupFlag USE_ADMIN_SHOP = new GroupFlag("use-admin-shop"); + public static final GroupFlag CREATE_SHOP = new GroupFlag("create-shop"); + public static final GroupFlag USE_SHOP = new GroupFlag("use-shop"); + public static final GroupFlag USE_ADMIN_SHOP = new GroupFlag("use-admin-shop"); + + private static boolean registered = false; public static void register(ShopChest plugin) { if (registered) return; @@ -42,7 +41,7 @@ public class PlotSquaredOldShopFlag { */ public static boolean isFlagAllowedOnPlot(Plot plot, GroupFlag flag, Player p) { if (plot != null && flag != null) { - Group group = plot.getFlag(flag, PlotSquaredOldShopFlag.Group.NONE); + Group group = plot.getFlag(flag, Group.NONE); ShopChest.getInstance().debug("Flag " + flag.getName() + " is set to " + group); switch (group) { @@ -65,7 +64,6 @@ public class PlotSquaredOldShopFlag { } public static class GroupFlag extends Flag { - public GroupFlag(String name) { super(name); } @@ -94,6 +92,7 @@ public class PlotSquaredOldShopFlag { case "all": return Group.EVERYONE; case "deny": + case "disallow": case "false": case "no": case "0": @@ -110,5 +109,4 @@ public class PlotSquaredOldShopFlag { return "Flag value must be a group: 'owner' , 'members', 'trusted', 'everyone' or 'none'"; } } - } \ No newline at end of file diff --git a/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java b/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java index e0a9ea1..e461788 100644 --- a/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java +++ b/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java @@ -26,14 +26,13 @@ public class PlotSquaredShopFlag { .map(value -> String.valueOf(value).toLowerCase(Locale.ENGLISH)) .toArray(String[]::new); + public static final GroupFlag CREATE_SHOP = new CreateShopFlag(Group.MEMBERS); + public static final GroupFlag USE_SHOP = new UseShopFlag(Group.EVERYONE); + private static boolean registered = false; - public static final CreateShopFlag CREATE_SHOP = new CreateShopFlag(Group.MEMBERS); - public static final UseShopFlag USE_SHOP = new UseShopFlag(Group.EVERYONE); - public static void register(ShopChest plugin) { - if (registered) - return; + if (registered) return; GlobalFlagContainer.getInstance().addFlag(CREATE_SHOP); GlobalFlagContainer.getInstance().addFlag(USE_SHOP);