Skip to content

Commit

Permalink
Check height settings.
Browse files Browse the repository at this point in the history
Fixes #39
  • Loading branch information
tastybento committed Feb 29, 2020
1 parent 2539919 commit af47c48
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/world/bentobox/skygrid/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public class Settings implements WorldSettings {
private int islandStartZ = 0;

@ConfigComment("SkyGrid height")
@ConfigComment("This is the height of the top sky grid layer")
@ConfigComment("This is the height of the top sky grid layer. 255 max.")
@ConfigEntry(path = "world.skygrid-height")
private int islandHeight = 128;

Expand Down Expand Up @@ -181,7 +181,7 @@ public class Settings implements WorldSettings {
@ConfigComment("if the PREVENT_TELEPORT_WHEN_FALLING world setting flag is active")
@ConfigEntry(path = "world.falling-banned-commands")
private List<String> fallingBannedCommands = new ArrayList<>();

// ---------------------------------------------

/* PROTECTED AREA */
Expand Down Expand Up @@ -302,7 +302,7 @@ public class Settings implements WorldSettings {
@ConfigComment("Note this option has no effect if the delay (see the option above) is set to 0 or less.")
@ConfigEntry(path = "area.create-area-on-first-login.abort-on-logout")
private boolean createIslandOnFirstLoginAbortOnLogout = true;

// Commands
@ConfigComment("List of commands to run when a player joins.")
@ConfigEntry(path = "area.commands.on-join")
Expand Down Expand Up @@ -514,13 +514,17 @@ public void setIslandStartZ(int islandStartZ) {
*/
@Override
public int getIslandHeight() {
if (islandHeight > 255) islandHeight = 255;
else if (islandHeight < 0) islandHeight = 0;
return islandHeight;
}

/**
* @param islandHeight the islandHeight to set
*/
public void setIslandHeight(int islandHeight) {
if (islandHeight > 255) islandHeight = 255;
else if (islandHeight < 0) islandHeight = 0;
this.islandHeight = islandHeight;
}

Expand Down

2 comments on commit af47c48

@BONNe
Copy link
Member

@BONNe BONNe commented on af47c48 Feb 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be handled by BenyoBox core?

@tastybento
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be handled as well in BentoBox core but it should be handled here too because this is where the value can actually be reset and warnings given, etc. BentoBox core can have a cap on the height as world.getMaxHeight() - 1 though. I'll add it.

Please sign in to comment.