This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
API Usage
Naman edited this page Dec 16, 2018
·
3 revisions
Getting the FPlayer
// If you have a FPlayer you can get the Faction it belongs to
// If the player has no faction Wilderness will be returned
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(Player);
// FPlayer Roles
Role role = fPlayer.getRole();
if (role == Role.MODERATOR){
// Do something
}
Getting the Faction
// Getting the faction by FLocation/Location & tag
Faction faction = null;
// By FLocation/Location
FLocation fLoc = new FLocation(location);
faction = Board.getInstance().getFactionAt(fLoc);
// By Faction Name/Tag
faction = Factions.getInstance().getByTag(String)
Claiming & Unclaiming
// Claiming
Board.getInstance().setFactionAt(Faction, FLocation);
// Unclaiming
Board.getInstance().removeAt(FLocation);
// Unclaim All
String factionId = faction.getId();
Board.getInstance().unclaimAll(factionId);
Faction Relations
// Get relation to faction
Relation rel = faction.getRelationTo(targetFaction);
// Set relation wish to faction
faction.setRelationWish(targetFaction, Relation.ALLY);
// If you wish to force set the relation then simply do the same for targetFaction to faction, like so
targetFaction.setRelationWish(faction, Relation.ALLY);