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
Return true if both TownBlocks are Arena plots.- Parameters:
attackerTB- TownBlock being tested.defenderTB- TownBlock being tested.- Returns:
- true if both TownBlocks are Arena plots.
-
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
Is the resident B an ally of resident A?- Parameters:
a- - Resident A in comparisonb- - Resident B in comparison- Returns:
- true if they are allies.
-
isAlly
Is town b an ally of town a?- Parameters:
a- - Town A in comparisonb- - Town B in comparison- Returns:
- true if they are allies.
-
isSameNation
Is town b in a nation with town a?- Parameters:
a- - Town A in comparisonb- - Town B in comparison- Returns:
- true if they are in the same nation.
-
isSameTown
Is town b the same town as town a?- Parameters:
a- - Town A in comparisonb- - Town B in comparison- Returns:
- true if they are allies.
-
isSameNation
Is resident a in a nation with resident b?- Parameters:
a- - Resident A in comparison.b- - Resident B in comparison.- Returns:
- true if they are in the same nation.
-
isSameTown
Is resident a in a town with resident b?- Parameters:
a- - Resident A in comparison.b- - Resident B in comparison.- Returns:
- true if they are in the same town.
-
areAllAllies
Test if all the listed nations are allies- Parameters:
possibleAllies- - List of Nations (List<Nation>)- Returns:
- true if they are all allies
-
areAllFriends
Test if all the listed residents are friends- Parameters:
possibleFriends- - List of Residents (List<Resident>)- Returns:
- true if they are all friends
-
isEnemy
Is resident b an enemy of resident a?- Parameters:
a- - Resident A in comparison (String)b- - Resident B in comparison (String)- Returns:
- true if b is an enemy.
-
isEnemy
Is the resident B an enemy of resident A?- Parameters:
a- - Resident A in comparisonb- - Resident B in comparison- Returns:
- true if B is an enemy.
-
isEnemy
Is town b an enemy of town a?- Parameters:
a- - Town A in comparisonb- - Town B in comparison- Returns:
- true if b is an enemy.
-
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)
-