From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux 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 c58b1885662c6a234ffee75995051c9750c1a512..7b1fb280a86ab44756fc233b085f878d2a27ad66 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -2450,6 +2450,52 @@ 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); + + /** + * Returns the no-tick view distance for this world. + *

+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not + * be set to tick. + *

+ * @return The no-tick view distance for this world. + */ + int getNoTickViewDistance(); + + /** + * Sets the no-tick view distance for this world. + *

+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not + * be set to tick. + *

+ * @param viewDistance view distance in [2, 32] + */ + 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. + */ + public int getSendViewDistance(); + + /** + * Sets the sending view distance for this world. + *

+ * Sending view distance is the view distance where chunks will load in for players in this world. + *

+ * @param viewDistance view distance in [2, 32] or -1 + */ + public 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 a6f6dea965eee2de2183f189580d1b7141a9308f..bf60cc1beed41f6dc30b0df0bae9b937ddfa5553 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -1760,6 +1760,62 @@ 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() + * @see org.bukkit.World#getNoTickViewDistance() + */ + public int getViewDistance(); + + /** + * Sets the view distance for this player + * + * @param viewDistance the player's view distance + * @see org.bukkit.World#setViewDistance(int) + * @see org.bukkit.World#setNoTickViewDistance(int) + */ + public void setViewDistance(int viewDistance); + + /** + * Gets the no-ticking view distance for this player. + *

+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not + * be set to tick. + *

+ * @return The no-tick view distance for this player. + */ + public int getNoTickViewDistance(); + + /** + * Sets the no-ticking view distance for this player. + *

+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not + * be set to tick. + *

+ * @param viewDistance view distance in [2, 32] or -1 + */ + 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. + *

+ * Sending view distance is the view distance where chunks will load in for players. + *

+ * @param viewDistance view distance in [2, 32] or -1 + */ + public void setSendViewDistance(int viewDistance); // Paper end /**