Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9e75f0
commit 0c0b9dc
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
src/main/java/me.angeschossen.lands.api/events/player/PlayerRandomTeleportEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package me.angeschossen.lands.api.events.player; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import me.angeschossen.lands.api.events.internal.plugin.LandsPlayerEvent; | ||
import me.angeschossen.lands.api.land.Area; | ||
import me.angeschossen.lands.api.player.LandPlayer; | ||
import org.bukkit.Location; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Collection; | ||
import java.util.UUID; | ||
|
||
public class PlayerRandomTeleportEvent extends LandsPlayerEvent implements Cancellable { | ||
public static final HandlerList handlerList = new HandlerList(); | ||
private final @NotNull Location destination; | ||
private boolean cancelled = false; | ||
|
||
public PlayerRandomTeleportEvent(@NotNull LandPlayer landPlayer, @NotNull Location location) { | ||
super(landPlayer); | ||
|
||
this.destination = location; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlerList; | ||
} | ||
|
||
@NotNull | ||
public Location getDestination() { | ||
return destination; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlerList; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancelled) { | ||
this.cancelled = cancelled; | ||
} | ||
|
||
@Override | ||
public void setExpressionVariables(ImmutableMap.@NotNull Builder<String, Object> builder) { | ||
super.setExpressionVariables(builder); | ||
|
||
builder.put("destination_world", destination.getWorld().getName()) | ||
.put("destination_x", destination.getBlockX()) | ||
.put("destination_y", destination.getBlockY()) | ||
.put("destination_z", destination.getBlockZ()); | ||
} | ||
} |