SteamWar/BauSystem
Archiviert
13
0

Add CommandTestblock.genericTestblockCommand

Dieser Commit ist enthalten in:
yoyosource 2021-04-10 19:57:56 +02:00
Ursprung 9e899fe195
Commit 7b3be4ae1e
4 geänderte Dateien mit 12 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.world.regions;
import com.google.common.collect.Sets;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
@ -40,6 +41,8 @@ import org.bukkit.Bukkit;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Objects;
class Region_15 {
@ -77,6 +80,9 @@ class Region_15 {
e.setBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint())), BlockTypes.AIR.getDefaultState().toBaseBlock());
}
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteOptions.isIgnoreAir()).build());
if (pasteOptions.isReset() && pasteOptions.getWaterLevel() != 0) {
e.replaceBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), new HashSet<>(Arrays.asList(BlockTypes.AIR.getDefaultState().toBaseBlock())), BlockTypes.WATER.getDefaultState().toBaseBlock());
}
return e;
} catch (WorldEditException e) {
throw new SecurityException(e.getMessage(), e);

Datei anzeigen

@ -59,6 +59,11 @@ public class PasteOptions {
*/
private Point maxPoint = null;
/**
* Used in 1.15
*/
private int waterLevel = 0;
public PasteOptions(boolean rotate) {
this.rotate = rotate;
}

Datei anzeigen

@ -69,11 +69,6 @@ public class CommandTestblock extends SWCommand {
schematicTestblockCommand(p, s, RegionExtensionType.NORMAL);
}
@Register
public void schematicTestblockCommand(Player p, RegionExtensionType regionExtensionType, String s) {
schematicTestblockCommand(p, s, regionExtensionType);
}
@Register
public void schematicTestblockCommand(Player p, String s, RegionExtensionType regionExtensionType) {
if (!permissionCheck(p)) return;

Datei anzeigen

@ -151,7 +151,7 @@ public class Prototype {
public EditSession reset(Region region, Schematic schem, boolean ignoreAir, Color color, boolean reset) throws IOException, NoClipboardException {
PasteOptions pasteOptions;
if (reset) {
pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color, true, getMinPoint(region, RegionExtensionType.EXTENSION), getMaxPoint(region, RegionExtensionType.EXTENSION));
pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color, true, getMinPoint(region, RegionExtensionType.EXTENSION), getMaxPoint(region, RegionExtensionType.EXTENSION), waterLevel);
} else {
pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color);
}