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.

<dependency>
    <groupId>com.massivecraft</groupId>
    <artifactId>Factions</artifactId>
    <version>1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/dependencies/SupremeFactions.jar</systemPath>
</dependency>

Getting Faction Objects from Bukkit Objects

// Getting a FactionPlayer from org.bukkit.Player
FPlayer fme = FPlayers.getInstance().getByPlayer(Player p);

// Getting a Faction by tag.
Faction fac = Factions.getInstance().getByTag("Example");

// Getting a Faction location from a bukkit location.
FLocation loc = new FLocation(Location location);

// Getting the faction at a specific location.
Faction fac1 = Board.getInstance().getFactionAt(loc);

Faction Structures

public enum Role {

    ADMIN(),
    COLEADER(),
    MODERATOR(),
    NORMAL(),
    RECRUIT();

}


public enum Relation {
    
    MEMBER(),
    ALLY(),
    TRUCE(),
    NEUTRAL(),
    ENEMY();
    
}

Factions Grace Controller

// Grace API
boolean isGraceEnabled = GraceController.getInstance().isGraceEnable();

Faction Upgrade API

UpgradeManager.getInstance().addUpgrade(
        // If your upgrade requires an event listener, you'd need to make a 
        // seperate class for each additional upgrade you want to add.
        // 
        // public class ExampleUpgrade extends Upgrade implements Listener {}
        // 
        new Upgrade("Example-Upgrade") {
            @Override
            public void perform(Faction f) {
                // This is called when a Faction purchases an upgrade.
                // This is were you would update values, do particles, 
                // make annoucements, or give perks.
            }
        }
);

Block Place/Break Permissions Check

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

Faction Permissions Management

Faction fac = Factions.getInstance().getFactionByTag("example");

fac.setPermission(Relation.ALLY, PermissableAction.BREAK, Access.ALLOW);
fac.setPermission(Role.MODERATOR, PermissableAction.BREAK, Access.ALLOW);

Faction Events

Last updated