Class PlayerModifyBlockPermissionEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.PlayerModifyBlockPermissionEvent
All Implemented Interfaces:
ArenaEvent

public class PlayerModifyBlockPermissionEvent extends PlayerEvent implements ArenaEvent
Gets called when we want to know whether a player is permitted to modify a block.

It may gets called directly with Bukkit's BlockPlaceEvent and BlockBreakEvent. In other cases, it may get called e.g. if a special item places multiple blocks, in which case getBukkitEvent() returns null.

  • Constructor Details

    • PlayerModifyBlockPermissionEvent

      public PlayerModifyBlockPermissionEvent(Player player, Arena arena, Block block, @Nullable @Nullable BlockEvent bukkitEvent)
  • Method Details

    • getArena

      public Arena getArena()
      Description copied from interface: ArenaEvent
      Returns the Arena that is involved in this event.
      Specified by:
      getArena in interface ArenaEvent
      Returns:
      The arena that is involved
    • getBukkitEvent

      @Nullable public @Nullable BlockEvent getBukkitEvent()
      Returns the original block event with which we're dealing now.

      Cancelling it at this point has no effect, as we're manually overriding it directly after this event.

      Returns:
      The original bukkit event. May be null if this check was done outside of a block event
    • getBlock

      public Block getBlock()
      Returns the block with which we're dealing now.
      Returns:
      The block involved in this event
    • isPlaceEvent

      public boolean isPlaceEvent()
      Whether the player tries to place a block.
      Returns:
      true when the player tries to place a block
    • isBreakEvent

      public boolean isBreakEvent()
      Whether the player tries to break a block.
      Returns:
      true when the player tries to break a block
    • isIssuePresent

      public boolean isIssuePresent(PlayerModifyBlockPermissionEvent.Issue issue)
      Returns whether the given issue is present.

      Issues prevent the BlockEvent from progressing, meaning that block won't be placed or breaked.

      Parameters:
      issue - The issue
      Returns:
      true when it's actually an issue
    • setIssuePresent

      public void setIssuePresent(PlayerModifyBlockPermissionEvent.Issue issue, boolean present)
      Set whether an issue is present.

      Issues prevent the BlockEvent from progressing, meaning that block won't be placed or breaked.

      Parameters:
      issue - The issue
      present - true when it's present
    • hasIssues

      public boolean hasIssues()
      Returns when there are any issues that cause the original BukkitEvent to get cancelled.
      Returns:
      truew hen there's at least one issue
    • removeIssues

      public void removeIssues()
      Removes all existing issues.
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()