To prevent errors, we need to check if DeluxeCombat is installed.
if (Bukkit.getPluginManager().getPlugin("DeluxeCombat") != null) {
// YOUR CODE HERE
}
Initializing an API object
To use the api, we need to create an API object. Its as simple as following:
DeluxeCombatAPI api = new DeluxeCombatAPI();
Methods
// Void Methods: (Execute an action)
void addPoints(Player p, int points); // Adds points to a player
void removePoints(Player p, int points); // Removes points from a player
void untag(Player p); // Untags a player
void togglePvP(Player p, boolean status); // Toggles the pvp of a player
void removeBounty(Player p); // Removes the bounty of a player
void createBounty(Player target, Player initiator, boolean anonymous, double bounty, boolean removeTax); // Creates a bounty
// Integer Methods: (Return an integer value)
int getRemainingCombatTime(Player p); // Returns how many sec the player is still in combat
int getHighestKillStreak(Player p); // Returns the highest killstreak of a player
int getStreak(Player p); // Returns the streak the player in his current session has
int getCombatlogs(Player p); // Returns the amount of combatlogs a player has
int getDeaths(Player p); // Returns the amount of deaths a player has
int getKills(Player p); // Returns the amount of kills a player has
int getPoints(Player p); // Returns the amount of points a player has
// Double Methods: (Return a double value)
double getKD(Player p); // Returns the kd of a player
// Boolean Methods: (Return true or false)
boolean isInCombat(Player p); // Returns if the player is in a combat
boolean hasProtection(Player p); // Returns if the player has an active protection
boolean hasPvPEnabled(Player p); // Returns if the player has pvp enabled
boolean hasBounty(Player p); // Returns if there is a bounty on a player
// Player Methods: (Return a player object)
Player getCurrentOpponent(Player p); // Returns the current combat oppenent of a player
Events
You can listen to these events in your plugin.
Combatlog Event
Gets fired, when a player quits a fight early.
@EventHandler
public void onCombatLog(CombatlogEvent e) {
// Your code here
}
CombatStateChange Event
Gets fired, if the combat state of a player changes (tagged and untagged).
@EventHandler
public void onCombatStateChange(CombatStateChangeEvent e) {
// Your code here
}
e.getState(); // Returns the combat state: CombatState.TAGGED or CombatState.UNTAGGED
PlayerTogglePVPEvent
Gets fired, if the player toggles their pvp.
@EventHandler
public void onPvPToggle(PlayerTogglePVPEvent e) {
// Your code here
}
EntityCombatlogEvent
Gets fired, if the player quits the fight early in a fight with an entity. Can be cancelled.
@EventHandler
public void onEntityCombatlog(EntityCombatlogEvent e) {
// Your code here
}
BountyInitiateEvent
Gets fired, if a bounty is about to get initiated. Can be cancelled.
@EventHandler
public void onBountyCreate(BountyInitiateEvent e) {
// Your code here
}