Class CombatUtil
java.lang.Object
com.palmergames.bukkit.towny.utils.CombatUtil
- Author:
- ElgarL,Shade,LlmDl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareAllAllies(List<Nation> possibleAllies) Test if all the listed nations are alliesstatic booleanareAllFriends(List<Resident> possibleFriends) Test if all the listed residents are friendsstatic booleanIs the resident B an ally of resident A?static booleanIs town b an ally of town a?static booleanIs the defending resident an ally of the attacking resident?static booleanisArenaPlot(TownBlock attackerTB, TownBlock defenderTB) Return true if both TownBlocks are Arena plots.static booleanisArenaPlot(org.bukkit.entity.Player attacker, org.bukkit.entity.Player defender) Returns true if both players are in an arena townblock.static booleanIs the resident B an enemy of resident A?static booleanIs town b an enemy of town a?static booleanIs resident b an enemy of resident a?static booleanisEnemyTownBlock(org.bukkit.entity.Player player, WorldCoord worldCoord) Does this WorldCoord fall within a plot owned by an enemy town?static booleanisSameNation(Resident a, Resident b) Is resident a in a nation with resident b?static booleanisSameNation(Town a, Town b) Is town b in a nation with town a?static booleanisSameTown(Resident a, Resident b) Is resident a in a town with resident b?static booleanisSameTown(Town a, Town b) Is town b the same town as town a?static booleanisWorldPvP(TownyWorld world) Is PvP enabled in this world?static booleanpreventDamageCall(org.bukkit.entity.Entity attacker, org.bukkit.entity.Entity defender, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) Tests the attacker against defender to see if we need to cancel the damage event due to world PvP, Plot PvP or Friendly Fire settings.static booleanpreventDispenserDamage(org.bukkit.block.Block dispenser, org.bukkit.entity.Entity entity, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) static booleanpreventFriendlyFire(org.bukkit.entity.Player attacker, org.bukkit.entity.Player defender, TownyWorld world) Should we be preventing friendly fire?static booleanpreventPvP(TownyWorld world, TownBlock townBlock) Is PvP disabled in this TownBlock?
-
Constructor Details
-
CombatUtil
public CombatUtil()
-
-
Method Details
-
preventDamageCall
public static boolean preventDamageCall(org.bukkit.entity.Entity attacker, org.bukkit.entity.Entity defender, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) Tests the attacker against defender to see if we need to cancel the damage event due to world PvP, Plot PvP or Friendly Fire settings. Only allow a Wolves owner to cause it damage, and residents with destroy permissions to damage passive animals and villagers while in a town.- Parameters:
attacker- - Entity attacking the Defenderdefender- - Entity defending from the Attackercause- - The DamageCause behind this DamageCall.- Returns:
- true if we should cancel.
-
preventPvP
Is PvP disabled in this TownBlock?- Parameters:
world- - World to check if TownBlock is NULLtownBlock- - TownBlock to check- Returns:
- true if PvP is disallowed
-
isWorldPvP
Is PvP enabled in this world?- Parameters:
world- - World to check- Returns:
- true if the world is PvP
-
preventFriendlyFire
public static boolean preventFriendlyFire(org.bukkit.entity.Player attacker, org.bukkit.entity.Player defender, TownyWorld world) Should we be preventing friendly fire?- Parameters:
attacker- - Attacking Playerdefender- - Defending Player (receiving damage)world- - TownyWorld being tested.- Returns:
- true if we should cancel damage.
-
isArenaPlot
public static boolean isArenaPlot(org.bukkit.entity.Player attacker, org.bukkit.entity.Player defender) Returns true if both players are in an arena townblock.- Parameters:
attacker- Attacking Playerdefender- Defending Player- Returns:
- true if both player in an Arena plot.
-
isArenaPlot
-
isAlly
Is the defending resident an ally of the attacking resident?- Parameters:
attackingResident- - Attacking Resident (String)defendingResident- - Defending Resident (Receiving Damage; String)- Returns:
- true if the defender is an ally of the attacker.
-
isAlly
-
isAlly
-
isSameNation
-
isSameTown
-
isSameNation
-
isSameTown
-
areAllAllies
-
areAllFriends
-
isEnemy
-
isEnemy
-
isEnemy
-
isEnemyTownBlock
Does this WorldCoord fall within a plot owned by an enemy town?- Parameters:
player- - PlayerworldCoord- - Location- Returns:
- true if it is an enemy plot.
-
preventDispenserDamage
public static boolean preventDispenserDamage(org.bukkit.block.Block dispenser, org.bukkit.entity.Entity entity, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause)
-