Optionals introduced, code cleaned, potential purge fix

This commit is contained in:
MattBDev
2016-04-01 19:14:46 -04:00
parent 3edfd39af9
commit 8243e0118a
42 changed files with 361 additions and 427 deletions

View File

@@ -1,10 +1,6 @@
package com.plotsquared.general.commands;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.MainUtil;
public abstract class Argument<T> {
@@ -37,24 +33,18 @@ public abstract class Argument<T> {
return in;
}
};
public static Argument<String> PlayerName = new Argument<String>("PlayerName", "Dinnerbone") {
public static final Argument<String> PlayerName = new Argument<String>("PlayerName", "Dinnerbone") {
@Override
public String parse(String in) {
return in.length() <= 16 ? in : null;
}
};
public static Argument<PlotId> PlotID = new Argument<PlotId>("PlotID", new PlotId(-6, 3)) {
public static final Argument<PlotId> PlotID = new Argument<PlotId>("PlotID", new PlotId(-6, 3)) {
@Override
public PlotId parse(String in) {
return PlotId.fromString(in);
}
};
public static Argument<Plot> Plot = new Argument<Plot>("Plot", new Plot(PlotArea.createGeneric("world"), new PlotId(3, -6), null)) {
@Override
public Plot parse(String in) {
return MainUtil.getPlotFromString(ConsolePlayer.getConsole(), in, false);
}
};
private final String name;
private final T example;