Skip to content

Commit

Permalink
Added settings for structures and stronghold generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Mar 4, 2021
1 parent e9ae0d7 commit 816e1e8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/world/bentobox/boxed/Boxed.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Boxed extends GameModeAddon {
.type(Type.PROTECTION)
.defaultRank(RanksManager.OWNER_RANK)
.build();

private static final String NETHER = "_nether";
private static final String THE_END = "_the_end";

Expand All @@ -65,8 +65,12 @@ public void onLoad() {
.createCustomGenerator(wordRef, generator -> {
// Set the noise generator
generator.setBaseNoiseGenerator(new BasicWorldGenerator(this, wordRef, getSettings().getSeed()));
//generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.SURFACE_STRUCTURES);
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.STRONGHOLDS);
if (getSettings().isAllowStructures()) {
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.SURFACE_STRUCTURES);
}
if (getSettings().isAllowStrongholds()) {
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.STRONGHOLDS);
}
generator.setBiomeGenerator(new BoxedBiomeGenerator(this));
});
// Register commands
Expand Down Expand Up @@ -110,7 +114,7 @@ public void onEnable(){
MOVE_BOX.setGameModes(Collections.singleton(this));
// Register protection flag with BentoBox
getPlugin().getFlagsManager().registerFlag(this, MOVE_BOX);

}

@Override
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/world/bentobox/boxed/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public class Settings implements WorldSettings {
@ConfigComment("Other plugins may override this setting")
@ConfigEntry(path = "world.difficulty")
private Difficulty difficulty = Difficulty.NORMAL;

@ConfigComment("Allow surface structures - villages, shipwrecks, broken portals, etc.")
@ConfigComment("These will be randomly placed, so may not be available for every player.")
@ConfigEntry(path = "world.allow-structures", needsRestart = true)
private boolean allowStructures = true;

@ConfigComment("Allow strongholds.")
@ConfigComment("These will be randomly placed, so may not be available for every player.")
@ConfigEntry(path = "world.allow-strongholds", experimental = true, needsRestart = true)
private boolean allowStrongholds = false;

@ConfigComment("Spawn limits. These override the limits set in bukkit.yml")
@ConfigComment("If set to a negative number, the server defaults will be used")
Expand Down Expand Up @@ -1628,4 +1638,32 @@ public boolean isCheckForBlocks() {
// Do not check for blocks when looking for a new island spot
return false;
}

/**
* @return the allowStructures
*/
protected boolean isAllowStructures() {
return allowStructures;
}

/**
* @param allowStructures the allowStructures to set
*/
protected void setAllowStructures(boolean allowStructures) {
this.allowStructures = allowStructures;
}

/**
* @return the allowStrongholds
*/
protected boolean isAllowStrongholds() {
return allowStrongholds;
}

/**
* @param allowStrongholds the allowStrongholds to set
*/
protected void setAllowStrongholds(boolean allowStrongholds) {
this.allowStrongholds = allowStrongholds;
}
}

0 comments on commit 816e1e8

Please sign in to comment.