Skip to content

Commit

Permalink
Release 1.17.0 (#54)
Browse files Browse the repository at this point in the history
* Version 1.16.1

* Expose BentoBox 1.16 portal generation mechanics.

BentoBoxWorld/BentoBox#1718

* Adds isCheckForBlocks to false similar to CaveBlock. (#49)

* Revert "Adds isCheckForBlocks to false similar to CaveBlock. (#49)" (#53)

This reverts commit bd36b95.

* Expose BentoBox mobLimitSettings option. (#52)

* Expose BentoBox 1.14 onRespawnCommands (#51)

BentoBoxWorld/BentoBox#1719

* Implements #49

* Update to 1.17

* Improved blocks and items for 1.17

* Update GitHub Action to Java 16

* Make Pladdon

Java 16 code clean up.

* Remove missing blocks/items checking code.

* Correct reference to SkyGrid in settings

* Fix code smells.

Co-authored-by: BONNe <bonne@bonne.id.lv>
  • Loading branch information
tastybento and BONNe committed Aug 15, 2021
1 parent 685d283 commit bc3d69c
Show file tree
Hide file tree
Showing 13 changed files with 722 additions and 260 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 16
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'
java-version: 16
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand Down
43 changes: 10 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@
<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>
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.16.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.16.0</bentobox.version>
<spigot.version>1.17.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.17.1</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.16.0</build.version>
<build.version>1.17.0</build.version>
<!-- SonarCloud -->
<sonar.projectKey>BentoBoxWorld_SkyGrid</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down Expand Up @@ -111,30 +111,6 @@
<build.number></build.number>
</properties>
</profile>
<profile>
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>bentobox-world</sonar.organization>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<repositories>
Expand Down Expand Up @@ -254,8 +230,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 All @@ -268,18 +243,20 @@
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.0</version>
<configuration>
<show>public</show>
<failOnError>false</failOnError>
<additionalJOption>-Xdoclint:none</additionalJOption>
<!-- To compile with Java 11, this tag may be required -->
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
Expand Down
139 changes: 130 additions & 9 deletions src/main/java/world/bentobox/skygrid/Settings.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package world.bentobox.skygrid;

import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;

import org.bukkit.Difficulty;
import org.bukkit.GameMode;
Expand Down Expand Up @@ -92,6 +86,12 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "world.nether.blocks")
private Map<Material, Integer> netherBlocks = new EnumMap<>(Material.class);

@ConfigComment("This option indicates if nether portals should be linked via dimensions.")
@ConfigComment("Option will simulate vanilla portal mechanics that links portals together")
@ConfigComment("or creates a new portal, if there is not a portal in that dimension.")
@ConfigEntry(path = "world.nether.create-and-link-portals", since = "1.16")
private boolean makeNetherPortals = false;

// End
@ConfigComment("Generate SkyGrid End - if this is false, the end world will not be made")
@ConfigEntry(path = "world.end.generate")
Expand All @@ -101,6 +101,11 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "world.end.blocks")
private Map<Material, Integer> endBlocks = new EnumMap<>(Material.class);

@ConfigComment("This option indicates if obsidian platform in the end should be generated")
@ConfigComment("when player enters the end world.")
@ConfigEntry(path = "world.end.create-obsidian-platform", since = "1.16")
private boolean makeEndPortals = false;

/* SkyGrid */
@ConfigComment("Biomes - this will affect some block types and tree types.")
@ConfigEntry(path = "world.create-biomes")
Expand Down Expand Up @@ -330,13 +335,50 @@ public class Settings implements WorldSettings {

// Commands
@ConfigComment("List of commands to run when a player joins.")
@ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,")
@ConfigComment("in which case they are executed by the player.")
@ConfigComment("")
@ConfigComment("Available placeholders for the commands are the following:")
@ConfigComment(" * [name]: name of the player")
@ConfigComment("")
@ConfigComment("Here are some examples of valid commands to execute:")
@ConfigComment(" * '[SUDO] bbox version'")
@ConfigComment(" * 'bsbadmin deaths set [player] 0'")
@ConfigComment("")
@ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.")
@ConfigEntry(path = "area.commands.on-join")
private List<String> onJoinCommands = new ArrayList<>();

@ConfigComment("list of commands to run when a player leaves.")
@ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,")
@ConfigComment("in which case they are executed by the player.")
@ConfigComment("")
@ConfigComment("Available placeholders for the commands are the following:")
@ConfigComment(" * [name]: name of the player")
@ConfigComment("")
@ConfigComment("Here are some examples of valid commands to execute:")
@ConfigComment(" * '[SUDO] bbox version'")
@ConfigComment(" * 'bsbadmin deaths set [player] 0'")
@ConfigComment("")
@ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.")
@ConfigEntry(path = "area.commands.on-leave")
private List<String> onLeaveCommands = new ArrayList<>();

@ConfigComment("List of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.")
@ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,")
@ConfigComment("in which case they are executed by the player.")
@ConfigComment("")
@ConfigComment("Available placeholders for the commands are the following:")
@ConfigComment(" * [name]: name of the player")
@ConfigComment("")
@ConfigComment("Here are some examples of valid commands to execute:")
@ConfigComment(" * '[SUDO] bbox version'")
@ConfigComment(" * 'bsbadmin deaths set [player] 0'")
@ConfigComment("")
@ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.")
@ConfigEntry(path = "area.commands.on-respawn", since = "1.14.0")
private List<String> onRespawnCommands = new ArrayList<>();

// Sethome
@ConfigComment("Allow setting home in the nether. Only available on nether islands, not vanilla nether.")
@ConfigEntry(path = "area.sethome.nether.allow")
Expand Down Expand Up @@ -377,6 +419,11 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "protection.geo-limit-settings")
private List<String> geoLimitSettings = new ArrayList<>();

@ConfigComment("SkyGrid blocked mobs.")
@ConfigComment("List of mobs that should not spawn in SkyGrid.")
@ConfigEntry(path = "protection.block-mobs")
private List<String> mobLimitSettings = new ArrayList<>();

// Invincible visitor settings
@ConfigComment("Invincible visitors. List of damages that will not affect visitors.")
@ConfigComment("Make list blank if visitors should receive all damages")
Expand Down Expand Up @@ -1295,7 +1342,7 @@ public void setDeathsResetOnNewIsland(boolean deathsResetOnNewIsland) {
*/
@Override
public List<String> getOnJoinCommands() {
return onJoinCommands;
return Objects.requireNonNullElseGet(onJoinCommands, ArrayList::new);
}

/**
Expand All @@ -1310,7 +1357,7 @@ public void setOnJoinCommands(List<String> onJoinCommands) {
*/
@Override
public List<String> getOnLeaveCommands() {
return onLeaveCommands;
return Objects.requireNonNullElseGet(onLeaveCommands, ArrayList::new);
}

/**
Expand All @@ -1320,6 +1367,23 @@ public void setOnLeaveCommands(List<String> onLeaveCommands) {
this.onLeaveCommands = onLeaveCommands;
}

/**
* @return the onRespawnCommands
*/
@Override
public List<String> getOnRespawnCommands() {
return Objects.requireNonNullElseGet(onRespawnCommands, ArrayList::new);
}

/**
* Sets on respawn commands.
*
* @param onRespawnCommands the on respawn commands
*/
public void setOnRespawnCommands(List<String> onRespawnCommands) {
this.onRespawnCommands = onRespawnCommands;
}

/**
* @return the onJoinResetHealth
*/
Expand Down Expand Up @@ -1493,4 +1557,61 @@ public String getDefaultPlayerAction() {
public void setDefaultPlayerAction(String defaultPlayerAction) {
this.defaultPlayerAction = defaultPlayerAction;
}

/**
* @return the mobLimitSettings
*/
@Override
public List<String> getMobLimitSettings() {
return mobLimitSettings;
}

/**
* @param mobLimitSettings the mobLimitSettings to set
*/
public void setMobLimitSettings(List<String> mobLimitSettings) {
this.mobLimitSettings = mobLimitSettings;
}

/**
* @return the makeNetherPortals
*/
@Override
public boolean isMakeNetherPortals() {
return makeNetherPortals;
}

/**
* @return the makeEndPortals
*/
@Override
public boolean isMakeEndPortals() {
return makeEndPortals;
}

/**
* Sets make nether portals.
* @param makeNetherPortals the make nether portals
*/
public void setMakeNetherPortals(boolean makeNetherPortals) {
this.makeNetherPortals = makeNetherPortals;
}

/**
* Sets make end portals.
* @param makeEndPortals the make end portals
*/
public void setMakeEndPortals(boolean makeEndPortals) {
this.makeEndPortals = makeEndPortals;
}

/**
* SkyGrid should not check for blocks.
* @return false
*/
@Override
public boolean isCheckForBlocks()
{
return false;
}
}
5 changes: 3 additions & 2 deletions src/main/java/world/bentobox/skygrid/SkyGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class SkyGrid extends GameModeAddon {
private Settings settings;
private WorldStyles worldStyles;
private SkyGridGen gen;
private Config<Settings> configObject = new Config<>(this, Settings.class);
private final Config<Settings> configObject = new Config<>(this, Settings.class);

@Override
public void onLoad() {
Expand All @@ -46,6 +46,7 @@ private void loadSettings() {
// Disable
logError("SkyGrid settings could not load! Addon disabled.");
setState(State.DISABLED);
return;
}
saveWorldSettings();
worldStyles = new WorldStyles(this);
Expand All @@ -60,7 +61,7 @@ private void loadSettings() {
}

@Override
public void onEnable(){
public void onEnable() {
// Set default protection flags for world to allow everything
Flags.values().stream().filter(f -> f.getType().equals(Type.PROTECTION)).forEach(f -> f.setDefaultSetting(getOverWorld(), true));
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/world/bentobox/skygrid/SkyGridPladdon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package world.bentobox.skygrid;

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

public class SkyGridPladdon extends Pladdon {

@Override
public Addon getAddon() {
return new SkyGrid();
}
}
8 changes: 4 additions & 4 deletions src/main/java/world/bentobox/skygrid/generators/Biomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import org.bukkit.block.Biome;

/**
* In order to find the biome of a region, we look up how close it's
* conditions are to the conditions on this map. We can use it's proximity
* In order to find the biome of a region, we look up how close its
* conditions are to the conditions on this map. We can use its proximity
* to a biome to determine how much influence that biome's noise generators,
* vegetation and features should have on the area of the map. This allows us
* to have seamless transitions between the biomes (at the price of speed)
*
* For example, a place with no precipitation and -30 degree (celcius) weather
* is a tundra, but it is also much closer to a dessert than a rain forest.
* For example, a place with no precipitation and -30 degree (Celcius) weather
* is a tundra, but it is also much closer to a desert than a rain forest.
*
*/
public enum Biomes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void addBlock(Material material, int prob) {
/**
* This picks a random block with the following constraints:
* A cactus is never chosen as the bottom block.
* Water or lava never is placed above sugar cane or cactuses because when they grow, they will touch the
* Water or lava is never placed above sugar cane or cacti because when they grow, they will touch the
* liquid and cause it to flow.
* @param random - random object
* @param bottom - if true, result will never be CACTUS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*/
public class RandomSeries {
private Random random = new Random();
private final Random random = new Random();
private final int[] reset;
private int[] series;
private int pos;
Expand Down

0 comments on commit bc3d69c

Please sign in to comment.