mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Formatting and documentation
This commit is contained in:
parent
67b80bb8e8
commit
e3fbb32399
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<SetupStep> 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user