Use registry to register WorldGuard flags

This commit is contained in:
Phoenix616 2019-05-01 17:21:46 +01:00
parent 04f91aa55b
commit 816fe77f27

View File

@ -1,4 +1,5 @@
package com.Acrobot.ChestShop.Plugins;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.flags.registry.FlagConflictException;
@ -12,7 +13,8 @@ public class WorldGuardFlags {
static {
StateFlag enableShop;
try {
enableShop = Flags.register(new StateFlag("allow-shop", false));
enableShop = new StateFlag("allow-shop", false);
WorldGuard.getInstance().getFlagRegistry().register(enableShop);
} catch (FlagConflictException | IllegalStateException e) {
enableShop = (StateFlag) Flags.get("allow-shop");
}