Files
Purpur/patches/api/0044-Extended-OfflinePlayer-API.patch
William Blake Galbreath 69c7c31f9a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
26c37d99d5 create random seeds for features using SecureRandom
589bf2f1bf Upgrade gson to 2.8.8 (Closes #6370)
0a6103597b Get entity default attributes (#6449)
40057019e0 Correctly inflate villager activation bounding box (#6798)
e5f9241d15 Left handed API (#6775)
40ee63496c Add advancement display API (#6175)
9d570042ed Add ItemFactory#getMonsterEgg API (#6772)
55ca459515 rename method to getSpawnEgg
bb397ba74c Add critical damage API (#6275)
f47aeafe00 Add Horse Animation API (#5599)
7a0886180f AT & Mapping fixes (#6809)
5553432644 docs: Update gradle instructions for Java 16 (#6811) [ci skip]
a1f49e4c60 Fix command suggestion leak (#6592)
9472d38f3c Fix method name for Critical damage (#6813)
2021-10-21 10:58:20 -05:00

126 lines
4.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YouHaveTrouble <youhavetrouble@youhavetrouble.me>
Date: Sun, 22 Aug 2021 05:11:09 +0200
Subject: [PATCH] Extended OfflinePlayer API
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index 7838731e0e16bdccfb79e74ceb64148f7c52db79..8ea59406ddb2293af66719a893e6f13d8377b81e 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -437,4 +437,114 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* for the statistic
*/
public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue);
+
+ // Purpur start - OfflinePlayer API
+ /**
+ * Determines if the OfflinePlayer is allowed to fly via jump key double-tap like
+ * in creative mode.
+ *
+ * @return True if the player is allowed to fly.
+ */
+ public boolean getAllowFlight();
+
+ /**
+ * Sets if the OfflinePlayer is allowed to fly via jump key double-tap like in
+ * creative mode.
+ *
+ * @param flight If flight should be allowed.
+ */
+ public void setAllowFlight(boolean flight);
+
+ /**
+ * Checks to see if this player is currently flying or not.
+ *
+ * @return True if the player is flying, else false.
+ */
+ public boolean isFlying();
+
+ /**
+ * Makes this player start or stop flying.
+ *
+ * @param value True to fly.
+ */
+ public void setFlying(boolean value);
+
+ /**
+ * Sets the speed at which a client will fly. Negative values indicate
+ * reverse directions.
+ *
+ * @param value The new speed, from -1 to 1.
+ * @throws IllegalArgumentException If new speed is less than -1 or
+ * greater than 1
+ */
+ public void setFlySpeed(float value) throws IllegalArgumentException;
+
+ /**
+ * Sets the speed at which a client will walk. Negative values indicate
+ * reverse directions.
+ *
+ * @param value The new speed, from -1 to 1.
+ * @throws IllegalArgumentException If new speed is less than -1 or
+ * greater than 1
+ */
+ public void setWalkSpeed(float value) throws IllegalArgumentException;
+
+ /**
+ * Gets the current allowed speed that a client can fly.
+ *
+ * @return The current allowed speed, from -1 to 1
+ */
+ public float getFlySpeed();
+
+ /**
+ * Gets the current allowed speed that a client can walk.
+ *
+ * @return The current allowed speed, from -1 to 1
+ */
+ public float getWalkSpeed();
+
+ /**
+ * Gets the entity's current position
+ *
+ * @return a new copy of Location containing the position of this offline player
+ */
+ @Nullable
+ public Location getLocation();
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.
+ *
+ * @param destination
+ * @return true if teleportation was successful
+ */
+ public boolean teleportOffline(@NotNull org.bukkit.Location destination);
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.
+ *
+ * @param destination
+ * @param cause Teleport cause used if player is online
+ * @return true if teleportation was successful
+ */
+ public boolean teleportOffline(@NotNull org.bukkit.Location destination, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.
+ *
+ * @param destination
+ * @return <code>true</code> if teleportation successful
+ */
+ @NotNull
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination);
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.
+ *
+ * @param destination
+ * @param cause Teleport cause used if player is online
+ * @return <code>true</code> if teleportation successful
+ */
+ @NotNull
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
+ // Purpur end - OfflinePlayer API
}