Skip to content

Developer Help

ProSavage edited this page Mar 6, 2018 · 10 revisions

Getting Started

Setting up Maven

<repository>
  <id>factions-repo</id>
  <url>http://ci.ender.zone/plugin/repository/everything/</url>
</repository>
<dependency>
  <groupId>com.massivecraft</groupId>
  <artifactId>Factions</artifactId>
  <version>1.6.9.5-U0.2.1-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>

Hooking

Your plugin.yml should either depend or softdepend on Factions to make sure it always loads AFTER Factions does.

softdepend: [Factions]
Plugin factions = getServer().getPluginManager().getPlugin("Factions");
if (factions != null && factions.isEnabled()) {
    // Factions was found, you can hook into it later.
}

FLocation

FLocation is a Chunk wrapper. If you ever want to deal with the map, claimed land, or something similar, you'll need to convert a Location or Chunk into an FLocation, both of which are super easy :)

Getting from a Bukkit Location.

FLocation flocation = new FLocation(Location);

Getting from a Chunk

FLocation flocation = new FLocation(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());

FPlayers

There is always 1 FPlayer object for each player that's been on the server, including online ones. It's very easy to get the associated FPlayer if you already have the Bukkit Player or their UUID.

By Bukkit Player

FPlayer fplayer = FPlayers.getInstance().getByPlayer(Player);

By UUID

FPlayer fplayer = FPlayers.getInstance().getById(uuid.toString());

Get Role

Role fplayerRole = fplayer.getRole();

Factions

There are multiple ways you can get a Faction.

Most common is by name

Faction faction = Factions.getInstance().getFactionById("name");

If you have a FLocation, you can get the Faction that owns it (including Wilderness, Warzone, and Safezone)

Faction faction = Board.getInstance().getFactionAt(FLocation);

Documentation has moved!

Click here to visit the updated documentation

Clone this wiki locally