Void teleport

Discussion in 'Plugin Development' started by Choubatsu, Jul 9, 2019.

Thread Status:
Not open for further replies.
  1. Offline


    How can I make when a player jumps into the void in the middle of the fight to teleport to last stable position and stuck there until he is killed, also that should work only in world that start with BGGame-. Also I don't want a player to die from a fall damage when he teleports? Can someone explain me?
  2. Offline


    Have an EventHandler listen for EntityDamageEvents. If the entity is a player and the DamageCause is VOID, teleport them to their last safe location.

    Your going to need a service that keeps track of players that have been teleported in this way. On the same EntityDamageEvent as above, if the player is in the recently teleported list, and the DamageCause is FALL, cancel the damage event.

    You can use the same service to keep track of the "last stable position". I would suggest scheduling a repeating task every second that checks if a player is on solid ground and if so, save his position.

    Lastly, have a listener for a PlayerMoveEvent. If the player is in the above mentioned teleported list, cancel the event. When a player dies, remove them from the list.

    This way any player that has fallen into the void will be teleported to the place they last touched the ground at. Do keep in mind they will be stuck there until killed.
Thread Status:
Not open for further replies.

Share This Page