diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index d0bae4fb1..2fc224cdc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -8,9 +8,9 @@ import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.BlockStateListFlag; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.flag.PlotWeatherFlag; import com.github.intellectualsites.plotsquared.plot.flags.GlobalFlagContainer; import com.github.intellectualsites.plotsquared.plot.flags.PlotFlag; +import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlotWeatherFlag; import com.github.intellectualsites.plotsquared.plot.flags.types.BlockTypeListFlag; import com.github.intellectualsites.plotsquared.plot.flags.types.IntegerFlag; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -253,9 +253,9 @@ public class FlagCmd extends SubCommand { return false; } } - if (flag == Flags.TIME) { + if (flag.) { player.setTime(Long.MAX_VALUE); - } else if (flag.getClass().isInstance(PlotWeatherFlag.class)) { + } else if (flag instanceof PlotWeatherFlag) { player.setWeather(PlotWeather.RESET); } MainUtil.sendMessage(player, Captions.FLAG_REMOVED); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java index 443dfbeb9..6f56465d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java @@ -279,20 +279,6 @@ public class FlagManager { return flag; } - public static Flag getOrCreateFlag(String string) { - Flag flag = Flags.getFlag(string); - if (flag == null) { - flag = new StringFlag(string) { - @Override public String getValueDescription() { - return "Generic Filler Flag"; - } - }; - flag.register(); - } - return flag; - } - - public static Map, Object> parseFlags(List flagStrings) { HashMap, Object> map = new HashMap<>(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java deleted file mode 100644 index e9162000b..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.flag; - -import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.util.StringMan; - -import java.util.ArrayList; -import java.util.List; - - -public class IntegerListFlag extends ListFlag> { - - public IntegerListFlag(String name) { - super(Captions.FLAG_CATEGORY_INTEGER_LIST, name); - } - - @Override public String valueToString(Object value) { - return StringMan.join((List) value, ","); - } - - @Override public List parseValue(String value) { - String[] split = value.split(","); - ArrayList numbers = new ArrayList<>(); - for (String element : split) { - numbers.add(Integer.parseInt(element)); - } - return numbers; - } - - @Override public String getValueDescription() { - return Captions.FLAG_ERROR_INTEGER_LIST.getTranslated(); - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java deleted file mode 100644 index 1893d5370..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.flag; - -import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; - -public class PlotWeatherFlag extends Flag { - - public PlotWeatherFlag(String name) { - super(Captions.FLAG_CATEGORY_WEATHER, name); - } - - @Override public String valueToString(Object value) { - return value.toString(); - } - - @Override public PlotWeather parseValue(String value) { - switch (value.toLowerCase()) { - case "rain": - case "storm": - case "on": - case "lightning": - case "thunder": - return PlotWeather.RAIN; - case "clear": - case "off": - case "sun": - return PlotWeather.CLEAR; - default: - return PlotWeather.RESET; - } - } - - @Override public String getValueDescription() { - return Captions.FLAG_ERROR_WEATHER.getTranslated(); - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java deleted file mode 100644 index 21f1690a6..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.flag; - -import com.github.intellectualsites.plotsquared.plot.config.Captions; - -public class StringFlag extends Flag { - - public StringFlag(String name) { - super(Captions.FLAG_CATEGORY_STRING, name); - } - - @Override public String valueToString(Object value) { - return value.toString(); - } - - @Override public String parseValue(String value) { - return value; - } - - @Override public String getValueDescription() { - return Captions.FLAG_ERROR_STRING.getTranslated(); - } -}