Default gen/build heights based on minecraft version

This commit is contained in:
dordsor21 2022-01-26 12:29:03 +00:00 committed by Jordan
parent f7dd0c1d38
commit fae95b758a
3 changed files with 28 additions and 4 deletions

View File

@ -238,6 +238,16 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
return this.version; return this.version;
} }
@Override
public int versionMinHeight() {
return serverVersion()[1] >= 18 ? -64 : 0;
}
@Override
public int versionMaxHeight() {
return serverVersion()[1] >= 18 ? 319 : 255;
}
@Override @Override
public @NonNull String serverImplementation() { public @NonNull String serverImplementation() {
return Bukkit.getVersion(); return Bukkit.getVersion();

View File

@ -98,6 +98,20 @@ public interface PlotPlatform<P> extends LocaleHolder {
*/ */
int[] serverVersion(); int[] serverVersion();
/**
* Gets the default minimum world height for the version of Minecraft that the server is running.
*
* @return minimum world height
*/
int versionMinHeight();
/**
* Gets the default maximum world height for the version of Minecraft that the server is running.
*
* @return maximum world height
*/
int versionMaxHeight();
/** /**
* Gets the server implementation name and version * Gets the server implementation name and version
* *

View File

@ -142,10 +142,10 @@ public abstract class PlotArea {
private boolean homeAllowNonmember = false; private boolean homeAllowNonmember = false;
private BlockLoc nonmemberHome; private BlockLoc nonmemberHome;
private BlockLoc defaultHome; private BlockLoc defaultHome;
private int maxBuildHeight = 255; private int maxBuildHeight = PlotSquared.platform().versionMaxHeight();
private int minBuildHeight = 1; private int minBuildHeight = PlotSquared.platform().versionMinHeight() + 1;
private int maxGenHeight = 255; private int maxGenHeight = PlotSquared.platform().versionMaxHeight();
private int minGenHeight = 0; private int minGenHeight = PlotSquared.platform().versionMinHeight();
private GameMode gameMode = GameModes.CREATIVE; private GameMode gameMode = GameModes.CREATIVE;
private Map<String, PlotExpression> prices = new HashMap<>(); private Map<String, PlotExpression> prices = new HashMap<>();
private List<String> schematics = new ArrayList<>(); private List<String> schematics = new ArrayList<>();