SteamWar/BauSystem2.0
Archiviert
12
0

Remove deprecated code usage from CommandAPI

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-01-15 20:39:09 +01:00
Ursprung 8cfc7bda85
Commit 46b9239801
12 geänderte Dateien mit 48 neuen und 45 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.attributescopy; package de.steamwar.bausystem.features.attributescopy;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@ -87,7 +88,7 @@ public class AttributeRemoveCommand extends SWCommand {
public TypeMapper<String> attribute() { public TypeMapper<String> attribute() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @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; Player player = (Player) commandSender;
ItemStack itemStack = player.getInventory().getItemInMainHand(); ItemStack itemStack = player.getInventory().getItemInMainHand();
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
@ -104,7 +105,7 @@ public class AttributeRemoveCommand extends SWCommand {
} }
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s.replace('_', ' '); return s.replace('_', ' ');
} }
}; };

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
@ -221,7 +222,7 @@ public class RegionCommand extends SWCommand {
private TypeMapper<String> regionTypeMapper() { private TypeMapper<String> regionTypeMapper() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @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; Player p = (Player) commandSender;
Region region = Region.getRegion(p.getLocation()); Region region = Region.getRegion(p.getLocation());
if (region.isGlobal()) { if (region.isGlobal()) {
@ -231,7 +232,7 @@ public class RegionCommand extends SWCommand {
} }
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s.replace('_', ' '); return s.replace('_', ' ');
} }
}; };
@ -241,7 +242,7 @@ public class RegionCommand extends SWCommand {
private TypeMapper<String> skinTypeMapper() { private TypeMapper<String> skinTypeMapper() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @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; Player p = (Player) commandSender;
Region region = Region.getRegion(p.getLocation()); Region region = Region.getRegion(p.getLocation());
if (region.isGlobal()) { if (region.isGlobal()) {
@ -251,7 +252,7 @@ public class RegionCommand extends SWCommand {
} }
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s.replace('_', ' '); return s.replace('_', ' ');
} }
}; };

Datei anzeigen

