From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 18:05:37 -0600
Subject: [PATCH] Add view distance API
Add per player no-tick, tick, and send view distances.
Also add send/no-tick view distance to World.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 1a71d628d9f593157d92f0c9fda9d3214c138352..cc4e72335d8c66c8081ce64149ce3ac377e03323 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2661,6 +2661,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
int getSimulationDistance();
// Spigot end
+ // Paper start - view distance api
+ /**
+ * Sets the view distance for this world.
+ * @param viewDistance view distance in [2, 32]
+ */
+ void setViewDistance(int viewDistance);
+
+ * Sets the simulation distance for this world.
+ * @param simulationDistance simulation distance in [2, 32]
+ void setSimulationDistance(int simulationDistance);
+ * Returns the no-tick view distance for this world.
+ * <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 world.
+ * @deprecated Use {@link #getViewDistance()}
+ @Deprecated
+ int getNoTickViewDistance();
+ * Sets the no-tick view distance for this world.
+ * @deprecated Use {@link #setViewDistance(int)}
+ void setNoTickViewDistance(int viewDistance);
+ * Gets the sending view distance for this world.
+ * Sending view distance is the view distance where chunks will load in for players in this world.
+ * @return The sending view distance for this world.
+ int getSendViewDistance();
+ * Sets the sending view distance for this world.
+ * @param viewDistance view distance in [2, 32] or -1
+ void setSendViewDistance(int viewDistance);
+ // Paper end - view distance api
// Spigot start
public class Spigot {
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 6d68274302fc36dd7d32cf6fb2889f86baebab89..70f2cb3126a06079b31b7ea36501ce5253a805fe 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1996,6 +1996,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param affects Whether the player can affect mob spawning
*/
public void setAffectsSpawning(boolean affects);
+ * Gets the view distance for this player
+ *
+ * @return the player's view distance
+ * @see org.bukkit.World#getViewDistance()
+ public int getViewDistance();
+ * Sets the view distance for this player
+ * @param viewDistance the player's view distance
+ * @see org.bukkit.World#setViewDistance(int)
+ public void setViewDistance(int viewDistance);
+ * Gets the simulation distance for this player
+ * @return the player's simulation distance
+ public int getSimulationDistance();
+ * Sets the simulation distance for this player
+ * @param simulationDistance the player's new simulation distance
+ public void setSimulationDistance(int simulationDistance);
+ * Gets the no-ticking view distance for this player.
+ * @return The no-tick view distance for this player.
+ public int getNoTickViewDistance();
+ * Sets the no-ticking view distance for this player.
+ public void setNoTickViewDistance(int viewDistance);
+ * Gets the sending view distance for this player.
+ * Sending view distance is the view distance where chunks will load in for players.
+ * @return The sending view distance for this player.
+ public int getSendViewDistance();
+ * Sets the sending view distance for this player.
+ public void setSendViewDistance(int viewDistance);
// Paper end
/**