Package noppes.npcs.api.handler.data
Interface IFaction
-
public interface IFaction
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddEnemyFaction(IFaction faction)Adds a faction as an enemy of this faction.booleanattackedByMobs()intgetColor()intgetDefaultPoints()IFaction[]getEnemyFactions()intgetFriendlyPoints()intgetId()booleangetIsHidden()StringgetName()intgetNeutralPoints()booleanisAggressiveToNpc(ICustomNpc npc)Checks whether this faction is hostile toward the given NPC's faction.booleanisEnemyFaction(IFaction faction)Checks whether the given faction is an enemy of this faction.booleanisPassive()intplayerStatus(IPlayer player)Returns the player's standing with this faction.voidremoveEnemyFaction(IFaction faction)Removes a faction from this faction's enemy list.voidsave()Saves the faction data to the server.voidsetAttackedByMobs(boolean attacked)Sets whether NPCs in this faction can be attacked by hostile mobs.voidsetColor(int c)Sets the faction's display color.voidsetDefaultPoints(int var1)Sets the default faction points assigned to new players.voidsetFriendlyPoints(int p)Sets the point threshold at or above which a player is considered friendly.voidsetIsHidden(boolean hidden)Sets whether this faction is hidden from the player's faction list.voidsetIsPassive(boolean passive)Sets whether NPCs in this faction are passive.voidsetName(String name)Sets the faction's display name.voidsetNeutralPoints(int p)Sets the point threshold below which a player is considered an enemy.
-
-
-
Method Detail
-
getId
int getId()
- Returns:
- The faction's unique ID
-
getName
String getName()
- Returns:
- The faction's display name
-
setName
void setName(String name)
Sets the faction's display name.- Parameters:
name- The new name
-
setDefaultPoints
void setDefaultPoints(int var1)
Sets the default faction points assigned to new players.- Parameters:
var1- The default point value
-
getDefaultPoints
int getDefaultPoints()
- Returns:
- The default faction points assigned to new players
-
setFriendlyPoints
void setFriendlyPoints(int p)
Sets the point threshold at or above which a player is considered friendly.- Parameters:
p- The friendly point threshold
-
getFriendlyPoints
int getFriendlyPoints()
- Returns:
- The point threshold at or above which a player is considered friendly
-
setNeutralPoints
void setNeutralPoints(int p)
Sets the point threshold below which a player is considered an enemy.- Parameters:
p- The neutral point threshold
-
getNeutralPoints
int getNeutralPoints()
- Returns:
- The point threshold below which a player is considered an enemy
-
setColor
void setColor(int c)
Sets the faction's display color.- Parameters:
c- The color as an RGB integer
-
getColor
int getColor()
- Returns:
- The faction's display color as an RGB integer
-
playerStatus
int playerStatus(IPlayer player)
Returns the player's standing with this faction.- Parameters:
player- The player to check- Returns:
- 1 for friendly, 0 for neutral, -1 for enemy
-
isAggressiveToNpc
boolean isAggressiveToNpc(ICustomNpc npc)
Checks whether this faction is hostile toward the given NPC's faction.- Parameters:
npc- The NPC to check against- Returns:
- True if this faction is aggressive toward the NPC
-
getIsHidden
boolean getIsHidden()
- Returns:
- Whether this faction is hidden from the player's faction list
-
setIsHidden
void setIsHidden(boolean hidden)
Sets whether this faction is hidden from the player's faction list.- Parameters:
hidden- True to hide the faction
-
isPassive
boolean isPassive()
- Returns:
- Whether NPCs in this faction are passive and will not attack
-
setIsPassive
void setIsPassive(boolean passive)
Sets whether NPCs in this faction are passive.- Parameters:
passive- True to make faction NPCs passive
-
attackedByMobs
boolean attackedByMobs()
- Returns:
- Whether NPCs in this faction can be attacked by hostile mobs
-
setAttackedByMobs
void setAttackedByMobs(boolean attacked)
Sets whether NPCs in this faction can be attacked by hostile mobs.- Parameters:
attacked- True to allow mobs to attack faction NPCs
-
isEnemyFaction
boolean isEnemyFaction(IFaction faction)
Checks whether the given faction is an enemy of this faction.- Parameters:
faction- The faction to check- Returns:
- True if the given faction is an enemy
-
getEnemyFactions
IFaction[] getEnemyFactions()
- Returns:
- An array of all factions that are enemies of this faction
-
addEnemyFaction
void addEnemyFaction(IFaction faction)
Adds a faction as an enemy of this faction.- Parameters:
faction- The faction to add as an enemy
-
removeEnemyFaction
void removeEnemyFaction(IFaction faction)
Removes a faction from this faction's enemy list.- Parameters:
faction- The faction to remove
-
save
void save()
Saves the faction data to the server.
-
-