Class BagListener

java.lang.Object
valorless.havenbags.BagListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class BagListener extends Object implements org.bukkit.event.Listener
Listener for handling player interactions with bags. This class manages the opening of bags, ensuring proper permissions, cooldowns, and bag ownership checks are enforced.

To activate this listener, call the static init() method during your plugin's startup.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    creationLimit(org.bukkit.entity.Player player)
     
    static int
    getPlayerBagLimit(org.bukkit.entity.Player player)
     
    final org.bukkit.block.Block
    getTargetBlock(org.bukkit.entity.Player player, int range)
     
    static void
    Initializes the BagListener by registering it with the Bukkit event system.
    void
    onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
    Handles player interactions with bags.
    void
    onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event)
    Handles player login events to clear any existing cooldowns.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BagListener

      public BagListener()
  • Method Details

    • init

      public static void init()
      Initializes the BagListener by registering it with the Bukkit event system. This method should be called during plugin startup to ensure the listener is active.
    • onPlayerQuit

      public void onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event)
      Handles player login events to clear any existing cooldowns.
      Parameters:
      event - The PlayerJoinEvent triggered when a player joins the server.
    • onPlayerInteract

      public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
      Handles player interactions with bags.
      Parameters:
      event - The PlayerInteractEvent triggered by the player.
    • getTargetBlock

      public final org.bukkit.block.Block getTargetBlock(org.bukkit.entity.Player player, int range)
    • getPlayerBagLimit

      public static int getPlayerBagLimit(org.bukkit.entity.Player player)
    • creationLimit

      public boolean creationLimit(org.bukkit.entity.Player player)