Class Ollivanders2OwlPost

java.lang.Object
net.pottercraft.ollivanders2.Ollivanders2OwlPost

public class Ollivanders2OwlPost extends Object
In newer versions of MC triggering teleport events from AsyncChatEvents is no longer thread-safe. Need to create a queue of owl post events like we use for things like spell projectiles and effects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The words the player has to say to trigger owl post
    static final org.bukkit.entity.EntityType
    The delivery entity type
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDelivery(@NotNull org.bukkit.entity.Player from, @NotNull UUID to, @NotNull org.bukkit.entity.Entity entity, @NotNull org.bukkit.inventory.ItemStack item)
    Add a delivery to the delivery queue
    void
    Cleanup when the plugin disables.
    void
    processOwlPostRequest(@NotNull org.bukkit.entity.Player player, @NotNull String message)
    Process an owl post request by a player.
    void
    Run the game tick upkeep for owl post deliveries

    Methods inherited from class java.lang.Object

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

    • deliveryKeyword

      public static final String deliveryKeyword
      The words the player has to say to trigger owl post
      See Also:
    • owlPostEntityType

      public static final org.bukkit.entity.EntityType owlPostEntityType
      The delivery entity type
  • Constructor Details

    • Ollivanders2OwlPost

      public Ollivanders2OwlPost(@NotNull @NotNull Ollivanders2 plugin)
      Constructor
      Parameters:
      plugin - a callback to the plugin
  • Method Details

    • addDelivery

      public void addDelivery(@NotNull @NotNull org.bukkit.entity.Player from, @NotNull @NotNull UUID to, @NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull org.bukkit.inventory.ItemStack item)
      Add a delivery to the delivery queue
      Parameters:
      from - UUID of the player sending the delivery
      to - UUID of the player receiving the delivery
      entity - the delivery
      item - the item to deliver
    • processOwlPostRequest

      public void processOwlPostRequest(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String message)
      Process an owl post request by a player.
      Parameters:
      player - the player requesting delivery
      message - the delivery request message
    • upkeep

      public void upkeep()
      Run the game tick upkeep for owl post deliveries
    • onDisable

      public void onDisable()
      Cleanup when the plugin disables.

      Called when the Ollivanders2 plugin is being shut down. Currently, the Ollivanders2OwlPost manager does not perform any persistence of pending deliveries. Owl post deliveries are queued in memory only and will be lost when the server shuts down. This is a temporary limitation that may be addressed in future versions.

      Future Enhancement:

      See Also: