Class PlayerTeleportHubEvent

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

public class PlayerTeleportHubEvent extends PlayerEvent implements Cancellable
This event gets called whenever the player gets teleported to the hub.
  • Constructor Details

    • PlayerTeleportHubEvent

      public PlayerTeleportHubEvent(Player player, boolean declineServerMovement)
  • Method Details

    • isDecliningServerMovement

      public boolean isDecliningServerMovement()
      In somce cases the player is only getting teleported to the hub position on the local server.

      This method defines whether the player should never be teleported to an other server or get kicked. Reason being, that the player might get teleported when he e.g. joins the server.

      Returns:
      true when the plugin forbids server movements
    • setCustomImplementationCallback

      public void setCustomImplementationCallback(@Nullable @Nullable Consumer<Runnable> callback)
      This method is used to define a custom implementation for the movement.

      Used e.g. by ProxySync. MBedwars internally puts the player into a state where he isn't able to i.a. receive damage or interact while he is being moved. Movement is delayed due to e.g. async teleportations or async bungee communication.

      There is an internal timeout to avoid a bug in your implementation causing the callback to never be called, which would otherwise result in a memory leak.

      MBedwars will pass you a runnable, in case it accepts your requests of a custom implementation (which it commonly does). Run the given runnable when the movement is done.

      Parameters:
      callback - The callback to be executed when the movement is done
    • getCustomImplementationCallback

      @Nullable public @Nullable Consumer<Runnable> getCustomImplementationCallback()
      This method is used to get the custom implementation callback.
      Returns:
      The callback to be executed when the movement is done
      See Also:
    • getHandlers

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

      public static HandlerList getHandlerList()