mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46: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);
|
Bukkit.unloadWorld(world, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String setupWorld(SetupObject object) {
|
@Deprecated @Override public String setupWorld(SetupObject object) {
|
||||||
SetupUtils.manager.updateGenerators();
|
SetupUtils.manager.updateGenerators();
|
||||||
ConfigurationNode[] steps = object.step == null ? new ConfigurationNode[0] : object.step;
|
ConfigurationNode[] steps = object.step == null ? new ConfigurationNode[0] : object.step;
|
||||||
String world = object.world;
|
String world = object.world;
|
||||||
@ -210,8 +210,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
return object.world;
|
return object.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String setupWorld(PlotAreaBuilder builder) {
|
||||||
public String setupWorld(PlotAreaBuilder builder) {
|
|
||||||
SetupUtils.manager.updateGenerators();
|
SetupUtils.manager.updateGenerators();
|
||||||
ConfigurationNode[] steps = builder.settingsNodesWrapper() == null ?
|
ConfigurationNode[] steps = builder.settingsNodesWrapper() == null ?
|
||||||
new ConfigurationNode[0] : builder.settingsNodesWrapper().getSettingsNodes();
|
new ConfigurationNode[0] : builder.settingsNodesWrapper().getSettingsNodes();
|
||||||
|
@ -14,6 +14,9 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A SettingsNodeStep is a step wrapping a {@link ConfigurationNode}.
|
||||||
|
*/
|
||||||
public class SettingsNodeStep implements SetupStep {
|
public class SettingsNodeStep implements SetupStep {
|
||||||
@Getter private final ConfigurationNode configurationNode;
|
@Getter private final ConfigurationNode configurationNode;
|
||||||
@Getter private final int id;
|
@Getter private final int id;
|
||||||
|
@ -3,6 +3,9 @@ package com.plotsquared.core.setup;
|
|||||||
import com.plotsquared.core.configuration.ConfigurationNode;
|
import com.plotsquared.core.configuration.ConfigurationNode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class wraps an array of {@link ConfigurationNode}s.
|
||||||
|
*/
|
||||||
public class SettingsNodesWrapper {
|
public class SettingsNodesWrapper {
|
||||||
@Getter private final ConfigurationNode[] settingsNodes;
|
@Getter private final ConfigurationNode[] settingsNodes;
|
||||||
@Getter private final SetupStep afterwards;
|
@Getter private final SetupStep afterwards;
|
||||||
@ -12,6 +15,12 @@ public class SettingsNodesWrapper {
|
|||||||
this.afterwards = afterwards;
|
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() {
|
public SetupStep getFirstStep() {
|
||||||
return this.settingsNodes.length == 0 ? this.afterwards : new SettingsNodeStep(this.settingsNodes[0], 0, this);
|
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;
|
import java.util.Stack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class keeps track of a setup process.
|
||||||
|
* It holds the history and the current setup state.
|
||||||
|
*/
|
||||||
public class SetupProcess {
|
public class SetupProcess {
|
||||||
private final PlotAreaBuilder builder;
|
private final PlotAreaBuilder builder;
|
||||||
private final Stack<SetupStep> history;
|
private final Stack<SetupStep> history;
|
||||||
@ -21,7 +25,6 @@ public class SetupProcess {
|
|||||||
|
|
||||||
public void handleInput(PlotPlayer<?> plotPlayer, String argument) {
|
public void handleInput(PlotPlayer<?> plotPlayer, String argument) {
|
||||||
SetupStep previous = this.current;
|
SetupStep previous = this.current;
|
||||||
// TODO null check?
|
|
||||||
this.current = this.current.handleInput(plotPlayer, this.builder, argument);
|
this.current = this.current.handleInput(plotPlayer, this.builder, argument);
|
||||||
// push previous step into history
|
// push previous step into history
|
||||||
if (this.current != previous && this.current != null) {
|
if (this.current != previous && this.current != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user