mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 13:46:45 +01:00
Remove unused flag types
This commit is contained in:
parent
71b2c34bc3
commit
02ae24bdd9
@ -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.BlockStateListFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
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.GlobalFlagContainer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.PlotFlag;
|
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.BlockTypeListFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.types.IntegerFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.types.IntegerFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -253,9 +253,9 @@ public class FlagCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag == Flags.TIME) {
|
if (flag.) {
|
||||||
player.setTime(Long.MAX_VALUE);
|
player.setTime(Long.MAX_VALUE);
|
||||||
} else if (flag.getClass().isInstance(PlotWeatherFlag.class)) {
|
} else if (flag instanceof PlotWeatherFlag) {
|
||||||
player.setWeather(PlotWeather.RESET);
|
player.setWeather(PlotWeather.RESET);
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
|
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
|
||||||
|
@ -279,20 +279,6 @@ public class FlagManager {
|
|||||||
return flag;
|
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<Flag<?>, Object> parseFlags(List<String> flagStrings) {
|
public static Map<Flag<?>, Object> parseFlags(List<String> flagStrings) {
|
||||||
HashMap<Flag<?>, Object> map = new HashMap<>();
|
HashMap<Flag<?>, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
@ -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<List<Integer>> {
|
|
||||||
|
|
||||||
public IntegerListFlag(String name) {
|
|
||||||
super(Captions.FLAG_CATEGORY_INTEGER_LIST, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String valueToString(Object value) {
|
|
||||||
return StringMan.join((List<Integer>) value, ",");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public List<Integer> parseValue(String value) {
|
|
||||||
String[] split = value.split(",");
|
|
||||||
ArrayList<Integer> 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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<PlotWeather> {
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
|
||||||
|
|
||||||
public class StringFlag extends Flag<String> {
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user