Compare commits

...

3 Commits

Author SHA1 Message Date
renovate[bot]
54c8587dda Update dependency org.junit.jupiter:junit-jupiter to v5.9.3 2023-05-01 01:37:50 +00:00
renovate[bot]
10a2b80ffc Update dependency com.diffplug.spotless to v6.18.0 (#4030)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-29 15:30:00 +02:00
Pierre Maurice Schwang
ca0f38255d Fix /plot area create <name> without passing a specific terrain type (#4025)
fix: Ensure PlotAreaBuilder#plotAreaType returns non-null value
2023-04-29 15:27:49 +02:00
3 changed files with 13 additions and 4 deletions

View File

@@ -25,11 +25,17 @@ import com.plotsquared.core.plot.PlotAreaTerrainType;
import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
public class PlotAreaBuilder { public class PlotAreaBuilder {
private String generatorName; private String generatorName;
private String plotManager; private String plotManager;
@Nullable
private PlotAreaType plotAreaType; private PlotAreaType plotAreaType;
private PlotAreaTerrainType terrainType; private PlotAreaTerrainType terrainType;
private String worldName; private String worldName;
@@ -85,8 +91,10 @@ public class PlotAreaBuilder {
return this.plotManager; return this.plotManager;
} }
@NotNull
@Contract(" -> !null")
public PlotAreaType plotAreaType() { public PlotAreaType plotAreaType() {
return this.plotAreaType; return Objects.requireNonNullElse(this.plotAreaType, PlotAreaType.NORMAL);
} }
public PlotAreaTerrainType terrainType() { public PlotAreaTerrainType terrainType() {
@@ -127,7 +135,8 @@ public class PlotAreaBuilder {
return this; return this;
} }
public PlotAreaBuilder plotAreaType(PlotAreaType plotAreaType) { public PlotAreaBuilder plotAreaType(@NotNull PlotAreaType plotAreaType) {
Objects.requireNonNull(plotAreaType, "PlotAreaType must not be null");
this.plotAreaType = plotAreaType; this.plotAreaType = plotAreaType;
return this; return this;
} }

View File

@@ -82,7 +82,7 @@ subprojects {
dependencies { dependencies {
// Tests // Tests
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
} }
plugins.withId("java") { plugins.withId("java") {

View File

@@ -20,7 +20,7 @@ squirrelid = "0.3.2"
# Gradle plugins # Gradle plugins
shadow = "7.1.2" shadow = "7.1.2"
grgit = "4.1.1" grgit = "4.1.1"
spotless = "6.17.0" spotless = "6.18.0"
nexus = "1.3.0" nexus = "1.3.0"
[libraries] [libraries]