2021-04-18 18:47:43 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of the SteamWar software.
|
|
|
|
*
|
2022-01-29 15:28:28 +01:00
|
|
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
2021-04-18 18:47:43 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-01-29 15:28:28 +01:00
|
|
|
package de.steamwar.bausystem.utils;
|
2021-04-18 18:47:43 +02:00
|
|
|
|
|
|
|
import com.sk89q.worldedit.EditSession;
|
|
|
|
import com.sk89q.worldedit.WorldEdit;
|
|
|
|
import com.sk89q.worldedit.WorldEditException;
|
|
|
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
2022-01-29 15:28:28 +01:00
|
|
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
2021-07-05 19:32:10 +02:00
|
|
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
2021-04-18 18:47:43 +02:00
|
|
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
2021-07-05 19:32:10 +02:00
|
|
|
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
2021-04-18 18:47:43 +02:00
|
|
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
|
|
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
2021-07-05 19:32:10 +02:00
|
|
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
2022-05-18 17:33:25 +02:00
|
|
|
import com.sk89q.worldedit.function.mask.Mask;
|
2021-08-01 22:01:25 +02:00
|
|
|
import com.sk89q.worldedit.function.mask.Mask2D;
|
2021-07-05 19:32:10 +02:00
|
|
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
2021-04-18 18:47:43 +02:00
|
|
|
import com.sk89q.worldedit.function.operation.Operations;
|
2023-02-18 13:41:02 +01:00
|
|
|
import com.sk89q.worldedit.function.pattern.WaterloggedRemover;
|
2021-04-18 18:47:43 +02:00
|
|
|
import com.sk89q.worldedit.math.BlockVector3;
|
|
|
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
|
|
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
2022-05-18 17:33:25 +02:00
|
|
|
import com.sk89q.worldedit.regions.Region;
|
2022-01-29 15:28:28 +01:00
|
|
|
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
2021-04-18 18:47:43 +02:00
|
|
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
2022-01-29 15:28:28 +01:00
|
|
|
import com.sk89q.worldedit.world.World;
|
2021-04-18 18:47:43 +02:00
|
|
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
|
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
2022-01-29 15:28:28 +01:00
|
|
|
import de.steamwar.bausystem.region.Color;
|
|
|
|
import de.steamwar.bausystem.region.PasteOptions;
|
|
|
|
import de.steamwar.bausystem.region.Point;
|
2021-07-30 23:00:32 +02:00
|
|
|
import org.bukkit.Bukkit;
|
2022-01-29 15:28:28 +01:00
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.block.data.BlockData;
|
|
|
|
import org.bukkit.block.data.Waterlogged;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import org.bukkit.util.Vector;
|
2021-07-30 23:00:32 +02:00
|
|
|
|
2021-08-01 22:01:25 +02:00
|
|
|
import javax.annotation.Nullable;
|
2021-04-18 18:47:43 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
2021-07-05 19:32:10 +02:00
|
|
|
import java.io.FileOutputStream;
|
2021-04-18 18:47:43 +02:00
|
|
|
import java.io.IOException;
|
2023-02-06 21:38:12 +01:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Set;
|
2021-07-05 19:32:10 +02:00
|
|
|
import java.util.logging.Level;
|
2021-04-18 18:47:43 +02:00
|
|
|
|
2022-08-03 19:10:26 +02:00
|
|
|
public class FlatteningWrapper15 implements FlatteningWrapper {
|
2022-01-29 15:28:28 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isNoBook(ItemStack item) {
|
|
|
|
return item.getType() != Material.WRITABLE_BOOK && item.getType() != Material.WRITTEN_BOOK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Set<Material> unpushable = new HashSet<>(Arrays.asList(Material.BARRIER, Material.BEACON, Material.COMMAND_BLOCK, Material.CHAIN_COMMAND_BLOCK, Material.REPEATING_COMMAND_BLOCK, Material.ENCHANTING_TABLE, Material.END_GATEWAY, Material.END_PORTAL, Material.ENDER_CHEST, Material.GRINDSTONE, Material.JIGSAW, Material.JUKEBOX, Material.NETHER_PORTAL, Material.OBSIDIAN, Material.STRUCTURE_VOID, Material.BARREL, Material.BEEHIVE, Material.BEE_NEST, Material.BLAST_FURNACE, Material.BREWING_STAND, Material.CHEST, Material.DAYLIGHT_DETECTOR, Material.DISPENSER, Material.DROPPER, Material.FURNACE, Material.HOPPER, Material.LECTERN, Material.SMOKER, Material.TRAPPED_CHEST));
|
|
|
|
|
|
|
|
// TODO: FLOWER
|
|
|
|
private static final Set<Material> breaking = new HashSet<>(Arrays.asList(Material.BAMBOO, Material.CACTUS, Material.CAKE, Material.CARVED_PUMPKIN, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.COBWEB, Material.COCOA, Material.DRAGON_EGG, Material.FIRE, Material.FLOWER_POT, Material.JACK_O_LANTERN, Material.LADDER, Material.LAVA, Material.LAVA, Material.LEVER, Material.LILY_PAD, Material.MELON, Material.NETHER_WART, Material.PUMPKIN, Material.COMPARATOR, Material.REDSTONE_WIRE, Material.REPEATER, Material.TORCH, Material.STRUCTURE_VOID, Material.SCAFFOLDING, Material.SEA_PICKLE, Material.SNOW, Material.SUGAR_CANE, Material.TORCH, Material.TRIPWIRE, Material.TRIPWIRE_HOOK, Material.TURTLE_EGG, Material.VINE, Material.WATER, Material.WHEAT));
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isUnpusheable(Material material) {
|
|
|
|
if (unpushable.contains(material)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
String name = material.name();
|
|
|
|
return name.contains("BANNER") || name.contains("SIGN");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isBreakingOnPush(Material material) {
|
|
|
|
if (breaking.contains(material)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
String name = material.name();
|
|
|
|
return name.contains("BED") || name.contains("BUTTON") || name.contains("CARPET") || (name.contains("DOOR") && !name.contains("TRAPDOOR")) || name.contains("HEAD") || name.contains("LEAVES") || name.contains("MUSHROOM") || name.contains("PRESSURE_PLATE") || name.contains("SHULKER_BOX");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isWorldEditCommand(String command) {
|
|
|
|
if (command.startsWith("/")) {
|
|
|
|
command = command.replaceFirst("/", "");
|
|
|
|
}
|
|
|
|
command = command.toLowerCase();
|
|
|
|
return WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().containsCommand(command);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final WorldEditPlugin WORLDEDIT_PLUGIN = Objects.requireNonNull((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
|
|
|
private static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
|
|
|
|
@Override
|
|
|
|
public void setSelection(Player p, Point minPoint, Point maxPoint) {
|
|
|
|
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, toBlockVector3(minPoint), toBlockVector3(maxPoint)));
|
|
|
|
}
|
2021-07-31 12:08:53 +02:00
|
|
|
|
2021-07-31 12:57:01 +02:00
|
|
|
private static final BaseBlock WOOL = Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock();
|
|
|
|
private static final BaseBlock CLAY = Objects.requireNonNull(BlockTypes.PINK_TERRACOTTA).getDefaultState().toBaseBlock();
|
2021-12-22 13:25:57 +01:00
|
|
|
private static final BaseBlock GLAZED = Objects.requireNonNull(BlockTypes.PINK_GLAZED_TERRACOTTA).getDefaultState().toBaseBlock();
|
2021-07-31 12:57:01 +02:00
|
|
|
private static final BaseBlock GLASS = Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS).getDefaultState().toBaseBlock();
|
|
|
|
private static final BaseBlock GLASS_PANE = Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS_PANE).getDefaultState().toBaseBlock();
|
|
|
|
private static final BaseBlock CONCRETE = Objects.requireNonNull(BlockTypes.PINK_CONCRETE).getDefaultState().toBaseBlock();
|
|
|
|
private static final BaseBlock CONCRETE_POWDER = Objects.requireNonNull(BlockTypes.PINK_CONCRETE_POWDER).getDefaultState().toBaseBlock();
|
|
|
|
private static final BaseBlock CARPET = Objects.requireNonNull(BlockTypes.PINK_CARPET).getDefaultState().toBaseBlock();
|
|
|
|
|
2022-01-29 15:28:28 +01:00
|
|
|
@Override
|
|
|
|
public EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) {
|
2021-07-31 12:57:01 +02:00
|
|
|
Clipboard clipboard;
|
|
|
|
try (ClipboardReader reader = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file))) {
|
|
|
|
clipboard = reader.read();
|
|
|
|
} catch (NullPointerException | IOException e) {
|
|
|
|
throw new SecurityException("Bausystem schematic not found", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
EditSession editSession = paste(clipboard, pastePoint, pasteOptions);
|
|
|
|
return editSession;
|
|
|
|
}
|
|
|
|
|
2022-01-29 15:28:28 +01:00
|
|
|
@Override
|
|
|
|
public EditSession paste(Clipboard clipboard, Point pastePoint, PasteOptions pasteOptions) {
|
2021-07-31 12:57:01 +02:00
|
|
|
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
|
2023-02-24 22:13:34 +01:00
|
|
|
if (pasteOptions.getColor() != Color.PINK) {
|
2021-07-31 13:05:39 +02:00
|
|
|
changeColor(clipboard, pasteOptions.getColor());
|
|
|
|
}
|
2023-02-04 11:56:52 +01:00
|
|
|
|
|
|
|
Set<String> blocks = new HashSet<>();
|
2023-02-06 09:37:34 +01:00
|
|
|
{
|
2023-02-04 11:56:52 +01:00
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_wool");
|
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_terracotta");
|
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_glazed_terracotta");
|
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_stained_glass");
|
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_stained_glass_pane");
|
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_concrete");
|
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_concrete_powder");
|
|
|
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_carpet");
|
|
|
|
}
|
2023-02-06 09:37:34 +01:00
|
|
|
|
2023-02-04 11:26:50 +01:00
|
|
|
e.setMask(new Mask() {
|
|
|
|
@Override
|
|
|
|
public boolean test(BlockVector3 blockVector3) {
|
|
|
|
BaseBlock block = clipboard.getFullBlock(blockVector3);
|
|
|
|
String blockName = block.toString().toLowerCase();
|
2023-02-18 13:41:02 +01:00
|
|
|
|
2023-02-06 09:37:34 +01:00
|
|
|
if (blocks.contains(blockName) && pasteOptions.isOnlyColors()) return true;
|
2023-02-16 21:53:52 +01:00
|
|
|
if (pasteOptions.isTestBlock()) {
|
|
|
|
if (blockName.startsWith("minecraft:water")) return false;
|
2023-02-18 13:41:02 +01:00
|
|
|
if (blockName.contains("waterlogged=true")) try {
|
|
|
|
e.setBlock(blockVector3, new WaterloggedRemover(clipboard).applyBlock(blockVector3));
|
|
|
|
} catch (WorldEditException ex) {
|
|
|
|
throw new RuntimeException(ex);
|
|
|
|
}
|
2023-07-27 01:09:52 +02:00
|
|
|
if (blockName.startsWith("minecraft:tnt") && pasteOptions.isRemoveTNT()) return false;
|
2023-02-16 21:53:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-06 09:37:34 +01:00
|
|
|
return true;
|
2023-02-04 11:26:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public Mask2D toMask2D() {
|
|
|
|
return null;
|
|
|
|
}
|
2023-02-06 09:37:34 +01:00
|
|
|
public Mask copy() {
|
|
|
|
return this;
|
|
|
|
}
|
2023-02-04 11:26:50 +01:00
|
|
|
});
|
2021-07-31 12:57:01 +02:00
|
|
|
|
|
|
|
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
|
|
|
BlockVector3 dimensions = clipboard.getDimensions();
|
|
|
|
BlockVector3 v = BlockVector3.at(pastePoint.getX(), pastePoint.getY(), pastePoint.getZ());
|
|
|
|
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
|
|
|
if (pasteOptions.isRotate()) {
|
|
|
|
ch.setTransform(new AffineTransform().rotateY(180));
|
2021-12-03 16:32:03 +01:00
|
|
|
v = v.add(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset.multiply(-1, 1, -1)).subtract(0, 0, 1);
|
2021-07-31 12:57:01 +02:00
|
|
|
} else {
|
|
|
|
v = v.subtract(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pasteOptions.isReset()) {
|
2023-02-06 09:37:34 +01:00
|
|
|
e.setBlocks(new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
2021-07-31 12:57:01 +02:00
|
|
|
if (pasteOptions.getWaterLevel() != 0) {
|
2022-05-18 17:33:25 +02:00
|
|
|
e.setBlocks((Region) new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
2021-07-31 12:57:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteOptions.isIgnoreAir()).build());
|
|
|
|
return e;
|
|
|
|
} catch (WorldEditException e) {
|
|
|
|
throw new SecurityException(e.getMessage(), e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-29 15:28:28 +01:00
|
|
|
@Override
|
|
|
|
public void changeColor(Clipboard clipboard, Color color) throws WorldEditException {
|
2021-07-31 12:57:01 +02:00
|
|
|
BlockVector3 minimum = clipboard.getRegion().getMinimumPoint();
|
|
|
|
BaseBlock wool = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_wool")).getDefaultState().toBaseBlock();
|
|
|
|
BaseBlock clay = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_terracotta")).getDefaultState().toBaseBlock();
|
2021-12-22 13:25:57 +01:00
|
|
|
BaseBlock glazed = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_glazed_terracotta")).getDefaultState().toBaseBlock();
|
2021-07-31 12:57:01 +02:00
|
|
|
BaseBlock glass = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_stained_glass")).getDefaultState().toBaseBlock();
|
|
|
|
BaseBlock glassPane = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_stained_glass_pane")).getDefaultState().toBaseBlock();
|
|
|
|
BaseBlock carpet = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_carpet")).getDefaultState().toBaseBlock();
|
|
|
|
BaseBlock concrete = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_concrete")).getDefaultState().toBaseBlock();
|
|
|
|
BaseBlock concretePowder = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_concrete_powder")).getDefaultState().toBaseBlock();
|
|
|
|
|
|
|
|
for (int x = 0; x < clipboard.getDimensions().getX(); x++) {
|
|
|
|
for (int y = 0; y < clipboard.getDimensions().getY(); y++) {
|
|
|
|
for (int z = 0; z < clipboard.getDimensions().getZ(); z++) {
|
|
|
|
BlockVector3 pos = minimum.add(x, y, z);
|
|
|
|
BaseBlock block = clipboard.getFullBlock(pos);
|
|
|
|
if (block.equals(WOOL)) {
|
|
|
|
clipboard.setBlock(pos, wool);
|
|
|
|
} else if (block.equals(CLAY)) {
|
|
|
|
clipboard.setBlock(pos, clay);
|
2021-12-22 13:25:57 +01:00
|
|
|
} else if (block.equals(GLAZED)) {
|
|
|
|
clipboard.setBlock(pos, glazed);
|
2021-07-31 12:57:01 +02:00
|
|
|
} else if (block.equals(GLASS)) {
|
|
|
|
clipboard.setBlock(pos, glass);
|
|
|
|
} else if (block.equals(GLASS_PANE)) {
|
|
|
|
clipboard.setBlock(pos, glassPane);
|
|
|
|
} else if (block.equals(CARPET)) {
|
|
|
|
clipboard.setBlock(pos, carpet);
|
|
|
|
} else if (block.equals(CONCRETE)) {
|
|
|
|
clipboard.setBlock(pos, concrete);
|
|
|
|
} else if (block.equals(CONCRETE_POWDER)) {
|
|
|
|
clipboard.setBlock(pos, concretePowder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-29 15:28:28 +01:00
|
|
|
@Override
|
|
|
|
public boolean backup(Point minPoint, Point maxPoint, File file) {
|
2021-07-31 12:57:01 +02:00
|
|
|
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
|
2022-01-29 15:28:28 +01:00
|
|
|
CuboidRegion region = new CuboidRegion(bukkitWorld, toBlockVector3(minPoint), toBlockVector3(maxPoint));
|
2021-07-31 12:57:01 +02:00
|
|
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
|
|
|
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(bukkitWorld, -1)) {
|
|
|
|
ForwardExtentCopy copy = new ForwardExtentCopy(
|
|
|
|
e, region, clipboard, region.getMinimumPoint()
|
|
|
|
);
|
|
|
|
|
|
|
|
copy.setCopyingEntities(false);
|
|
|
|
copy.setCopyingBiomes(false);
|
|
|
|
|
|
|
|
Operations.complete(copy);
|
|
|
|
|
|
|
|
try (ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream(file))) {
|
|
|
|
writer.write(clipboard);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} catch (WorldEditException | IOException e) {
|
|
|
|
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2022-01-29 15:28:28 +01:00
|
|
|
|
|
|
|
private BlockVector3 toBlockVector3(Point point) {
|
|
|
|
return BlockVector3.at(point.getX(), point.getY(), point.getZ());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
|
|
|
|
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
|
|
|
if (block.getType() == Material.WATER)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
BlockData data = block.getBlockData();
|
|
|
|
if (!(data instanceof Waterlogged))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return ((Waterlogged) data).isWaterlogged();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Material getTraceShowMaterial() {
|
|
|
|
return Material.LIME_CONCRETE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Material getTraceHideMaterial() {
|
|
|
|
return Material.RED_CONCRETE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Material getTraceXZMaterial() {
|
|
|
|
return Material.QUARTZ_SLAB;
|
|
|
|
}
|
|
|
|
}
|