From fb8e7494113e4a22b395ee0ca37e1556a79b7202 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 22 Aug 2021 15:58:15 +0100 Subject: [PATCH] Still allow serialisation of PlotTitle flag --- .../plotsquared/core/plot/flag/GlobalFlagContainer.java | 2 +- .../core/plot/flag/implementations/PlotTitleFlag.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java index 34b97f6d0..ecd6b3059 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java @@ -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())); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java index ccfaad961..691153948 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java @@ -33,7 +33,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; public class PlotTitleFlag extends PlotFlag { - 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 { @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 { @Override public String toString() { + if (getValue() == PlotTitle.CONFIGURED) { + return "CONFIGURED"; + } return "\"" + getValue().title() + "\" \"" + getValue().subtitle() + "\""; }