Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
#	src/main/java/world/bentobox/caveblock/generators/populators/EntitiesPopulator.java
  • Loading branch information
BONNe committed Jan 28, 2022
2 parents 1fdf5eb + 7bbcd40 commit e6e3c97
Show file tree
Hide file tree
Showing 23 changed files with 2,652 additions and 1,667 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ hs_err_pid*
/.classpath
/.project
/.settings/
/.idea/
/CaveBlock.iml
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,24 @@ CaveBlock is an addon for BentoBox, so to run CaveBlock, you must have BentoBox

## Translation

As most of BentoBox projects, CaveBlock Addon is translatable in any language. Everyone can contribute, and translate some parts of the addon in their language via [GitLocalize](https://gitlocalize.com/repo/2968).
If your language is not in the list, please contact to developers via Discord and it will be added there.
Like most BentoBox projects, the CaveBlock Addon is translatable into any language. Everyone can contribute, and translate some parts of the addon into their language via [GitLocalize](https://gitlocalize.com/repo/2968).
If your language is not in the list, please contact the developers via Discord, and it will be added.

## Installation

0. Install BentoBox and run it on the server at least once to create its data folders.
1. Place this jar in the addons folder of the BentoBox plugin.
2. Restart the server.
3. The addon will create worlds and a data folder and inside the folder will be a config.yml.
4. Stop the server .
4. Stop the server.
5. Edit the config.yml how you want.
6. Delete any worlds that were created by default if you made changes that would affect them.
7. Restart the server.

## Config.yml

The config.yml is similar to BSkyblock and AcidIsalnd but *not the same*. It has some additional or changed parameters, like,
instead of wrold-height it has world-depth.
It also has option to choose main block for each world, and blocks that will be occasionally replace main block, f.e. diamond ore or shulker.
It also allows to specifiy if roof and floor for each world must be generated from bedrock.

instead of world-height it has world-depth.

### Other Add-ons

Expand Down
17 changes: 11 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<java.version>16</java.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.16.4-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.16.0</bentobox.version>
<spigot.version>1.18.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.19.0</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>1.14.5</build.version>
<build.version>1.15.0</build.version>
<build.number>-LOCAL</build.number>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand Down Expand Up @@ -114,6 +114,12 @@
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>plugin-annotations</artifactId>
<version>1.2.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
Expand Down Expand Up @@ -170,8 +176,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/world/bentobox/caveblock/CaveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class CaveBlock extends GameModeAddon

/**
* Executes code when loading the addon. This is called before {@link #onEnable()}. This should preferably
* be used to setup configuration and worlds.
* be used to set up configuration and worlds.
*/
@Override
public void onLoad()
Expand Down Expand Up @@ -76,7 +76,6 @@ public void onReload()
{
super.onReload();
this.loadSettings();
this.chunkGenerator.reload();
}


Expand Down Expand Up @@ -122,8 +121,8 @@ public void allLoaded() {

/**
* Make the worlds for this GameMode in this method. BentoBox will call it after onLoad() and before
* onEnable(). {@link #islandWorld} must be created and assigned, {@link #netherWorld} and {@link
* #endWorld} are optional and may be null.
* onEnable(). {@code islandWorld} must be created and assigned, {@code netherWorld} and {@code
* endWorld} are optional and may be null.
*/
@Override
public void createWorlds()
Expand All @@ -137,7 +136,6 @@ public void createWorlds()

// Create the world if it does not exist
this.islandWorld = WorldCreator.name(worldName).
type(WorldType.FLAT).
environment(World.Environment.NORMAL).
generator(this.chunkGenerator).
createWorld();
Expand Down Expand Up @@ -316,6 +314,4 @@ public void saveWorldSettings()
* String for the end world.
*/
private static final String THE_END = "_the_end";


}
20 changes: 20 additions & 0 deletions src/main/java/world/bentobox/caveblock/CaveBlockPladdon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package world.bentobox.caveblock;

import org.bukkit.plugin.java.annotation.dependency.Dependency;
import org.bukkit.plugin.java.annotation.plugin.ApiVersion;
import org.bukkit.plugin.java.annotation.plugin.Plugin;

import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.addons.Pladdon;


@Plugin(name = "Pladdon", version = "1.0")
@ApiVersion(ApiVersion.Target.v1_18)
@Dependency(value = "BentoBox")
public class CaveBlockPladdon extends Pladdon {

@Override
public Addon getAddon() {
return new CaveBlock();
}
}
55 changes: 34 additions & 21 deletions src/main/java/world/bentobox/caveblock/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ public int getIslandHeight()


/**
* This method returns the useOwnGenerator object.
* @return the useOwnGenerator object.
* This is not an option in Caveblock
* @return false
*/
@Override
public boolean isUseOwnGenerator()
{
return useOwnGenerator;
return false;
}


Expand Down Expand Up @@ -812,6 +812,15 @@ public int getNumberOfBlockGenerationTries()
return numberOfBlockGenerationTries;
}

/**
* This method returns the newMaterialGenerator value.
* @return the value of newMaterialGenerator.
*/
public boolean isNewMaterialGenerator()
{
return newMaterialGenerator;
}


/**
* {@inheritDoc}
Expand Down Expand Up @@ -1022,16 +1031,6 @@ public void setIslandHeight(int islandHeight)
}


/**
* This method sets the useOwnGenerator object value.
* @param useOwnGenerator the useOwnGenerator object new value.
*
*/
public void setUseOwnGenerator(boolean useOwnGenerator)
{
this.useOwnGenerator = useOwnGenerator;
}

/**
* This method sets the maxIslands object value.
* @param maxIslands the maxIslands object new value.
Expand Down Expand Up @@ -1647,6 +1646,17 @@ public void setNumberOfBlockGenerationTries(int numberOfBlockGenerationTries)
}


/**
* This method sets the newMaterialGenerator value.
* @param newMaterialGenerator the numberOfBlockGenerationTries new value.
*
*/
public void setNewMaterialGenerator(boolean newMaterialGenerator)
{
this.newMaterialGenerator = newMaterialGenerator;
}


/**
* @return the debug
*/
Expand Down Expand Up @@ -1687,6 +1697,7 @@ public void setAdminCommandAliases(String adminCommandAliases)
/**
* @return the onJoinCommands
*/
@NonNull
@Override
public List<String> getOnJoinCommands() {
return onJoinCommands;
Expand All @@ -1704,6 +1715,7 @@ public void setOnJoinCommands(List<String> onJoinCommands) {
/**
* @return the onLeaveCommands
*/
@NonNull
@Override
public List<String> getOnLeaveCommands() {
return onLeaveCommands;
Expand Down Expand Up @@ -2163,11 +2175,6 @@ public void setOnRespawnCommands(List<String> onRespawnCommands)
@ConfigEntry(path = "world.cave-height")
private int islandHeight = 60;

@ConfigComment("Use your own world generator for this world.")
@ConfigComment("In this case, the plugin will not generate anything.")
@ConfigEntry(path = "world.use-own-generator", experimental = true)
private boolean useOwnGenerator = true;

@ConfigComment("Maximum number of caves in the world. Set to -1 or 0 for unlimited.")
@ConfigComment("If the number of caves is greater than this number, it will stop players from creating caves.")
@ConfigEntry(path = "world.max-caves")
Expand All @@ -2180,7 +2187,7 @@ public void setOnRespawnCommands(List<String> onRespawnCommands)

@ConfigComment("The default biome for the overworld")
@ConfigEntry(path = "world.default-biome")
private Biome defaultBiome = Biome.MOUNTAINS;
private Biome defaultBiome = Enums.getIfPresent(Biome.class, "DRIPSTONE_CAVES").or(Biome.THE_VOID);

@ConfigComment("The maximum number of players a player can ban at any one time in this game mode.")
@ConfigComment("The permission caveblock.ban.maxlimit.X where X is a number can also be used per player")
Expand All @@ -2198,6 +2205,12 @@ public void setOnRespawnCommands(List<String> onRespawnCommands)
@ConfigEntry(path = "world.generation-tries", needsReset = true)
private int numberOfBlockGenerationTries = 1;

@ConfigComment("Should we use the new material generator ?")
@ConfigComment("This will generate ores and blocks similar to how vanilla does,")
@ConfigComment("but it will override the blocks settings of each world.")
@ConfigEntry(path = "world.use-new-material-generator", needsReset = true)
private boolean newMaterialGenerator = false;

@ConfigComment("")
@ConfigComment("Make over world roof of bedrock, if false, it will be made from stone")
@ConfigEntry(path = "world.normal.roof", needsReset = true)
Expand Down Expand Up @@ -2238,7 +2251,7 @@ public void setOnRespawnCommands(List<String> onRespawnCommands)

@ConfigComment("The default biome for the nether world (this may affect what mobs can spawn)")
@ConfigEntry(path = "world.nether.biome", since = "1.14.0")
private Biome defaultNetherBiome = Enums.getIfPresent(Biome.class, "NETHER").or(Enums.getIfPresent(Biome.class, "NETHER_WASTES").or(Biome.BADLANDS));
private Biome defaultNetherBiome = Enums.getIfPresent(Biome.class, "NETHER_WASTES").or(Biome.THE_VOID);

@ConfigComment("Nether spawn protection radius - this is the distance around the nether spawn")
@ConfigComment("that will be protected from player interaction (breaking blocks, pouring lava etc.)")
Expand Down Expand Up @@ -2286,7 +2299,7 @@ public void setOnRespawnCommands(List<String> onRespawnCommands)

@ConfigComment("The default biome for the end world (this may affect what mobs can spawn)")
@ConfigEntry(path = "world.end.biome", since = "1.14.0")
private Biome defaultTheEndBiome = Biome.THE_END;
private Biome defaultTheEndBiome = Enums.getIfPresent(Biome.class, "THE_END").or(Biome.THE_VOID);

@ConfigEntry(path = "world.end.dragon-spawn", experimental = true)
private boolean dragonSpawn = false;
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/world/bentobox/caveblock/Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package world.bentobox.caveblock;

import org.bukkit.Location;

public class Utils {

/**
* Convert chunk location to world location
*
* @param x the x coordinate of the chunk location
* @param y the y coordinate
* @param z the z coordinate of the chunk location
* @param chunkX the x coordinate of the chunk
* @param chunkZ the z coordinate of the chunk
* @return the world location
*/
public static Location getLocationFromChunkLocation(int x, int y, int z, int chunkX, int chunkZ) {
return new Location(null, x + (chunkX * 16D), y, z + (chunkZ * 16D));
}
}
Loading

0 comments on commit e6e3c97

Please sign in to comment.