Developer API
Supreme does not provide a JavaDoc or a Maven/Gradle repo.

Environment Setup

Supreme Factions clients can download the API jar in #FAQ. Developers should ONLY have access to the API jar as everything required to use the API is included. Developers will NEVER need the real factions.jar to make addons. To import via Maven as a System dependency, use the following.
1
<dependency>
2
<groupId>com.massivecraft</groupId>
3
<artifactId>Factions</artifactId>
4
<version>1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9</version>
5
<scope>system</scope>
6
<systemPath>${project.basedir}/dependencies/SupremeFactions.jar</systemPath>
7
</dependency>
Copied!

Getting Faction Objects from Bukkit Objects

1
// Getting a FactionPlayer from org.bukkit.Player
2
FPlayer fme = FPlayers.getInstance().getByPlayer(Player p);
3
4
// Getting a Faction by tag.
5
Faction fac = Factions.getInstance().getByTag("Example");
6
7
// Getting a Faction location from a bukkit location.
8
FLocation loc = new FLocation(Location location);
9
10
// Getting the faction at a specific location.
11
Faction fac1 = Board.getInstance().getFactionAt(loc);
Copied!

Faction Structures

1
public enum Role {
2
3
ADMIN(),
4
COLEADER(),
5
MODERATOR(),
6
NORMAL(),
7
RECRUIT();
8
9
}
10
11
12
public enum Relation {
13
14
MEMBER(),
15
ALLY(),
16
TRUCE(),
17
NEUTRAL(),
18
ENEMY();
19
20
}
Copied!

Factions Grace Controller

1
// Grace API
2
boolean isGraceEnabled = GraceController.getInstance().isGraceEnable();
Copied!

Faction Upgrade API

1
UpgradeManager.getInstance().addUpgrade(
2
// If your upgrade requires an event listener, you'd need to make a
3
// seperate class for each additional upgrade you want to add.
4
//
5
// public class ExampleUpgrade extends Upgrade implements Listener {}
6
//
7
new Upgrade("Example-Upgrade") {
8
@Override
9
public void perform(Faction f) {
10
// This is called when a Faction purchases an upgrade.
11
// This is were you would update values, do particles,
12
// make annoucements, or give perks.
13
}
14
}
15
);
16
Copied!

Block Place/Break Permissions Check

1
// Checking a players access at a given location
2
if (FactionsBlockListener.playerCanBuildDestroyBlock(
3
Player player, Location location, String action, boolean justCheck)) {
4
// Inside `if` statement would mean ALLOWED to break / place.
5
}
Copied!

Faction Permissions Management

1
Faction fac = Factions.getInstance().getFactionByTag("example");
2
3
fac.setPermission(Relation.ALLY, PermissableAction.BREAK, Access.ALLOW);
4
fac.setPermission(Role.MODERATOR, PermissableAction.BREAK, Access.ALLOW);
Copied!

Faction Events

Last modified 1yr ago