SupremeDev
  • Supreme Development
  • Important
    • Installation
    • PayPal + Google Pay
    • Server Owner Advice
    • Json - Why?
    • Free Client Plugins
      • Supreme KillHolograms
        • config.yml
      • Supreme EXPShop
        • Commands & Permissions
        • config.yml
      • Supreme DeathBans
        • Commands & Permissions
        • config.yml
        • lang.yml
  • Plugins
    • Supreme Factions
      • Placeholders
      • Commands & Permissions
      • Developer API
      • Files
        • raids.json
        • lang.yml
        • conf.json
        • config.yml
        • upgrades.yml
    • Supreme Spawners
      • Commands & Permissions
      • Developer API
      • Files
        • lang.json
        • conf.json
        • entity-settings.json
        • stacker-settings.json
    • Supreme Hoes
      • Commands & Permissions
      • Placeholders
      • Developer API
      • Files
        • config.yml
        • captcha.yml
        • menus.yml
    • Supreme Printer
      • Commands & Permissions
      • Developer API
      • Files
        • config.yml
    • Supreme Blood Orbs
      • Commands & Permissions
      • Files
        • config.yml
        • lang.yml
    • Supreme TokenShop
      • Commands & Permissions
      • config.yml
    • Supreme LMS
      • Commands & Permissions
      • Files
        • lang.json
        • config.json
    • Supreme Roam
      • Commands & Permissions
      • Files
        • lang.yml
        • config.yml
    • Supreme MobSwords
      • Commands & Permissions
      • Placeholders
      • Files
        • menus.yml
        • config.yml
    • Supreme BindIP
      • Commands & Permissions
    • Supreme Robots
      • Commands & Permissions
      • Developer API
      • Files
        • lang.json
        • config.json
    • Supreme Meteors
      • Commands & Permissions
      • Files
        • config.yml
        • lang.json
    • Supreme Tools
      • Commands & Permissions
      • Files
        • config.yml
    • Supreme Collectors
      • Commands & Permissions
      • Files
        • lang.json
        • config.json
    • Supreme Player Stats
      • Commands & Permissions
      • Statistic Types
      • Files
        • menus.yml
        • config.json
    • Supreme Miner Picks
      • Commands & Permissions
      • Files
        • drops.yml
        • menus.yml
        • config.yml
  • Addons
    • Factions Top
    • Harvest Event
    • Hoe Boosters
  • Libraries
  • SupremeCaptcha
    • Commands & Permissions
    • Files
      • config.json
  • SupremeTokens
    • Commands & Permissions
    • Files
      • lang.json
      • config.json
Powered by GitBook
On this page
  • Environment Setup
  • Getting Faction Objects from Bukkit Objects
  • Faction Structures
  • Factions Grace Controller
  • Faction Upgrade API
  • Block Place/Break Permissions Check
  • Faction Permissions Management
  • Faction Events

Was this helpful?

  1. Plugins
  2. Supreme Factions

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

PreviousCommands & PermissionsNextFiles

Last updated 4 years ago

Was this helpful?