mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 00:22:08 -07:00
Implements interface for changing the view distance.
Uses default view distance if player's view distance is not set Throws an illegal argument exception if view distance is set too high or too low. Pushes notifications of server and world view distance changes to the player. Move view distance functions from PlayerManger to WorldServer. Set player minimum view distance to 1 for now. Reset player's 'last known' position when recalculating visible chunks. Use per-player view distance in chunk distance checks
This commit is contained in:
@@ -275,10 +275,6 @@ public final class CraftServer implements Server {
|
||||
return this.getConfigInt("server-port", 25565);
|
||||
}
|
||||
|
||||
public int getViewDistance() {
|
||||
return this.getConfigInt("view-distance", 10);
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return this.getConfigString("server-ip", "");
|
||||
}
|
||||
@@ -754,6 +750,22 @@ public final class CraftServer implements Server {
|
||||
return this.console.allowFlight;
|
||||
}
|
||||
|
||||
public int getViewDistance() {
|
||||
return server.getViewDistance();
|
||||
}
|
||||
|
||||
public void setViewDistance(int viewDistance) throws IllegalArgumentException{
|
||||
server.setViewDistance(viewDistance);
|
||||
updateViewDistance();
|
||||
server.saveViewDistance();
|
||||
}
|
||||
|
||||
public void updateViewDistance() {
|
||||
for (World world : worlds.values()) {
|
||||
((CraftWorld) world).updateViewDistance();
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkGenerator getGenerator(String world) {
|
||||
ConfigurationNode node = configuration.getNode("worlds");
|
||||
ChunkGenerator result = null;
|
||||
|
Reference in New Issue
Block a user