TestBlockPaste-Without-Water #146
@ -59,12 +59,13 @@ public class TestblockCommand extends SWCommand {
|
||||
}
|
||||
|
||||
zOnlyKroks markierte diese Unterhaltung als gelöst
Veraltet
|
||||
@Register
|
||||
public void schematicTestblockCommand(@Validator Player p,@OptionalValue("") @Mapper("withPublic") @AllowNull SchematicNode node,TestblockParameter... testblockParameters) {
|
||||
boolean isExtension = Arrays.stream(testblockParameters).anyMatch(testblockParameter -> testblockParameter.extension);
|
||||
boolean isIgnoreAir = Arrays.stream(testblockParameters).anyMatch(testblockParameter -> testblockParameter.ignoreAir);
|
||||
boolean isOnlyColor = Arrays.stream(testblockParameters).anyMatch(testblockParameter -> testblockParameter.onlyColor);
|
||||
boolean replaceTNT = Arrays.stream(testblockParameters).anyMatch(testblockParameter -> testblockParameter.tnt);
|
||||
boolean replaceWater = Arrays.stream(testblockParameters).anyMatch(testblockParameter -> testblockParameter.water);
|
||||
public void schematicTestblockCommand(@Validator Player p, @OptionalValue("") @Mapper("withPublic") @AllowNull SchematicNode node, TestblockParameterType... testblockParameterTypes) {
|
||||
Set<TestblockParameterType> testblockParameterTypesSet = new HashSet<>(Arrays.asList(testblockParameterTypes));
|
||||
boolean isExtension = testblockParameterTypesSet.contains(TestblockParameterType.EXTENSION);
|
||||
boolean isIgnoreAir = testblockParameterTypesSet.contains(TestblockParameterType.IGNORE_AIR);
|
||||
boolean isOnlyColor = testblockParameterTypesSet.contains(TestblockParameterType.ONLY_COLOR);
|
||||
boolean replaceTNT = testblockParameterTypesSet.contains(TestblockParameterType.TNT);
|
||||
boolean replaceWater = testblockParameterTypesSet.contains(TestblockParameterType.WATER);
|
||||
|
||||
resetRegion(p, node, isExtension ? RegionExtensionType.EXTENSION : RegionExtensionType.NORMAL, isIgnoreAir, isOnlyColor, replaceTNT, replaceWater);
|
||||
}
|
||||
@ -98,7 +99,7 @@ public class TestblockCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@ClassMapper(value = TestblockParameterType.class, local = true)
|
||||
private TypeMapper<TestblockParameterType> testblockParameterTypeMapper() {
|
||||
public TypeMapper<TestblockParameterType> testblockParameterTypeMapper() {
|
||||
Map<TestblockParameterType, List<String>> testblockParameterTypeListMap = new EnumMap<>(TestblockParameterType.class);
|
||||
for (TestblockParameterType value : TestblockParameterType.values()) {
|
||||
testblockParameterTypeListMap.put(value, value.getTabCompletes());
|
||||
@ -117,7 +118,7 @@ public class TestblockCommand extends SWCommand {
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Set<TestblockParameterType> testblockParameterTypeSet = new HashSet<>();
|
||||
previousArguments.getAll(TestblockParameterType.class).forEach(showModeType -> {
|
||||
testblockParameterTypeSet.addAll(Arrays.asList(showModeType.removed.get()));
|
||||
testblockParameterTypeSet.addAll(Arrays.asList(showModeType.getRemoved().get()));
|
||||
});
|
||||
Arrays.stream(previousArguments.userArgs).map(testblockParameterTypesMap::get).forEach(testblockParameterTypeSet::add);
|
||||
testblockParameterTypeSet.remove(null);
|
||||
@ -175,7 +176,36 @@ public class TestblockCommand extends SWCommand {
|
||||
};
|
||||
}
|
||||
|
||||
private enum TestblockParameterType {
|
||||
public static class TestblockParameter {
|
||||
private boolean water = false;
|
||||
private boolean tnt = false;
|
||||
private boolean extension = false;
|
||||
private boolean onlyColor = false;
|
||||
|
||||
private boolean ignoreAir = false;
|
||||
|
||||
public void enableWater() {
|
||||
this.water = true;
|
||||
}
|
||||
|
||||
public void enableTNT() {
|
||||
this.tnt = true;
|
||||
}
|
||||
|
||||
public void enableExtension() {
|
||||
this.extension = true;
|
||||
}
|
||||
|
||||
public void enableOnlyColor() {
|
||||
this.onlyColor = true;
|
||||
}
|
||||
|
||||
public void enableIgnoreAir() {
|
||||
this.ignoreAir = true;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TestblockParameterType {
|
||||
EXTENSION(TestblockParameter::enableExtension, Arrays.asList("-e", "-extension")),
|
||||
TNT(TestblockParameter::enableTNT, Arrays.asList("-t", "-tnt")),
|
||||
WATER(TestblockParameter::enableWater, Arrays.asList("-w", "-water")),
|
||||
@ -208,29 +238,4 @@ public class TestblockCommand extends SWCommand {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestblockParameter {
|
||||
private boolean water = false;
|
||||
private boolean tnt = false;
|
||||
private boolean extension = false;
|
||||
private boolean onlyColor = false;
|
||||
|
||||
private boolean ignoreAir = false;
|
||||
|
||||
public void enableWater() {
|
||||
this.water = true;
|
||||
}
|
||||
|
||||
public void enableTNT() {
|
||||
this.tnt = true;
|
||||
}
|
||||
|
||||
public void enableExtension() {
|
||||
this.extension = true;
|
||||
}
|
||||
|
||||
public void enableOnlyColor() { this.onlyColor = true; }
|
||||
|
||||
public void enableIgnoreAir() { this.ignoreAir = true; }
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Hier die Daten durchzureichen ist nicht sinnvoll, da RegionType.TESTBLOCK ja doch schon sagt das es der Testblock ist.