@ -26,6 +26,7 @@ import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode; import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
@ -91,7 +92,7 @@ public class TNTCommand extends SWCommand {
return new TypeMapper<TNTMode>() { return new TypeMapper<TNTMode>() {
@Override @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()); Region region = Region.getRegion(((Player) sender).getLocation());
if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) { if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
return new ArrayList<>(tntModeMap.keySet()); return new ArrayList<>(tntModeMap.keySet());
@ -101,7 +102,7 @@ public class TNTCommand extends SWCommand {
} }
@Override @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()); Region region = Region.getRegion(((Player) sender).getLocation());
if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) { if (region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
return tntModeMap.getOrDefault(s, null); return tntModeMap.getOrDefault(s, null);

Datei anzeigen

@ -25,10 +25,7 @@ import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.command.SWCommand; import de.steamwar.command.*;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
@ -129,14 +126,14 @@ public class TestblockCommand extends SWCommand {
public TypeMapper<SchematicNode> nodeWithPublic() { public TypeMapper<SchematicNode> nodeWithPublic() {
return new TypeMapper<SchematicNode>() { return new TypeMapper<SchematicNode>() {
@Override @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)); List<String> stringList = new ArrayList<>(SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s));
stringList.addAll(SchematicNode.getNodeTabcomplete(SteamwarUser.get(0), s)); stringList.addAll(SchematicNode.getNodeTabcomplete(SteamwarUser.get(0), s));
return stringList; return stringList;
} }
@Override @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); SchematicNode node = SchematicNode.getNodeFromPath(SteamwarUser.get(((Player) commandSender).getUniqueId()), s);
if(node == null) { if(node == null) {
node = SchematicNode.getNodeFromPath(SteamwarUser.get(0), s); node = SchematicNode.getNodeFromPath(SteamwarUser.get(0), s);

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI; import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI;
import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
@ -114,7 +115,7 @@ public class SimulatorCommand extends SWCommand {
public TypeMapper<String> allSimulators() { public TypeMapper<String> allSimulators() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
if (SimulatorStorage.getSimulatorNames().contains(s)) { if (SimulatorStorage.getSimulatorNames().contains(s)) {
return s; return s;
} else { } else {
@ -123,7 +124,7 @@ public class SimulatorCommand extends SWCommand {
} }
@Override @Override
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) { public Collection<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return SimulatorStorage.getSimulatorNames(); return SimulatorStorage.getSimulatorNames();
} }
}; };

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
@ -108,12 +109,12 @@ public class PanzernCommand extends SWCommand {
} }
return new TypeMapper<Material>() { return new TypeMapper<Material>() {
@Override @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); return new ArrayList<>(strings);
} }
@Override @Override
public Material map(CommandSender commandSender, String[] previousArguments, String s) { public Material map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
if (strings.contains(s.toLowerCase())) { if (strings.contains(s.toLowerCase())) {
return Material.valueOf(s.toUpperCase()); return Material.valueOf(s.toUpperCase());
} }
@ -135,12 +136,12 @@ public class PanzernCommand extends SWCommand {
} }
return new TypeMapper<Material>() { return new TypeMapper<Material>() {
@Override @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); return new ArrayList<>(strings);
} }
@Override @Override
public Material map(CommandSender commandSender, String[] previousArguments, String s) { public Material map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
if (strings.contains(s.toLowerCase())) { if (strings.contains(s.toLowerCase())) {
return Material.valueOf(s.toUpperCase()); return Material.valueOf(s.toUpperCase());
} }

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.team.boundary.BoundaryViewer;
import de.steamwar.bausystem.region.Prototype; import de.steamwar.bausystem.region.Prototype;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@ -129,7 +130,7 @@ public class SkinCommand extends SWCommand {
public static TypeMapper<String> kurzelMapper() { public static TypeMapper<String> kurzelMapper() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @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<>(); List<String> current = new ArrayList<>();
Prototype.getPrototypes().forEach(p -> { Prototype.getPrototypes().forEach(p -> {
current.add(p.getName().toUpperCase().replace("_", "")); current.add(p.getName().toUpperCase().replace("_", ""));
@ -138,7 +139,7 @@ public class SkinCommand extends SWCommand {
} }
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s; return s;
} }
}; };
@ -148,14 +149,14 @@ public class SkinCommand extends SWCommand {
public static TypeMapper<String> forceMapper() { public static TypeMapper<String> forceMapper() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @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<>(); List<String> current = new ArrayList<>();
current.add("-f"); current.add("-f");
return current; return current;
} }
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
if (s.equals("-f")) { if (s.equals("-f")) {
return s; return s;
} }
@ -171,7 +172,7 @@ public class SkinCommand extends SWCommand {
public static TypeMapper<String> creatorMapper() { public static TypeMapper<String> creatorMapper() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @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<>(); List<String> current = new ArrayList<>();
current.add("public"); current.add("public");
Bukkit.getOnlinePlayers().forEach(player -> { Bukkit.getOnlinePlayers().forEach(player -> {
@ -181,7 +182,7 @@ public class SkinCommand extends SWCommand {
} }
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
Set<String> current = new HashSet<>(); Set<String> current = new HashSet<>();
current.add("public"); current.add("public");
Bukkit.getOnlinePlayers().forEach(player -> { Bukkit.getOnlinePlayers().forEach(player -> {

Datei anzeigen

@ -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.features.tracer.show.mode.TraceEntityShowMode;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.shared.ShowMode; import de.steamwar.bausystem.shared.ShowMode;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
@ -228,22 +229,17 @@ public class TraceCommand extends SWCommand {
return new TypeMapper<ShowModeParameterType>() { return new TypeMapper<ShowModeParameterType>() {
@Override @Override
public ShowModeParameterType map(CommandSender commandSender, String[] previousArguments, String s) { public ShowModeParameterType map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return showModeParameterTypesMap.get(s); return showModeParameterTypesMap.get(s);
} }
@Override @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<>(); Set<ShowModeParameterType> showModeParameterTypeSet = new HashSet<>();
for (String previousArgument : strings) { Arrays.stream(previousArguments.mappedArgs).filter(ShowModeType.class::isInstance).map(ShowModeType.class::cast).forEach(showModeType -> {
try {
ShowModeType showModeType = ShowModeType.valueOf(previousArgument.toUpperCase());
showModeParameterTypeSet.addAll(Arrays.asList(showModeType.removedTypes)); showModeParameterTypeSet.addAll(Arrays.asList(showModeType.removedTypes));
} catch (IllegalArgumentException ignored) { });
// Ignored Arrays.stream(previousArguments.userArgs).map(showModeParameterTypesMap::get).forEach(showModeParameterTypeSet::add);
}
showModeParameterTypeSet.add(showModeParameterTypesMap.get(previousArgument));
}
showModeParameterTypeSet.remove(null); showModeParameterTypeSet.remove(null);
Set<ShowModeParameterType> removed = showModeParameterTypeSet.stream() Set<ShowModeParameterType> removed = showModeParameterTypeSet.stream()

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.shared.EnumDisplay; import de.steamwar.bausystem.shared.EnumDisplay;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
@ -162,12 +163,12 @@ public class MaterialCommand extends SWCommand implements Listener {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s; return s;
} }
@Override @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<>(); List<String> tabCompletes = new ArrayList<>();
tabCompletes.addAll(results); tabCompletes.addAll(results);
tabCompletes.add(s); tabCompletes.add(s);

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -55,13 +56,13 @@ public class SkullCommand extends SWCommand {
public TypeMapper<String> typeMapper() { public TypeMapper<String> typeMapper() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
if (s.endsWith("")) return null; if (s.endsWith("")) return null;
return s; return s;
} }
@Override @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()); return Bukkit.getOnlinePlayers().stream().map(Player::getName).filter(s1 -> !s1.endsWith("")).collect(Collectors.toList());
} }
}; };

Datei anzeigen

@ -30,6 +30,7 @@ import de.steamwar.bausystem.features.worldedit.utils.SpecialReplace;
import de.steamwar.bausystem.region.Color; import de.steamwar.bausystem.region.Color;
import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@ -86,7 +87,7 @@ public class ColorReplaceCommand extends SWCommand {
public TypeMapper<Pair<Integer, Color>> typeMapper() { public TypeMapper<Pair<Integer, Color>> typeMapper() {
return new TypeMapper<Pair<Integer, Color>>() { return new TypeMapper<Pair<Integer, Color>>() {
@Override @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("%")) { if (s.contains("%")) {
String[] split = s.split("%"); String[] split = s.split("%");
if (split.length != 2) { if (split.length != 2) {
@ -103,7 +104,7 @@ public class ColorReplaceCommand extends SWCommand {
} }
@Override @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.matches("[0-9].*")) {
if (s.contains("%")) { if (s.contains("%")) {
String sub = s.substring(0, s.indexOf("%") + 1); String sub = s.substring(0, s.indexOf("%") + 1);

Datei anzeigen

@ -29,6 +29,7 @@ import de.steamwar.bausystem.features.world.WorldEditListener;
import de.steamwar.bausystem.features.worldedit.utils.SpecialReplace; import de.steamwar.bausystem.features.worldedit.utils.SpecialReplace;
import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@ -104,7 +105,7 @@ public class TypeReplaceCommand extends SWCommand {
public TypeMapper<Pair<Integer, Type>> typeMapper() { public TypeMapper<Pair<Integer, Type>> typeMapper() {
return new TypeMapper<Pair<Integer, Type>>() { return new TypeMapper<Pair<Integer, Type>>() {
@Override @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("%")) { if (s.contains("%")) {
String[] split = s.split("%"); String[] split = s.split("%");
if (split.length != 2) { if (split.length != 2) {
@ -121,7 +122,7 @@ public class TypeReplaceCommand extends SWCommand {
} }
@Override @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.matches("[0-9].*")) {
if (s.contains("%")) { if (s.contains("%")) {
String sub = s.substring(0, s.indexOf("%") + 1); String sub = s.substring(0, s.indexOf("%") + 1);