Solved Creating worldguard flags

Discussion in 'Plugin Development' started by WarmakerT, Nov 2, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    WarmakerT

    How can you create a WorldGuard flag(if you even can)?
    I'm trying to stop entities from shooting projectiles in certain regions.

    Bump.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  2. Offline

    Milkywayz

    Have you tried looking here ?
     
  3. Offline

    chriztopia

    Code:
    //Goes in ONENABLE
    getWorldGuard();
    //----------------
     
     
    //Goes outside of ONENABLE
    public WorldGuardPlugin getWorldGuard()
    {
        Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
        if ((plugin == null) || (!(plugin instanceof WorldGuardPlugin)))
        {
            return null; //throws a NullPointerException, telling the Admin that WG is not loaded.
        }
        return (WorldGuardPlugin)plugin;
    }
     
    //--------------------
     
    //Goes in your event or oncommand
    //gets world
    RegionManager regionManager = getWorldGuard().getRegionManager("world");
     
    //gets region
    ProtectedRegion set2 = regionManager.getRegionExact("RegionName");
     
    set2.setFlag(DefaultFlag.GREET_MESSAGE, "This sets a flag for greeting message");
     
    //Save the Region
    try
    {
    regionManager.save();
    }
    catch (Exception exp)
    { }
    //------------------------
    
     
Thread Status:
Not open for further replies.

Share This Page