From 9784623d450268c691810b67c9ae5255e5ed1e34 Mon Sep 17 00:00:00 2001 From: William278 Date: Fri, 16 Apr 2021 14:49:41 +0100 Subject: [PATCH] Expand the HuskHomes API to add methods for teleporting players --- pom.xml | 2 +- .../huskhomes2/api/HuskHomesAPI.java | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2005e95b..4ac72d6e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.William278 HuskHomes - 2.4 + 2.4.1 jar HuskHomes diff --git a/src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java b/src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java index 6738f173..8f5f2ba2 100644 --- a/src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java +++ b/src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java @@ -140,4 +140,35 @@ public class HuskHomesAPI { public TeleportationPoint getSpawnPosition() { return TeleportManager.getSpawnLocation(); } + + /** + * Teleport a player to a specific TeleportationPoint + * @param player The player to be teleported + * @param point The target teleportationPoint + * @param timed Whether or not to do a warmup countdown + * @see TeleportationPoint + */ + public void teleportPlayer(Player player, TeleportationPoint point, boolean timed) { + if (timed) { + TeleportManager.queueTimedTeleport(player, point); + } else { + TeleportManager.teleportPlayer(player, point); + } + } + + /** + * Teleport a player to a specific TeleportationPoint + * @param player The player to be teleported + * @param targetPlayerName The target player's name + * @param timed Whether or not to do a warmup countdown + * @see TeleportationPoint + */ + public void teleportPlayer(Player player, String targetPlayerName, boolean timed) { + if (timed) { + TeleportManager.queueTimedTeleport(player, targetPlayerName); + } else { + TeleportManager.teleportPlayer(player, targetPlayerName); + } + } + }