From e3fbb32399c2dae1c48506a828a80f13883b1b0b Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Fri, 5 Jun 2020 14:05:30 +0200 Subject: [PATCH] Formatting and documentation --- .../com/plotsquared/bukkit/util/BukkitSetupUtils.java | 5 ++--- .../com/plotsquared/core/setup/SettingsNodeStep.java | 3 +++ .../com/plotsquared/core/setup/SettingsNodesWrapper.java | 9 +++++++++ .../java/com/plotsquared/core/setup/SetupProcess.java | 5 ++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java index ce893aeee..53185b608 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -98,7 +98,7 @@ public class BukkitSetupUtils extends SetupUtils { Bukkit.unloadWorld(world, false); } - @Override public String setupWorld(SetupObject object) { + @Deprecated @Override public String setupWorld(SetupObject object) { SetupUtils.manager.updateGenerators(); ConfigurationNode[] steps = object.step == null ? new ConfigurationNode[0] : object.step; String world = object.world; @@ -210,8 +210,7 @@ public class BukkitSetupUtils extends SetupUtils { return object.world; } - @Override - public String setupWorld(PlotAreaBuilder builder) { + @Override public String setupWorld(PlotAreaBuilder builder) { SetupUtils.manager.updateGenerators(); ConfigurationNode[] steps = builder.settingsNodesWrapper() == null ? new ConfigurationNode[0] : builder.settingsNodesWrapper().getSettingsNodes(); diff --git a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java index ec384884e..6d2976d3e 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java +++ b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java @@ -14,6 +14,9 @@ import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Collections; +/** + * A SettingsNodeStep is a step wrapping a {@link ConfigurationNode}. + */ public class SettingsNodeStep implements SetupStep { @Getter private final ConfigurationNode configurationNode; @Getter private final int id; diff --git a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodesWrapper.java b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodesWrapper.java index cdcb74bce..f34cf91d9 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodesWrapper.java +++ b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodesWrapper.java @@ -3,6 +3,9 @@ package com.plotsquared.core.setup; import com.plotsquared.core.configuration.ConfigurationNode; import lombok.Getter; +/** + * This class wraps an array of {@link ConfigurationNode}s. + */ public class SettingsNodesWrapper { @Getter private final ConfigurationNode[] settingsNodes; @Getter private final SetupStep afterwards; @@ -12,6 +15,12 @@ public class SettingsNodesWrapper { this.afterwards = afterwards; } + /** + * Returns the first step of this wrapper or the step or the + * {@code afterwards} step if no step is available. + * + * @return the first step or {@code afterwards}. + */ public SetupStep getFirstStep() { return this.settingsNodes.length == 0 ? this.afterwards : new SettingsNodeStep(this.settingsNodes[0], 0, this); } diff --git a/Core/src/main/java/com/plotsquared/core/setup/SetupProcess.java b/Core/src/main/java/com/plotsquared/core/setup/SetupProcess.java index 93d7b9593..ae4fcd7fe 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/SetupProcess.java +++ b/Core/src/main/java/com/plotsquared/core/setup/SetupProcess.java @@ -4,6 +4,10 @@ import com.plotsquared.core.player.PlotPlayer; import java.util.Stack; +/** + * This class keeps track of a setup process. + * It holds the history and the current setup state. + */ public class SetupProcess { private final PlotAreaBuilder builder; private final Stack history; @@ -21,7 +25,6 @@ public class SetupProcess { public void handleInput(PlotPlayer plotPlayer, String argument) { SetupStep previous = this.current; - // TODO null check? this.current = this.current.handleInput(plotPlayer, this.builder, argument); // push previous step into history if (this.current != previous && this.current != null) {