mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-25 18:09:27 +00:00
WorldGuard Wardrobe Flag
This commit is contained in:
@@ -12,13 +12,17 @@ import java.util.logging.Level;
|
||||
public class WGHook {
|
||||
|
||||
public static StateFlag COSMETIC_ENABLE_FLAG;
|
||||
public static StateFlag COSMETIC_WARDROBE_FLAG;
|
||||
|
||||
public WGHook() {
|
||||
FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
|
||||
try {
|
||||
StateFlag flag = new StateFlag("cosmetic-enable", false);
|
||||
registry.register(flag);
|
||||
COSMETIC_ENABLE_FLAG = flag; // only set
|
||||
StateFlag cosmeticFlag = new StateFlag("cosmetic-enable", false);
|
||||
StateFlag wardrobeFlag = new StateFlag("cosmetic-wardrobe", false);
|
||||
registry.register(cosmeticFlag);
|
||||
registry.register(wardrobeFlag);
|
||||
COSMETIC_ENABLE_FLAG = cosmeticFlag;
|
||||
COSMETIC_WARDROBE_FLAG = wardrobeFlag;
|
||||
} catch (FlagConflictException e) {
|
||||
Flag<?> existing = registry.get("cosmetic-enable");
|
||||
if (existing instanceof StateFlag) {
|
||||
@@ -35,4 +39,8 @@ public class WGHook {
|
||||
return COSMETIC_ENABLE_FLAG;
|
||||
}
|
||||
|
||||
public static StateFlag getCosmeticWardrobeFlag() {
|
||||
return COSMETIC_WARDROBE_FLAG;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ public class WGListener implements Listener {
|
||||
for (ProtectedRegion protectedRegion : set.getRegions()) {
|
||||
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticEnableFlag())) {
|
||||
user.hideCosmetics();
|
||||
return;
|
||||
}
|
||||
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticWardrobeFlag())) {
|
||||
user.enterWardrobe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user