Class RedProtectAPI

java.lang.Object
br.net.fabiozumbi12.RedProtect.Bukkit.API.RedProtectAPI

public class RedProtectAPI extends Object
  • Constructor Details

    • RedProtectAPI

      public RedProtectAPI()
  • Method Details

    • getMessageApi

      public LangManager getMessageApi()
      Return language api to send messages using RedProtect language;

      Returns:
      LangManager with language api.
    • getAllRegions

      public Set<Region> getAllRegions()
      Return all regions for all loaded worlds;

      Returns:
      Set<Region> with all regions. Empty list if no regions.
    • getRegion

      public Region getRegion(String regionName, org.bukkit.World world)
      Give the Region based on given name and world.

      Parameters:
      regionName - Region Name.
      world - World where this Region is.
      Returns:
      Region matching the name or null if region not found.
    • getRegion

      public Region getRegion(org.bukkit.Location location)
      Return the Region on location.

      *Note: If theres more region in this same location this method will return only the high priority region. To get all possible region in one location use getGroupRegions()

      Parameters:
      location - Player location.
      Returns:
      Region of location or null if no regions on player location.
    • getPlayerRegions

      public Set<Region> getPlayerRegions(String uuid)
      A set of regions created by this player based on uuid or player name.

      Parameters:
      uuid - The uuid of player in String format! Make a way to give player name for servers using 'offline mode'.
      Returns:
      set<Region> with all regions created by given player.
    • getPlayerRegions

      public Set<Region> getPlayerRegions(String uuid, org.bukkit.World world)
      A set of regions created by this player based on uuid or player name and specific world.

      Parameters:
      uuid - The uuid of player in String format! Make a way to give player name for servers using 'offline mode'.
      world - to search for given region.
      Returns:
      set<Region> with all regions created by given player.
    • getPlayerRegions

      public Set<Region> getPlayerRegions(org.bukkit.entity.Player player)
      A set of regions created by this player.

      Parameters:
      player - The player.
      Returns:
      set<Region> with all regions created by given player.
    • getPlayerRegions

      public Set<Region> getPlayerRegions(org.bukkit.entity.Player player, int x, int y, int z)
      A set of regions created by this player based on x and z.

      Parameters:
      player - Owner of regions.
      x - Coord x of a location.
      y - Coord y of a location.
      z - Coord z of a location.
      Returns:
      set<Region> with all regions created by given player.
    • getHighPriorityRegion

      public Region getHighPriorityRegion(org.bukkit.World world, int x, int y, int z)
      In a location with more than one region, use to get the upper region with high priority.

      Parameters:
      world - World to search for regions.
      x - Coord x of a location.
      y - Coord y of a location.
      z - Coord z of a location.
      Returns:
      The high priority Region in a group of regions.
    • getLowPriorityRegion

      public Region getLowPriorityRegion(org.bukkit.World world, int x, int y, int z)
      In a location with more than one region, use to get the lower region with low priority.

      Parameters:
      world - World to search for regions.
      x - Coord x of a location.
      y - Coord y of a location.
      z - Coord z of a location.
      Returns:
      The lower priority Region in a group of regions.
    • getGroupRegions

      public Map<Integer,Region> getGroupRegions(org.bukkit.World world, int x, int y, int z)
      The group of Regions on given location x and z.

      Parameters:
      world - World to search for regions.
      x - Coord x of a location.
      y - Coord y of a location.
      z - Coord z of a location.
      Returns:
      Map<Integer, Region> with Integer as priority and the corresponding Region.
    • getGroupRegions

      public Map<Integer,Region> getGroupRegions(org.bukkit.Location loc)
      The group of Regions on given location x and z.

      Parameters:
      loc - Location to check the regions
      Returns:
      Map<Integer, Region> with Integer as priority and the corresponding Region.
    • getChunkRegions

      public Set<Region> getChunkRegions(org.bukkit.Chunk chunk)
      Return all regions present on provided chunk, including low and hight priority.

      Parameters:
      chunk - Chunk to get Regions.
      Returns:
      Set<Region> with all regions on provided chunk.
    • addRegion

      public void addRegion(Region region, org.bukkit.World world)
      Add a region.

      Parameters:
      region - Region to add.
      world - World of Region to add.
    • removeRegion

      public void removeRegion(Region region)
      Remove a region.

      Parameters:
      region - Region to remove.
    • renameRegion

      public void renameRegion(Region region, String newName)
      Rename a region;

      Parameters:
      region - Region to rename.
      newName - New name of region;
    • addFlag

      public boolean addFlag(String flag, boolean defaultValue, boolean isAdmin)
      Add custom flags.
      Parameters:
      flag - The name of flag.
      defaultValue - Default value if not admin flag.
      isAdmin - Is flag admin? If admin, will require admin permission (redprotect.admin.flag.FlagName)
      Returns:
      true if added or false if the flag already exists.
    • removeFlag

      public boolean removeFlag(String flag, boolean isAdmin)
      Parameters:
      flag - The name of flag.
      isAdmin - Is Admin flag?
      Returns:
      true if the flag was found and has been removed, false otherwise.