com.sk89q.worldguard.protection.flags.registry.FlagConflictException Java Examples

The following examples show how to use com.sk89q.worldguard.protection.flags.registry.FlagConflictException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorldGuardApi.java    From ClaimChunk with MIT License 6 votes vote down vote up
static boolean _init(ClaimChunk claimChunk) {
    FLAG_CHUNK_CLAIM = new StateFlag(CHUNK_CLAIM_FLAG_NAME,
            claimChunk.chConfig().getBool("worldguard", "allowClaimsInRegionsByDefault"));

    try {
        FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
        registry.register(FLAG_CHUNK_CLAIM);
        return true;
    } catch (FlagConflictException ignored) {
        Utils.err("Flag \"%s\" is already registered with WorldGuard. Another plugin conflicts with us!", CHUNK_CLAIM_FLAG_NAME);
    } catch (Exception e) {
        Utils.err("Failed to initialize WorldGuard support");
        e.printStackTrace();
    }
    return false;
}
 
Example #2
Source File: WorldGuardIntegration.java    From QuickShop-Reremake with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void load() {
    FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
    try {
        // create a flag with the name "my-custom-flag", defaulting to true
        registry.register(this.createFlag);
        registry.register(this.tradeFlag);
        plugin.getLogger().info(ChatColor.GREEN + getName() + " flags register successfully.");
        Util.debugLog("Success register " + getName() + " flags.");
    } catch (FlagConflictException e) {
        e.printStackTrace();
    }
}
 
Example #3
Source File: WorldGuardCompat.java    From StackMob-3 with GNU General Public License v3.0 5 votes vote down vote up
public void registerFlag(){
    FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
    try {
        registry.register(ENTITY_FLAG);
        sm.getLogger().info("Registered WorldGuard region flag.");
    } catch (FlagConflictException e) {
        sm.getLogger().warning("A conflict occurred while trying to register the WorldGuard flag.");
        e.printStackTrace();
    }
}
 
Example #4
Source File: WorldGuardHook.java    From FunnyGuilds with Apache License 2.0 5 votes vote down vote up
public static void initWorldGuard() {
    WorldGuardHook.worldGuard = WorldGuardPlugin.inst();
    noPointsFlag = new StateFlag("fg-no-points", false);
    
    try {
        ((FlagRegistry) GET_FLAG_REGISTRY.invoke(GET_INSTANCE.invoke(null))).register(noPointsFlag);
    }
    catch (FlagConflictException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
        FunnyGuilds.getInstance().getPluginLogger().error("An error occurred while registering an \"fg-no-points\" worldguard flag", ex);
    }
}