Class REListener

java.lang.Object
me.EtienneDx.RealEstate.REListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class REListener extends Object implements org.bukkit.event.Listener
The REListener class handles various RealEstate-related events, such as sign changes, player interactions with signs, and block break events.

This listener ensures that RealEstate transaction rules are enforced when players interact with claim-related signs.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new REListener instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onBreakBlock(org.bukkit.event.block.BlockBreakEvent event)
    Handles block break events for RealEstate signs.
    void
    onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
    Handles player interaction events with RealEstate signs.
    void
    onSignChange(org.bukkit.event.block.SignChangeEvent event)
    Handles sign change events.

    Methods inherited from class java.lang.Object

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

    • REListener

      public REListener()
      Constructs a new REListener instance.
  • Method Details

    • onSignChange

      public void onSignChange(org.bukkit.event.block.SignChangeEvent event)
      Handles sign change events.

      This method checks if the sign being changed is intended for a RealEstate transaction (sell, rent, lease, container rent, or auction) based on its first line. It validates the sign’s contents (price, duration, permissions, etc.) and, if valid, creates the appropriate transaction. If any check fails, the event is cancelled and the sign is broken.

      Parameters:
      event - the SignChangeEvent triggered when a sign is changed
    • onPlayerInteract

      public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
      Handles player interaction events with RealEstate signs.

      When a player right-clicks a block with a sign, if it is a RealEstate sign, this method either previews the transaction (if the player is sneaking) or initiates an interaction with the transaction.

      Parameters:
      event - the player interact event
    • onBreakBlock

      public void onBreakBlock(org.bukkit.event.block.BlockBreakEvent event)
      Handles block break events for RealEstate signs.

      When a RealEstate sign is broken, this method checks whether the player breaking the sign has the proper permissions. If the player is not authorized, the event is cancelled. If authorized, the method attempts to cancel the transaction associated with the sign.

      Parameters:
      event - the block break event