Class DelayedTeleportEvent
java.lang.Object
com.datdeveloper.datmoddingapi.delayedEvents.TimeDelayedEvent
com.datdeveloper.datmoddingapi.delayedEvents.DelayedTeleportEvent
- All Implemented Interfaces:
IDelayedEvent
A Delayed Event to teleport the player to a specific location after a set amount of time
Cancels if the player moves
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.minecraft.core.BlockPos
The position the player will teleport toprotected net.minecraft.resources.ResourceKey
<net.minecraft.world.level.Level> The level the player will teleport toprotected net.minecraft.server.level.ServerPlayer
The Player being teleportedprotected net.minecraft.core.BlockPos
The starting position of the player Used to calculate if the event should cancel for the player movingFields inherited from class com.datdeveloper.datmoddingapi.delayedEvents.TimeDelayedEvent
exeTime
-
Constructor Summary
ConstructorsConstructorDescriptionDelayedTeleportEvent
(net.minecraft.core.BlockPos destinationPos, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> destinationWorld, net.minecraft.server.level.ServerPlayer player, int delay) -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
The code that will execute when the delay has passedboolean
shouldRequeue
(boolean hasFinished) Checks to see if the code should be requeued to continue waiting to be executed Can be used to restart the delay for the eventMethods inherited from class com.datdeveloper.datmoddingapi.delayedEvents.TimeDelayedEvent
canExecute
-
Field Details
-
destinationPos
protected net.minecraft.core.BlockPos destinationPosThe position the player will teleport to -
destinationWorld
protected net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> destinationWorldThe level the player will teleport to -
player
protected net.minecraft.server.level.ServerPlayer playerThe Player being teleported -
startingPos
protected net.minecraft.core.BlockPos startingPosThe starting position of the player Used to calculate if the event should cancel for the player moving
-
-
Constructor Details
-
DelayedTeleportEvent
public DelayedTeleportEvent(net.minecraft.core.BlockPos destinationPos, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> destinationWorld, net.minecraft.server.level.ServerPlayer player, int delay) - Parameters:
destinationPos
- The position the player will teleport todestinationWorld
- The level the player will teleport toplayer
- The player being teleporteddelay
- The delay in seconds before the player teleports
-
-
Method Details
-
execute
public void execute()Description copied from interface:IDelayedEvent
The code that will execute when the delay has passed -
shouldRequeue
public boolean shouldRequeue(boolean hasFinished) Description copied from interface:IDelayedEvent
Checks to see if the code should be requeued to continue waiting to be executed Can be used to restart the delay for the event- Specified by:
shouldRequeue
in interfaceIDelayedEvent
- Overrides:
shouldRequeue
in classTimeDelayedEvent
- Parameters:
hasFinished
- True if the event has executed- Returns:
- True if the event should be requeued
-