Yatopia/patches/Tuinity/patches/api/0003-Per-player-viewdistanc...

113 lines
4.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 29 Jan 2021 16:26:05 -0800
Subject: [PATCH] Per player viewdistances
Add per player no-tick, tick, and send view distances.
Also add send view distance to World.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 98512bddbb0c8bd6a3f487c60b1ec77b274b991e..3da0b1405de508b1b2e1b941c87c0f0ac0ff1e1a 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -3517,6 +3517,26 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
* @param viewDistance view distance in [2, 32]
*/
void setNoTickViewDistance(int viewDistance);
+
+ // Tuinity start - add view distances
+ /**
+ * Gets the sending view distance for this world.
+ * <p>
+ * Sending view distance is the view distance where chunks will load in for players in this world.
+ * </p>
+ * @return The sending view distance for this world.
+ */
+ public int getSendViewDistance();
+
+ /**
+ * Sets the sending view distance for this world.
+ * <p>
+ * Sending view distance is the view distance where chunks will load in for players in this world.
+ * </p>
+ * @param viewDistance view distance in [2, 32] or -1
+ */
+ public void setSendViewDistance(int viewDistance);
+ // Tuinity end - add view distances
// Paper end - view distance api
// Spigot start
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 2ea531eaef8c455fdd503f0c0258813fe9136085..a84ea92d02d34cd48174152e0391f1af6c6b5def 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1768,23 +1768,63 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Gets the view distance for this player
*
* @return the player's view distance
- * @deprecated This is unimplemented and <i>will</i> throw an exception at runtime. The {@link org.bukkit.World World}-based methods still work.
+ * // Tuinity - implemented
* @see org.bukkit.World#getViewDistance()
* @see org.bukkit.World#getNoTickViewDistance()
*/
- @Deprecated
+ //@Deprecated // Tuinity - implemented
public int getViewDistance();
/**
* Sets the view distance for this player
*
* @param viewDistance the player's view distance
- * @deprecated This is unimplemented and <i>will</i> throw an exception at runtime. The {@link org.bukkit.World World}-based methods still work.
+ * // Tuinity - implemented
* @see org.bukkit.World#setViewDistance(int)
* @see org.bukkit.World#setNoTickViewDistance(int)
*/
- @Deprecated
+ //@Deprecated // Tuinity - implemented
public void setViewDistance(int viewDistance);
+
+ // Tuinity start - add view distances api
+ /**
+ * Gets the no-ticking view distance for this player.
+ * <p>
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
+ * be set to tick.
+ * </p>
+ * @return The no-tick view distance for this player.
+ */
+ public int getNoTickViewDistance();
+
+ /**
+ * Sets the no-ticking view distance for this player.
+ * <p>
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
+ * be set to tick.
+ * </p>
+ * @param viewDistance view distance in [2, 32] or -1
+ */
+ public void setNoTickViewDistance(int viewDistance);
+
+ /**
+ * Gets the sending view distance for this player.
+ * <p>
+ * Sending view distance is the view distance where chunks will load in for players.
+ * </p>
+ * @return The sending view distance for this player.
+ */
+ public int getSendViewDistance();
+
+ /**
+ * Sets the sending view distance for this player.
+ * <p>
+ * Sending view distance is the view distance where chunks will load in for players.
+ * </p>
+ * @param viewDistance view distance in [2, 32] or -1
+ */
+ public void setSendViewDistance(int viewDistance);
+ // Tuinity end - add view distances api
// Paper end
/**