Class TownyActionEventExecutor
java.lang.Object
com.palmergames.bukkit.towny.event.executors.TownyActionEventExecutor
An executor class used to check the internal Towny PlayerCache and then
launch the ActionType-based Towny Events. Displays feedback to the player
when an action is cancelled.
- Author:
- LlmDl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canBuild
(org.bukkit.entity.Player player, org.bukkit.block.Block block) Can the player build this material at this location?static boolean
canBuild
(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player build this material at this location?static boolean
canBurn
(org.bukkit.block.Block block) Test is fire can burn this block.static boolean
canDestroy
(org.bukkit.entity.Player player, org.bukkit.block.Block block) Can the player destroy this block?static boolean
canDestroy
(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player destroy this material at this location?static boolean
canExplosionDamageEntities
(org.bukkit.Location loc, org.bukkit.entity.Entity harmedEntity, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) Test if explosions can hurt entities here.static boolean
canItemuse
(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player use items of this material at this location?static boolean
canSwitch
(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player use switches of this material at this location?static boolean
canSwitch
(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat, boolean silent) Can the player use switches of this material at this location?static List
<org.bukkit.block.Block> filterExplodableBlocks
(List<org.bukkit.block.Block> blockList, org.bukkit.Material mat, org.bukkit.entity.Entity entity, org.bukkit.event.Event bukkitExplodeEvent) Filters out blocks which should not be exploded, from a list of blocks which have been caused to explode.
-
Constructor Details
-
TownyActionEventExecutor
public TownyActionEventExecutor()
-
-
Method Details
-
canBuild
public static boolean canBuild(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player build this material at this location?- Parameters:
player
- - Player involved in the event.loc
- - Location of the event.mat
- - Material being involved in the event.- Returns:
- true if allowed.
-
canBuild
public static boolean canBuild(org.bukkit.entity.Player player, org.bukkit.block.Block block) Can the player build this material at this location?- Parameters:
player
- Player involved in the event.block
- The block being built- Returns:
- true if allowed.
-
canDestroy
public static boolean canDestroy(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player destroy this material at this location?- Parameters:
player
- - Player involved in the event.loc
- - Location of the event.mat
- - Material being involved in the event.- Returns:
- true if allowed.
-
canDestroy
public static boolean canDestroy(org.bukkit.entity.Player player, org.bukkit.block.Block block) Can the player destroy this block?- Parameters:
player
- The player attempting to break the block.block
- The block being broken.- Returns:
- true if allowed.
-
canSwitch
public static boolean canSwitch(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player use switches of this material at this location?- Parameters:
player
- - Player involved in the event.loc
- - Location of the event.mat
- - Material being involved in the event.- Returns:
- true if allowed.
-
canSwitch
public static boolean canSwitch(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat, boolean silent) Can the player use switches of this material at this location?- Parameters:
player
- - Player involved in the event.loc
- - Location of the event.mat
- - Material being involved in the event.silent
- Whether to show an error message.- Returns:
- true if allowed.
-
canItemuse
public static boolean canItemuse(org.bukkit.entity.Player player, org.bukkit.Location loc, org.bukkit.Material mat) Can the player use items of this material at this location?- Parameters:
player
- - Player involved in the event.loc
- - Location of the event.mat
- - Material being involved in the event.- Returns:
- true if allowed.
-
filterExplodableBlocks
public static List<org.bukkit.block.Block> filterExplodableBlocks(List<org.bukkit.block.Block> blockList, org.bukkit.Material mat, org.bukkit.entity.Entity entity, org.bukkit.event.Event bukkitExplodeEvent) Filters out blocks which should not be exploded, from a list of blocks which have been caused to explode. First uses Towny's plot permissions to decide whether a block should be filtered out. Then, fires a TownyExplodingBlockEvent which allows Towny's internal war systems, as well as outside plugins to alter the block list that is eventually used.- Parameters:
blockList
- - List of Blocks which might be exploded.mat
- - Material which caused a block explosion.entity
- - Entity which caused a entity explosion.bukkitExplodeEvent
- - The Bukkit Explosion Event that caused this explosion.- Returns:
- filteredBlocks - List of Blocks which are going to be allowed to explode.
-
canExplosionDamageEntities
public static boolean canExplosionDamageEntities(org.bukkit.Location loc, org.bukkit.entity.Entity harmedEntity, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) Test if explosions can hurt entities here. First uses Towny's internal plot permissions and then fires a TownyExplosionDamagesEntityEvent to let Towny's war systems and other plugins decide how to proceed.- Parameters:
loc
- - Location to checkharmedEntity
- - Entity which will be damaged.cause
- - DamageCause which has caused the damage.- Returns:
- true if allowed.
-
canBurn
public static boolean canBurn(org.bukkit.block.Block block) Test is fire can burn this block. First uses Towny's internal plot permission and then fires a TownyBurnEvent to let Towny's war systems and other plugins decide how to proceed.- Parameters:
block
- - Block to check.- Returns:
- true is allowed to burn.
-