mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Still allow serialisation of PlotTitle flag
This commit is contained in:
parent
4b26a7e300
commit
fb8e749411
@ -233,7 +233,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
||||
this.addFlag(DescriptionFlag.DESCRIPTION_FLAG_EMPTY);
|
||||
this.addFlag(GreetingFlag.GREETING_FLAG_EMPTY);
|
||||
this.addFlag(FarewellFlag.FAREWELL_FLAG_EMPTY);
|
||||
this.addFlag(PlotTitleFlag.TITLE_FLAG_EMPTY);
|
||||
this.addFlag(PlotTitleFlag.TITLE_FLAG_DEFAULT);
|
||||
|
||||
// Internal flags
|
||||
this.addFlag(new AnalysisFlag(Collections.emptyList()));
|
||||
|
@ -33,7 +33,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class PlotTitleFlag extends PlotFlag<PlotTitle, PlotTitleFlag> {
|
||||
|
||||
public static final PlotTitleFlag TITLE_FLAG_EMPTY = new PlotTitleFlag(PlotTitle.CONFIGURED);
|
||||
public static final PlotTitleFlag TITLE_FLAG_DEFAULT = new PlotTitleFlag(PlotTitle.CONFIGURED);
|
||||
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
@ -50,6 +50,9 @@ public class PlotTitleFlag extends PlotFlag<PlotTitle, PlotTitleFlag> {
|
||||
|
||||
@Override
|
||||
public PlotTitleFlag parse(@NonNull String input) throws FlagParseException {
|
||||
if (input.equals("CONFIGURED")) {
|
||||
return TITLE_FLAG_DEFAULT;
|
||||
}
|
||||
if (!input.contains("\"")) {
|
||||
return new PlotTitleFlag(new PlotTitle(input, ""));
|
||||
}
|
||||
@ -82,6 +85,9 @@ public class PlotTitleFlag extends PlotFlag<PlotTitle, PlotTitleFlag> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (getValue() == PlotTitle.CONFIGURED) {
|
||||
return "CONFIGURED";
|
||||
}
|
||||
return "\"" + getValue().title() + "\" \"" + getValue().subtitle() + "\"";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user