Remove deprecated code usage from CommandAPI
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
8cfc7bda85
Commit
46b9239801
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.attributescopy;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -87,7 +88,7 @@ public class AttributeRemoveCommand extends SWCommand {
|
||||
public TypeMapper<String> attribute() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Player player = (Player) commandSender;
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
@ -104,7 +105,7 @@ public class AttributeRemoveCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return s.replace('_', ' ');
|
||||
}
|
||||
};
|
||||
|
@ -27,6 +27,7 @@ import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
@ -221,7 +222,7 @@ public class RegionCommand extends SWCommand {
|
||||
private TypeMapper<String> regionTypeMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Player p = (Player) commandSender;
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
@ -231,7 +232,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return s.replace('_', ' ');
|
||||
}
|
||||
};
|
||||
@ -241,7 +242,7 @@ public class RegionCommand extends SWCommand {
|
||||
private TypeMapper<String> skinTypeMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Player p = (Player) commandSender;
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
@ -251,7 +252,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return s.replace('_', ' ');
|
||||
}
|
||||
};
|
||||
|
@ -26,6 +26,7 @@ import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
@ -91,7 +92,7 @@ public class TNTCommand extends SWCommand {
|
||||
|
||||
return new TypeMapper<TNTMode>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender sender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
Region region = Region.getRegion(((Player) sender).getLocation());
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
|
||||
return new ArrayList<>(tntModeMap.keySet());
|
||||
@ -101,7 +102,7 @@ public class TNTCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TNTMode map(CommandSender sender, String[] previousArguments, String s) {
|
||||
public TNTMode map(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
Region region = Region.getRegion(((Player) sender).getLocation());
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
|
||||
return tntModeMap.getOrDefault(s, null);
|
||||
|
@ -25,10 +25,7 @@ import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.command.*;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
@ -129,14 +126,14 @@ public class TestblockCommand extends SWCommand {
|
||||
public TypeMapper<SchematicNode> nodeWithPublic() {
|
||||
return new TypeMapper<SchematicNode>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
List<String> stringList = new ArrayList<>(SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s));
|
||||
stringList.addAll(SchematicNode.getNodeTabcomplete(SteamwarUser.get(0), s));
|
||||
return stringList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchematicNode map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public SchematicNode map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
SchematicNode node = SchematicNode.getNodeFromPath(SteamwarUser.get(((Player) commandSender).getUniqueId()), s);
|
||||
if(node == null) {
|
||||
node = SchematicNode.getNodeFromPath(SteamwarUser.get(0), s);
|
||||
|
@ -24,6 +24,7 @@ import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI;
|
||||
import de.steamwar.bausystem.utils.ItemUtils;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
@ -114,7 +115,7 @@ public class SimulatorCommand extends SWCommand {
|
||||
public TypeMapper<String> allSimulators() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (SimulatorStorage.getSimulatorNames().contains(s)) {
|
||||
return s;
|
||||
} else {
|
||||
@ -123,7 +124,7 @@ public class SimulatorCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return SimulatorStorage.getSimulatorNames();
|
||||
}
|
||||
};
|
||||
|
@ -24,6 +24,7 @@ import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
@ -108,12 +109,12 @@ public class PanzernCommand extends SWCommand {
|
||||
}
|
||||
return new TypeMapper<Material>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] ignored, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return new ArrayList<>(strings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public Material map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (strings.contains(s.toLowerCase())) {
|
||||
return Material.valueOf(s.toUpperCase());
|
||||
}
|
||||
@ -135,12 +136,12 @@ public class PanzernCommand extends SWCommand {
|
||||
}
|
||||
return new TypeMapper<Material>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] ignored, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return new ArrayList<>(strings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public Material map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (strings.contains(s.toLowerCase())) {
|
||||
return Material.valueOf(s.toUpperCase());
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.team.boundary.BoundaryViewer;
|
||||
import de.steamwar.bausystem.region.Prototype;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -129,7 +130,7 @@ public class SkinCommand extends SWCommand {
|
||||
public static TypeMapper<String> kurzelMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
List<String> current = new ArrayList<>();
|
||||
Prototype.getPrototypes().forEach(p -> {
|
||||
current.add(p.getName().toUpperCase().replace("_", ""));
|
||||
@ -138,7 +139,7 @@ public class SkinCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return s;
|
||||
}
|
||||
};
|
||||
@ -148,14 +149,14 @@ public class SkinCommand extends SWCommand {
|
||||
public static TypeMapper<String> forceMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
List<String> current = new ArrayList<>();
|
||||
current.add("-f");
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (s.equals("-f")) {
|
||||
return s;
|
||||
}
|
||||
@ -171,7 +172,7 @@ public class SkinCommand extends SWCommand {
|
||||
public static TypeMapper<String> creatorMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
List<String> current = new ArrayList<>();
|
||||
current.add("public");
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
@ -181,7 +182,7 @@ public class SkinCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Set<String> current = new HashSet<>();
|
||||
current.add("public");
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
|
@ -29,6 +29,7 @@ import de.steamwar.bausystem.features.tracer.show.mode.RawEntityShowMode;
|
||||
import de.steamwar.bausystem.features.tracer.show.mode.TraceEntityShowMode;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.shared.ShowMode;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
@ -228,22 +229,17 @@ public class TraceCommand extends SWCommand {
|
||||
|
||||
return new TypeMapper<ShowModeParameterType>() {
|
||||
@Override
|
||||
public ShowModeParameterType map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public ShowModeParameterType map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return showModeParameterTypesMap.get(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Set<ShowModeParameterType> showModeParameterTypeSet = new HashSet<>();
|
||||
for (String previousArgument : strings) {
|
||||
try {
|
||||
ShowModeType showModeType = ShowModeType.valueOf(previousArgument.toUpperCase());
|
||||
showModeParameterTypeSet.addAll(Arrays.asList(showModeType.removedTypes));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// Ignored
|
||||
}
|
||||
showModeParameterTypeSet.add(showModeParameterTypesMap.get(previousArgument));
|
||||
}
|
||||
Arrays.stream(previousArguments.mappedArgs).filter(ShowModeType.class::isInstance).map(ShowModeType.class::cast).forEach(showModeType -> {
|
||||
showModeParameterTypeSet.addAll(Arrays.asList(showModeType.removedTypes));
|
||||
});
|
||||
Arrays.stream(previousArguments.userArgs).map(showModeParameterTypesMap::get).forEach(showModeParameterTypeSet::add);
|
||||
showModeParameterTypeSet.remove(null);
|
||||
|
||||
Set<ShowModeParameterType> removed = showModeParameterTypeSet.stream()
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.util;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.shared.EnumDisplay;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
@ -162,12 +163,12 @@ public class MaterialCommand extends SWCommand implements Listener {
|
||||
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
List<String> tabCompletes = new ArrayList<>();
|
||||
tabCompletes.addAll(results);
|
||||
tabCompletes.add(s);
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.util;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -55,13 +56,13 @@ public class SkullCommand extends SWCommand {
|
||||
public TypeMapper<String> typeMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (s.endsWith("⍇")) return null;
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return Bukkit.getOnlinePlayers().stream().map(Player::getName).filter(s1 -> !s1.endsWith("⍇")).collect(Collectors.toList());
|
||||
}
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ import de.steamwar.bausystem.features.worldedit.utils.SpecialReplace;
|
||||
import de.steamwar.bausystem.region.Color;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -86,7 +87,7 @@ public class ColorReplaceCommand extends SWCommand {
|
||||
public TypeMapper<Pair<Integer, Color>> typeMapper() {
|
||||
return new TypeMapper<Pair<Integer, Color>>() {
|
||||
@Override
|
||||
public Pair<Integer, Color> map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public Pair<Integer, Color> map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (s.contains("%")) {
|
||||
String[] split = s.split("%");
|
||||
if (split.length != 2) {
|
||||
@ -103,7 +104,7 @@ public class ColorReplaceCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (s.matches("[0-9].*")) {
|
||||
if (s.contains("%")) {
|
||||
String sub = s.substring(0, s.indexOf("%") + 1);
|
||||
|
@ -29,6 +29,7 @@ import de.steamwar.bausystem.features.world.WorldEditListener;
|
||||
import de.steamwar.bausystem.features.worldedit.utils.SpecialReplace;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -104,7 +105,7 @@ public class TypeReplaceCommand extends SWCommand {
|
||||
public TypeMapper<Pair<Integer, Type>> typeMapper() {
|
||||
return new TypeMapper<Pair<Integer, Type>>() {
|
||||
@Override
|
||||
public Pair<Integer, Type> map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
public Pair<Integer, Type> map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (s.contains("%")) {
|
||||
String[] split = s.split("%");
|
||||
if (split.length != 2) {
|
||||
@ -121,7 +122,7 @@ public class TypeReplaceCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
public Collection<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
if (s.matches("[0-9].*")) {
|
||||
if (s.contains("%")) {
|
||||
String sub = s.substring(0, s.indexOf("%") + 1);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren