summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ServerConfigurationManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/ServerConfigurationManager.java')
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManager.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
index c7bb9f07..de35bc20 100644
--- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java
+++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
@@ -46,6 +46,7 @@ public class ServerConfigurationManager {
// CraftBukkit start
private CraftServer cserver;
+ private int viewDistance;
public ServerConfigurationManager(MinecraftServer minecraftserver) {
minecraftserver.server = new CraftServer(minecraftserver, this);
@@ -58,7 +59,7 @@ public class ServerConfigurationManager {
this.k = minecraftserver.a("banned-ips.txt");
this.l = minecraftserver.a("ops.txt");
this.m = minecraftserver.a("white-list.txt");
- int i = minecraftserver.propertyManager.getInt("view-distance", 10);
+ this.viewDistance = minecraftserver.propertyManager.getInt("view-distance", 10); // CraftBukkit - add field viewDistance
// CraftBukkit - removed playermanagers
this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
@@ -95,7 +96,7 @@ public class ServerConfigurationManager {
public int a() {
// CraftBukkit start
if (this.server.worlds.size() == 0) {
- return this.server.propertyManager.getInt("view-distance", 10) * 16 - 16;
+ return this.viewDistance * 16 - 16; // Use field value
}
return this.server.worlds.get(0).manager.getFurthestViewableBlock();
// CraftBukkit end
@@ -637,4 +638,19 @@ public class ServerConfigurationManager {
entityplayer.updateInventory(entityplayer.defaultContainer);
entityplayer.C();
}
+
+ // CraftBukkit start - getters and setters for viewDistance
+ public void setViewDistance(int viewDistance) {
+ this.viewDistance = viewDistance;
+ }
+
+ public int getViewDistance() {
+ return viewDistance;
+ }
+
+ public void saveViewDistance() {
+ this.server.propertyManager.properties.setProperty("view-distance", Integer.toString(this.viewDistance));
+ this.server.propertyManager.savePropertiesFile();
+ }
+ // CraftBukkit end
}