Solved Check if Block is (Factions) Unclaimed

Discussion in 'Spigot Plugin Development' started by 123SteveHead, Jun 17, 2016.

  1. Hello Everyone

    I'm making a random teleporter for my plugin and I’ve gotten to the point where I need to check if the targetBlock is claimed by any faction. What is the easiest way (or, what is any way) I can do this? The server is using Factions Plugin by Massivecraft.

    Thanks for any response
     
  2. You can see an example on their web page
    Code (Java):

    Location location = newLocation(Bukkit.getWorld("derp"), 1337, 1337, 1337);
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(location));
     
     
    • Like Like x 1
  3. This method from Factions API allows you to get the factions that own's a specific location. so just get the location from the target block and use this method to get the faction that owns it.
    Code (Text):
    Location location = new Location(Bukkit.getWorld("derp"), 1337, 1337, 1337);
    faction = BoardColl.get().getFactionAt(PS.valueOf(location));
     
  4. Thanks MaTaMor_ and Apthos

    Your suggestions work perfectly.