diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 64671efde..fba678660 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -450,12 +450,4 @@ public class BukkitWorld extends LocalWorld { return false; } } - - /** - * @deprecated Use {@link #setBlock(Vector, BaseBlock, boolean)} - */ - @Deprecated - public boolean setBlock(Vector pt, com.sk89q.worldedit.foundation.Block block, boolean notifyAdjacent) throws WorldEditException { - return setBlock(pt, (BaseBlock) block, notifyAdjacent); - } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBag.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBag.java deleted file mode 100644 index c8842ccb2..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBag.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bags; - -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.blocks.*; - -/** - * @deprecated Block bags are currently not a supported feature of WorldEdit - */ -@SuppressWarnings("deprecation") -@Deprecated - -public abstract class BlockBag { - - /** - * Stores a block as if it was mined. - * - * @param id the ID of the block - * @throws BlockBagException thrown on a error - * @deprecated Use {@link BlockBag#storeDroppedBlock(int, int)} instead - */ - @Deprecated - public void storeDroppedBlock(int id) throws BlockBagException { - storeDroppedBlock(id, 0); - } - - /** - * Stores a block as if it was mined. - * - * @param id the ID of the block - * @param data the data value of the block - * @throws BlockBagException thrown on a error - */ - public void storeDroppedBlock(int id, int data) throws BlockBagException { - BaseItem dropped = BlockType.getBlockBagItem(id, data); - if (dropped == null) return; - if (dropped.getType() == BlockID.AIR) return; - - storeItem(dropped); - } - - /** - * Sets a block as if it was placed by hand. - * - * @param id the ID of the block - * @throws BlockBagException - * @deprecated Use {@link #fetchPlacedBlock(int,int)} instead - */ - @Deprecated - public void fetchPlacedBlock(int id) throws BlockBagException { - fetchPlacedBlock(id, 0); - } - - /** - * Sets a block as if it was placed by hand. - * - * @param id the ID of the block - * @param data the data value of the block - * @throws BlockBagException - */ - public void fetchPlacedBlock(int id, int data) throws BlockBagException { - try { - // Blocks that can't be fetched... - switch (id) { - case BlockID.BEDROCK: - case BlockID.GOLD_ORE: - case BlockID.IRON_ORE: - case BlockID.COAL_ORE: - case BlockID.DIAMOND_ORE: - case BlockID.TNT: - case BlockID.MOB_SPAWNER: - case BlockID.CROPS: - case BlockID.REDSTONE_ORE: - case BlockID.GLOWING_REDSTONE_ORE: - case BlockID.SNOW: - case BlockID.LIGHTSTONE: - case BlockID.PORTAL: - throw new UnplaceableBlockException(); - - case BlockID.WATER: - case BlockID.STATIONARY_WATER: - case BlockID.LAVA: - case BlockID.STATIONARY_LAVA: - // Override liquids - return; - - default: - fetchBlock(id); - break; - } - - } catch (OutOfBlocksException e) { - BaseItem placed = BlockType.getBlockBagItem(id, data); - if (placed == null) throw e; // TODO: check - if (placed.getType() == BlockID.AIR) throw e; // TODO: check - - fetchItem(placed); - } - } - - /** - * Get a block. - * - * Either this method or fetchItem needs to be overridden - * - * @param id the ID of the block - * @throws BlockBagException - */ - public void fetchBlock(int id) throws BlockBagException { - fetchItem(new BaseItem(id)); - } - - /** - * Get a block. - * - * Either this method or fetchBlock needs to be overridden - * - * @param item the item - * @throws BlockBagException - */ - public void fetchItem(BaseItem item) throws BlockBagException { - fetchBlock(item.getType()); - } - - /** - * Store a block. - * - * Either this method or storeItem needs to be overridden - * - * @param id the ID of the block - * @throws BlockBagException - */ - public void storeBlock(int id) throws BlockBagException { - storeItem(new BaseItem(id)); - } - - /** - * Store a block. - * - * Either this method or storeBlock needs to be overridden - * - * @param item the item - * @throws BlockBagException - */ - public void storeItem(BaseItem item) throws BlockBagException { - storeBlock(item.getType()); - } - - /** - * Checks to see if a block exists without removing it. - * - * @param id the ID of the block - * @return whether the block exists - */ - public boolean peekBlock(int id) { - try { - fetchBlock(id); - storeBlock(id); - return true; - } catch (BlockBagException e) { - return false; - } - } - - /** - * Flush any changes. This is called at the end. - */ - public abstract void flushChanges(); - - /** - * Adds a position to be used a source. - * - * @param position the position of the source - */ - public abstract void addSourcePosition(WorldVector position); - - /** - * Adds a position to be used a source. - * - * @param position the position of the source - */ - public abstract void addSingleSourcePosition(WorldVector position); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBagException.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBagException.java deleted file mode 100644 index 8b3ace06f..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBagException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bags; - - -/** - * @deprecated Block bags are currently not a supported feature of WorldEdit - */ -@Deprecated -public class BlockBagException extends Exception { - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfBlocksException.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfBlocksException.java deleted file mode 100644 index 197d9c241..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfBlocksException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bags; - - -/** - * @deprecated Block bags are currently not a supported feature of WorldEdit - */ -@Deprecated -public class OutOfBlocksException extends BlockBagException { - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfSpaceException.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfSpaceException.java deleted file mode 100644 index c5379db5d..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfSpaceException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bags; - - -/** - * @deprecated Block bags are currently not a supported feature of WorldEdit - */ -@Deprecated -public class OutOfSpaceException extends BlockBagException { - - private int id; - - /** - * Construct the object. - * - * @param id the type ID - */ - public OutOfSpaceException(int id) { - this.id = id; - } - - /** - * @return the id - */ - public int getID() { - return id; - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/UnplaceableBlockException.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/UnplaceableBlockException.java deleted file mode 100644 index b1ab13802..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/UnplaceableBlockException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bags; - - -/** - * @deprecated Block bags are currently not a supported feature of WorldEdit - */ -@Deprecated -public class UnplaceableBlockException extends BlockBagException { - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java deleted file mode 100644 index 9c62e7f6d..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; -import com.sk89q.worldedit.world.storage.InvalidFormatException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents a chest block. - */ -public class ChestBlock extends ContainerBlock { - - /** - * Construct an empty chest block with the default orientation (data value). - */ - public ChestBlock() { - super(BlockID.CHEST, 27); - } - - /** - * Construct an empty chest block with a custom data value. - * - * @param data data indicating the position of the chest - */ - public ChestBlock(int data) { - super(BlockID.CHEST, data, 27); - } - - /** - * Construct the chest block with a custom data value and a list of items. - * - * @param data data indicating the position of the chest - * @param items array of items - */ - public ChestBlock(int data, BaseItemStack[] items) { - super(BlockID.CHEST, data, 27); - setItems(items); - } - - @Override - public String getNbtId() { - return "Chest"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("Items", new ListTag(CompoundTag.class, serializeInventory(getItems()))); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - if (rootTag == null) { - return; - } - - Map values = rootTag.getValue(); - - Tag t = values.get("id"); - if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Chest")) { - throw new RuntimeException("'Chest' tile entity expected"); - } - - List items = new ArrayList(); - - try { - for (Tag tag : NBTUtils.getChildTag(values, "Items", ListTag.class).getValue()) { - if (!(tag instanceof CompoundTag)) { - throw new RuntimeException("CompoundTag expected as child tag of Chest's Items"); - } - - items.add((CompoundTag) tag); - } - - setItems(deserializeInventory(items)); - } catch (InvalidFormatException e) { - throw new RuntimeException(e); - } catch (DataException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java deleted file mode 100644 index 05709cd0b..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.ByteTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents a block that stores items. - */ -public abstract class ContainerBlock extends BaseBlock implements TileEntityBlock { - - private BaseItemStack[] items; - - public ContainerBlock(int type, int inventorySize) { - super(type); - this.items = new BaseItemStack[inventorySize]; - } - - public ContainerBlock(int type, int data, int inventorySize) { - super(type, data); - this.items = new BaseItemStack[inventorySize]; - } - - /** - * Get the list of items. - * - * @return an array of stored items - */ - public BaseItemStack[] getItems() { - return this.items; - } - - /** - * Set the list of items. - * - * @param items an array of stored items - */ - public void setItems(BaseItemStack[] items) { - this.items = items; - } - - @Override - public boolean hasNbtData() { - return true; - } - - public Map serializeItem(BaseItemStack item) { - Map data = new HashMap(); - data.put("id", new ShortTag((short) item.getType())); - data.put("Damage", new ShortTag(item.getData())); - data.put("Count", new ByteTag((byte) item.getAmount())); - if (!item.getEnchantments().isEmpty()) { - List enchantmentList = new ArrayList(); - for(Map.Entry entry : item.getEnchantments().entrySet()) { - Map enchantment = new HashMap(); - enchantment.put("id", new ShortTag(entry.getKey().shortValue())); - enchantment.put("lvl", new ShortTag(entry.getValue().shortValue())); - enchantmentList.add(new CompoundTag(enchantment)); - } - - Map auxData = new HashMap(); - auxData.put("ench", new ListTag(CompoundTag.class, enchantmentList)); - data.put("tag", new CompoundTag(auxData)); - } - return data; - } - - public BaseItemStack deserializeItem(Map data) throws DataException { - short id = NBTUtils.getChildTag(data, "id", ShortTag.class).getValue(); - short damage = NBTUtils.getChildTag(data, "Damage", ShortTag.class).getValue(); - byte count = NBTUtils.getChildTag(data, "Count", ByteTag.class).getValue(); - - BaseItemStack stack = new BaseItemStack(id, count, damage); - - if (data.containsKey("tag")) { - Map auxData = NBTUtils.getChildTag(data, "tag", CompoundTag.class).getValue(); - ListTag ench = (ListTag)auxData.get("ench"); - for(Tag e : ench.getValue()) { - Map vars = ((CompoundTag) e).getValue(); - short enchId = NBTUtils.getChildTag(vars, "id", ShortTag.class).getValue(); - short enchLevel = NBTUtils.getChildTag(vars, "lvl", ShortTag.class).getValue(); - stack.getEnchantments().put((int) enchId, (int) enchLevel); - } - } - return stack; - } - - public BaseItemStack[] deserializeInventory(List items) throws DataException { - BaseItemStack[] stacks = new BaseItemStack[items.size()]; - for (CompoundTag tag : items) { - Map item = tag.getValue(); - BaseItemStack stack = deserializeItem(item); - byte slot = NBTUtils.getChildTag(item, "Slot", ByteTag.class).getValue(); - if (slot >= 0 && slot < stacks.length) { - stacks[slot] = stack; - } - } - return stacks; - } - - public List serializeInventory(BaseItemStack[] items) { - List tags = new ArrayList(); - for (int i = 0; i < items.length; ++i) { - if (items[i] != null) { - Map tagData = serializeItem(items[i]); - tagData.put("Slot", new ByteTag((byte) i)); - tags.add(new CompoundTag(tagData)); - } - } - return tags; - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java deleted file mode 100644 index 4140ee88a..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents dispensers. - */ -public class DispenserBlock extends ContainerBlock { - - /** - * Construct an empty dispenser block. - */ - public DispenserBlock() { - super(BlockID.DISPENSER, 9); - } - - /** - * Construct an empty dispenser block. - * - * @param data data value (orientation) - */ - public DispenserBlock(int data) { - super(BlockID.DISPENSER, data, 9); - } - - /** - * Construct a dispenser block with the given orientation and inventory. - * - * @param data data value (orientation) - * @param items array of items in the inventory - */ - public DispenserBlock(int data, BaseItemStack[] items) { - super(BlockID.DISPENSER, data, 9); - this.setItems(items); - } - - @Override - public String getNbtId() { - return "Trap"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("Items", new ListTag(CompoundTag.class, serializeInventory(getItems()))); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - try { - if (rootTag == null) { - return; - } - - Map values = rootTag.getValue(); - - Tag t = values.get("id"); - if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Trap")) { - throw new DataException("'Trap' tile entity expected"); - } - - List items = new ArrayList(); - for (Tag tag : NBTUtils.getChildTag(values, "Items", ListTag.class).getValue()) { - if (!(tag instanceof CompoundTag)) { - throw new DataException("CompoundTag expected as child tag of Trap Items"); - } - - items.add((CompoundTag) tag); - } - - setItems(deserializeInventory(items)); - } catch (DataException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java deleted file mode 100644 index f2001d754..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents a furnace block. - */ -public class FurnaceBlock extends ContainerBlock { - - private short burnTime; - private short cookTime; - - /** - * Construct an empty furnace block with the default orientation. - * - * @param type type ID - */ - public FurnaceBlock(int type) { - super(type, 2); - } - - /** - * Construct an empty furnace block with a given orientation. - * - * @param type type ID - * @param data orientation - */ - public FurnaceBlock(int type, int data) { - super(type, data, 2); - } - - /** - * Construct an furnace block with a given orientation and inventory. - * - * @param type type ID - * @param data orientation - * @param items inventory items - */ - public FurnaceBlock(int type, int data, BaseItemStack[] items) { - super(type, data, 2); - setItems(items); - } - - /** - * Get the burn time. - * - * @return the burn time - */ - public short getBurnTime() { - return burnTime; - } - - /** - * Set the burn time. - * - * @param burnTime the burn time - */ - public void setBurnTime(short burnTime) { - this.burnTime = burnTime; - } - - /** - * Get the cook time. - * - * @return the cook time - */ - public short getCookTime() { - return cookTime; - } - - /** - * Set the cook time. - * - * @param cookTime the cook time to set - */ - public void setCookTime(short cookTime) { - this.cookTime = cookTime; - } - - @Override - public String getNbtId() { - return "Furnace"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("Items", new ListTag(CompoundTag.class, serializeInventory(getItems()))); - values.put("BurnTime", new ShortTag(burnTime)); - values.put("CookTime", new ShortTag(cookTime)); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - if (rootTag == null) { - return; - } - - try { - Map values = rootTag.getValue(); - - Tag t = values.get("id"); - if (!(t instanceof StringTag) - || !((StringTag) t).getValue().equals("Furnace")) { - throw new RuntimeException("'Furnace' tile entity expected"); - } - - ListTag items = NBTUtils.getChildTag(values, "Items", ListTag.class); - - List compound = new ArrayList(); - - for (Tag tag : items.getValue()) { - if (!(tag instanceof CompoundTag)) { - throw new RuntimeException("CompoundTag expected as child tag of Furnace Items"); - } - compound.add((CompoundTag) tag); - } - setItems(deserializeInventory(compound)); - - t = values.get("BurnTime"); - if (t instanceof ShortTag) { - burnTime = ((ShortTag) t).getValue(); - } - - t = values.get("CookTime"); - if (t instanceof ShortTag) { - cookTime = ((ShortTag) t).getValue(); - } - } catch (DataException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/data/DataException.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/data/DataException.java deleted file mode 100644 index 442ffc35f..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/data/DataException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.data; - -/** - * @deprecated Switch to {@link com.sk89q.worldedit.world.DataException} - */ -@Deprecated -public class DataException extends com.sk89q.worldedit.world.DataException { - - public DataException(String msg) { - super(msg); - } - - public DataException() { - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/foundation/Block.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/foundation/Block.java deleted file mode 100644 index c39c51e57..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/foundation/Block.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.foundation; - -import com.sk89q.worldedit.blocks.BaseBlock; - -/** - * @deprecated Use {@link BaseBlock} - */ -@Deprecated -public abstract class Block { - - public abstract int getId(); - - public abstract void setId(int id); - - public abstract int getData(); - - public abstract void setData(int data); - - public abstract void setIdAndData(int id, int data); - - public abstract boolean hasWildcardData(); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/AbstractMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/AbstractMask.java deleted file mode 100644 index 704ce4035..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/AbstractMask.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; - -/** - * @deprecated Switch to {@link com.sk89q.worldedit.function.mask.AbstractMask} - */ -@Deprecated -public abstract class AbstractMask implements Mask { - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockMask.java deleted file mode 100644 index f50b76de2..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockMask.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -/** - * @deprecated Use {@link com.sk89q.worldedit.function.mask.BlockMask} - */ -@Deprecated -public class BlockMask extends AbstractMask { - - private final Set blocks; - - public BlockMask() { - blocks = new HashSet(); - } - - public BlockMask(Set types) { - this.blocks = types; - } - - public BlockMask(BaseBlock... block) { - blocks = new HashSet(); - for (BaseBlock b : block) { - add(b); - } - } - - public BlockMask(BaseBlock block) { - this(); - add(block); - } - - public void add(BaseBlock block) { - blocks.add(block); - } - - public void addAll(Collection blocks) { - blocks.addAll(blocks); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - BaseBlock block = editSession.getBlock(position); - return blocks.contains(block) - || blocks.contains(new BaseBlock(block.getType())); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockTypeMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockTypeMask.java deleted file mode 100644 index 5d195c4fc..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockTypeMask.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.blocks.BaseBlock; - -import java.util.Set; - -/** - * A filter that matches blocks based on block types. - * - * @deprecated replaced by {@link #BlockMask} - */ -@Deprecated -public class BlockTypeMask extends BlockMask { - - public BlockTypeMask() { - super(); - } - - public BlockTypeMask(Set types) { - super(); - for (int type : types) { - add(type); - } - } - - public BlockTypeMask(int type) { - this(); - add(type); - } - - public void add(int type) { - add(new BaseBlock(type)); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/CombinedMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/CombinedMask.java deleted file mode 100644 index 3f7a6690e..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/CombinedMask.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.function.mask.MaskIntersection; - -import java.util.ArrayList; -import java.util.List; - -/** - * @deprecated See {@link MaskIntersection} - */ -@Deprecated -public class CombinedMask extends AbstractMask { - private final List masks = new ArrayList(); - - public CombinedMask() { - } - - public CombinedMask(Mask mask) { - add(mask); - } - - public CombinedMask(Mask ...mask) { - for (Mask m : mask) { - add(m); - } - } - - public CombinedMask(List masks) { - this.masks.addAll(masks); - } - - public void add(Mask mask) { - masks.add(mask); - } - - public boolean remove(Mask mask) { - return masks.remove(mask); - } - - public boolean has(Mask mask) { - return masks.contains(mask); - } - - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - for (Mask mask : masks) { - mask.prepare(session, player, target); - } - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - for (Mask mask : masks) { - if (!mask.matches(editSession, position)) { - return false; - } - } - - return true; - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/DynamicRegionMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/DynamicRegionMask.java deleted file mode 100644 index ebe866f57..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/DynamicRegionMask.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.session.request.RequestSelection; - -/** - * @deprecated Use {@link RequestSelection} with {@link com.sk89q.worldedit.function.mask.RegionMask} - */ -@Deprecated -public class DynamicRegionMask extends AbstractMask { - private Region region; - - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - try { - region = session.getSelection(player.getWorld()); - } catch (IncompleteRegionException exc) { - region = null; - } - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return region == null || region.contains(position); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/ExistingBlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/ExistingBlockMask.java deleted file mode 100644 index 487786d06..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/ExistingBlockMask.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockID; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.ExistingBlockMask} - */ -@Deprecated -public class ExistingBlockMask extends AbstractMask { - @Override - public boolean matches(EditSession editSession, Vector position) { - return editSession.getBlockType(position) != BlockID.AIR; - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/FuzzyBlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/FuzzyBlockMask.java deleted file mode 100644 index 63093624c..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/FuzzyBlockMask.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.Blocks; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.FuzzyBlockMask} - */ -@Deprecated -public class FuzzyBlockMask extends AbstractMask { - - private final Set filter; - - /** - * Create a new fuzzy block mask. - * - * @param filter a list of block types to match - */ - public FuzzyBlockMask(Set filter) { - this.filter = filter; - } - - /** - * Create a new fuzzy block mask. - * - * @param block a list of block types to match - */ - public FuzzyBlockMask(BaseBlock... block) { - Set filter = new HashSet(); - Collections.addAll(filter, block); - this.filter = filter; - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - BaseBlock compare = new BaseBlock(editSession.getBlockType(position), editSession.getBlockData(position)); - return Blocks.containsFuzzy(filter, compare); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedBlockTypeMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedBlockTypeMask.java deleted file mode 100644 index 61ae5a9a5..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedBlockTypeMask.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; - -import java.util.Set; - -/** - * A block type mask that only matches blocks that are not in the list. - */ -@Deprecated -public class InvertedBlockTypeMask extends BlockTypeMask { - - public InvertedBlockTypeMask() { - } - - public InvertedBlockTypeMask(Set types) { - super(types); - } - - public InvertedBlockTypeMask(int type) { - super(type); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return !super.matches(editSession, position); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedMask.java deleted file mode 100644 index d86ac89b3..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedMask.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.function.mask.Masks; - -/** - * @deprecated See {@link Masks#negate(com.sk89q.worldedit.function.mask.Mask)} - */ -@Deprecated -public class InvertedMask extends AbstractMask { - private final Mask mask; - - public InvertedMask(Mask mask) { - this.mask = mask; - } - - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - mask.prepare(session, player, target); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return !mask.matches(editSession, position); - } - - public Mask getInvertedMask() { - return mask; - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/Mask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/Mask.java deleted file mode 100644 index cf0a04c89..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/Mask.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; - -/** - * @deprecated Use {@link com.sk89q.worldedit.function.mask.Mask} - */ -@Deprecated -public interface Mask { - - /** - * Called one time before each edit session. - * - * @param session a session - * @param player a player - * @param target target of the brush, null if not a brush mask - */ - void prepare(LocalSession session, LocalPlayer player, Vector target); - - /** - * Given a block position, this method returns true if the block at - * that position matches the filter. Block information is not provided - * as getting a BaseBlock has unneeded overhead in most block querying - * situations (enumerating a chest's contents is a waste, for example). - * - * @param editSession an instance - * @param position the position to check - * @return true if it matches - */ - boolean matches(EditSession editSession, Vector position); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RandomMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RandomMask.java deleted file mode 100644 index a9e657ca6..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RandomMask.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.function.mask.NoiseFilter; - -/** - * @deprecated See {@link NoiseFilter} - */ -@Deprecated -public class RandomMask extends AbstractMask { - private final double ratio; - - public RandomMask(double ratio) { - this.ratio = ratio; - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return Math.random() < ratio; - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RegionMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RegionMask.java deleted file mode 100644 index 220aaf4b9..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RegionMask.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.regions.Region; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.RegionMask} - */ -@Deprecated -public class RegionMask extends AbstractMask { - private final Region region; - - public RegionMask(Region region) { - this.region = region.clone(); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return region.contains(position); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/SolidBlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/SolidBlockMask.java deleted file mode 100644 index dd5403441..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/SolidBlockMask.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockType; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.SolidBlockMask} - */ -@Deprecated -public class SolidBlockMask extends AbstractMask { - @Override - public boolean matches(EditSession editSession, Vector position) { - return !BlockType.canPassThrough(editSession.getBlockType(position), editSession.getBlockData(position)); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/UnderOverlayMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/UnderOverlayMask.java deleted file mode 100644 index 39fe3dc8e..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/UnderOverlayMask.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.function.mask.MaskIntersection; -import com.sk89q.worldedit.function.mask.Masks; -import com.sk89q.worldedit.function.mask.OffsetMask; - -import java.util.Set; - -/** - * @deprecated Use {@link OffsetMask} with {@link MaskIntersection} and {@link Masks#negate(com.sk89q.worldedit.function.mask.Mask)} - */ -@Deprecated -public class UnderOverlayMask extends AbstractMask { - private final int yMod; - private Mask mask; - - @Deprecated - public UnderOverlayMask(Set ids, boolean overlay) { - this(new BlockTypeMask(ids), overlay); - } - - public UnderOverlayMask(Mask mask, boolean overlay) { - this.yMod = overlay ? -1 : 1; - this.mask = mask; - } - - @Deprecated - public void addAll(Set ids) { - if (mask instanceof BlockMask) { - final BlockMask blockTypeMask = (BlockMask) mask; - for (Integer id : ids) { - blockTypeMask.add(new BaseBlock(id)); - } - } else if (mask instanceof ExistingBlockMask) { - final BlockMask blockMask = new BlockMask(); - for (int type : ids) { - blockMask.add(new BaseBlock(type)); - } - mask = blockMask; - } - } - - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - mask.prepare(session, player, target); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return !mask.matches(editSession, position) && mask.matches(editSession, position.add(0, yMod, 0)); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/BlockChance.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/BlockChance.java deleted file mode 100644 index 35c45a132..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/BlockChance.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.patterns; - -import com.sk89q.worldedit.blocks.BaseBlock; - -/** - * @deprecated Will be removed in the future -- there is no replacement - */ -@Deprecated -public class BlockChance { - - private BaseBlock block; - private double chance; - - /** - * Construct the object. - * - * @param block the block - * @param chance the probability of the block - */ - public BlockChance(BaseBlock block, double chance) { - this.block = block; - this.chance = chance; - } - - /** - * @return the block - */ - public BaseBlock getBlock() { - return block; - } - - /** - * @return the chance - */ - public double getChance() { - return chance; - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/ClipboardPattern.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/ClipboardPattern.java deleted file mode 100644 index 8808a0684..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/ClipboardPattern.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.patterns; - -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; - -/** - * Pattern that repeats the clipboard. - */ -public class ClipboardPattern implements Pattern { - - private CuboidClipboard clipboard; - private Vector size; - - /** - * Construct the object. - * - * @param clipboard the clipboard - */ - public ClipboardPattern(CuboidClipboard clipboard) { - this.clipboard = clipboard; - this.size = clipboard.getSize(); - } - - @Override - public BaseBlock next(Vector position) { - return next(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - } - - @Override - public BaseBlock next(int x, int y, int z) { - int xp = Math.abs(x) % size.getBlockX(); - int yp = Math.abs(y) % size.getBlockY(); - int zp = Math.abs(z) % size.getBlockZ(); - - return clipboard.getPoint(new Vector(xp, yp, zp)); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/Pattern.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/Pattern.java deleted file mode 100644 index b27e8e0fc..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/Pattern.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.patterns; - -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.pattern.Pattern} - */ -@Deprecated -public interface Pattern { - - /** - * Get a block for a position. This return value of this method does - * not have to be consistent for the same position. - * - * @param position the position where a block is needed - * @return a block - */ - public BaseBlock next(Vector position); - - /** - * Get a block for a position. This return value of this method does - * not have to be consistent for the same position. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - * @return a block - */ - public BaseBlock next(int x, int y, int z); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/RandomFillPattern.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/RandomFillPattern.java deleted file mode 100644 index 6014eec36..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/RandomFillPattern.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.patterns; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.function.pattern.RandomPattern; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -/** - * @deprecated See {@link RandomPattern} - */ -@Deprecated -public class RandomFillPattern implements Pattern { - - private static final Random random = new Random(); - private List blocks; - - /** - * Construct the object. - * - * @param blocks a list of blocks - */ - public RandomFillPattern(List blocks) { - double max = 0; - - for (BlockChance block : blocks) { - max += block.getChance(); - } - - List finalBlocks = new ArrayList(); - - double i = 0; - - for (BlockChance block : blocks) { - double v = block.getChance() / max; - i += v; - finalBlocks.add(new BlockChance(block.getBlock(), i)); - } - - this.blocks = finalBlocks; - } - - @Override - public BaseBlock next(Vector position) { - double r = random.nextDouble(); - - for (BlockChance block : blocks) { - if (r <= block.getChance()) { - return block.getBlock(); - } - } - - throw new RuntimeException("ProportionalFillPattern"); - } - - @Override - public BaseBlock next(int x, int y, int z) { - return next(null); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java deleted file mode 100644 index 325b85112..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.patterns; - -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.function.pattern.BlockPattern; - -/** - * @deprecated See {@link BlockPattern} - */ -@Deprecated -public class SingleBlockPattern implements Pattern { - - private BaseBlock block; - - /** - * Construct the object. - * - * @param block the block - */ - public SingleBlockPattern(BaseBlock block) { - this.block = block; - } - - /** - * Get the block. - * - * @return the block - */ - public BaseBlock getBlock() { - return block; - } - - @Override - public BaseBlock next(Vector position) { - return block; - } - - @Override - public BaseBlock next(int x, int y, int z) { - return block; - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/AbstractLegacyRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/AbstractLegacyRegionSelector.java deleted file mode 100644 index 1930e3b9f..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/AbstractLegacyRegionSelector.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.extension.platform.Actor; - -abstract class AbstractLegacyRegionSelector implements RegionSelector { - - @Deprecated - public final void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) { - explainPrimarySelection((Actor) player, session, position); - } - - @Deprecated - public final void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) { - explainSecondarySelection((Actor) player, session, position); - } - - @Deprecated - public final void explainRegionAdjust(LocalPlayer player, LocalSession session) { - explainRegionAdjust((Actor) player, session); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegionSelector.java deleted file mode 100644 index f264546dd..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class ConvexPolyhedralRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CuboidRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CuboidRegionSelector.java deleted file mode 100644 index 458d75cb3..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CuboidRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class CuboidRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java deleted file mode 100644 index b54709e7d..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class CylinderRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java deleted file mode 100644 index 69bf5ba2b..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class EllipsoidRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ExtendingCuboidRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ExtendingCuboidRegionSelector.java deleted file mode 100644 index d9888a447..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ExtendingCuboidRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class ExtendingCuboidRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java deleted file mode 100644 index f3b8a9cbd..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class Polygonal2DRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { - - /** - * Get the number of points. - * - * @return the number of points - */ - public abstract int getPointCount(); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/SphereRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/SphereRegionSelector.java deleted file mode 100644 index 8a3057dc0..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/SphereRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class SphereRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 3a3376e81..8d91548fc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.event.extent.EditSessionEvent; @@ -49,7 +50,7 @@ import com.sk89q.worldedit.function.generator.GardenPatchGenerator; import com.sk89q.worldedit.function.mask.*; import com.sk89q.worldedit.function.operation.*; import com.sk89q.worldedit.function.pattern.BlockPattern; -import com.sk89q.worldedit.function.pattern.Patterns; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.util.RegionOffset; import com.sk89q.worldedit.function.visitor.*; import com.sk89q.worldedit.history.UndoContext; @@ -65,8 +66,6 @@ import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation; import com.sk89q.worldedit.math.interpolation.Node; import com.sk89q.worldedit.math.noise.RandomNoise; import com.sk89q.worldedit.math.transform.AffineTransform; -import com.sk89q.worldedit.patterns.Pattern; -import com.sk89q.worldedit.patterns.SingleBlockPattern; import com.sk89q.worldedit.regions.*; import com.sk89q.worldedit.regions.shape.ArbitraryBiomeShape; import com.sk89q.worldedit.regions.shape.ArbitraryShape; @@ -96,7 +95,7 @@ import static com.sk89q.worldedit.regions.Regions.*; * {@link Extent}s that are chained together. For example, history is logged * using the {@link ChangeSetExtent}.

*/ -@SuppressWarnings({"FieldCanBeLocal", "deprecation"}) +@SuppressWarnings({"FieldCanBeLocal"}) public class EditSession implements Extent { private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName()); @@ -131,7 +130,6 @@ public class EditSession implements Extent { private final Extent bypassHistory; private final Extent bypassNone; - @SuppressWarnings("deprecation") private Mask oldMask; /** @@ -141,7 +139,6 @@ public class EditSession implements Extent { * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit * @deprecated use {@link WorldEdit#getEditSessionFactory()} to create {@link EditSession}s */ - @SuppressWarnings("deprecation") @Deprecated public EditSession(LocalWorld world, int maxBlocks) { this(world, maxBlocks, null); @@ -308,21 +305,6 @@ public class EditSession implements Extent { } } - /** - * Set the mask. - * - * @param mask the mask - * @deprecated Use {@link #setMask(Mask)} - */ - @Deprecated - public void setMask(com.sk89q.worldedit.masks.Mask mask) { - if (mask == null) { - setMask((Mask) null); - } else { - setMask(Masks.wrap(mask)); - } - } - /** * Get the {@link SurvivalModeExtent}. * @@ -560,9 +542,8 @@ public class EditSession implements Extent { * @return Whether the block changed -- not entirely dependable * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public boolean setBlock(Vector position, Pattern pattern) throws MaxChangedBlocksException { - return setBlock(position, pattern.next(position)); + return setBlock(position, pattern.apply(position)); } /** @@ -574,7 +555,6 @@ public class EditSession implements Extent { * @return the number of changed blocks * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") private int setBlocks(Set vset, Pattern pattern) throws MaxChangedBlocksException { int affected = 0; for (Vector v : vset) { @@ -593,7 +573,6 @@ public class EditSession implements Extent { * @return whether a block was changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public boolean setChanceBlockIfAir(Vector position, BaseBlock block, double probability) throws MaxChangedBlocksException { return Math.random() <= probability && setBlockIfAir(position, block); @@ -705,7 +684,7 @@ public class EditSession implements Extent { * @return the number of found blocks */ public int countBlock(Region region, Set searchIDs) { - Set passOn = new HashSet(); + Set passOn = new HashSet<>(); for (Integer i : searchIDs) { passOn.add(new BaseBlock(i, -1)); } @@ -739,10 +718,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") - public int fillXZ(Vector origin, BaseBlock block, double radius, int depth, boolean recursive) - throws MaxChangedBlocksException { - return fillXZ(origin, new SingleBlockPattern(block), radius, depth, recursive); + public int fillXZ(Vector origin, BaseBlock block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { + return fillXZ(origin, new BlockPattern(block), radius, depth, recursive); } /** @@ -756,7 +733,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int fillXZ(Vector origin, Pattern pattern, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { checkNotNull(origin); checkNotNull(pattern); @@ -771,7 +747,7 @@ public class EditSession implements Extent { Masks.negate(new ExistingBlockMask(this))); // Want to replace blocks - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); // Pick how we're going to visit blocks RecursiveVisitor visitor; @@ -799,7 +775,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int removeAbove(Vector position, int apothem, int height) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); @@ -809,7 +784,7 @@ public class EditSession implements Extent { getWorld(), // Causes clamping of Y range position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, height - 1, apothem - 1)); - Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); + Pattern pattern = new BlockPattern(new BaseBlock(BlockTypes.AIR)); return setBlocks(region, pattern); } @@ -822,7 +797,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int removeBelow(Vector position, int apothem, int height) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); @@ -832,7 +806,7 @@ public class EditSession implements Extent { getWorld(), // Causes clamping of Y range position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, -height + 1, apothem - 1)); - Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); + Pattern pattern = new BlockPattern(new BaseBlock(BlockTypes.AIR)); return setBlocks(region, pattern); } @@ -845,7 +819,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int removeNear(Vector position, int blockType, int apothem) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); @@ -856,7 +829,7 @@ public class EditSession implements Extent { getWorld(), // Causes clamping of Y range position.add(adjustment.multiply(-1)), position.add(adjustment)); - Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); + Pattern pattern = new BlockPattern(new BaseBlock(BlockTypes.AIR)); return replaceBlocks(region, mask, pattern); } @@ -868,9 +841,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int setBlocks(Region region, BaseBlock block) throws MaxChangedBlocksException { - return setBlocks(region, new SingleBlockPattern(block)); + return setBlocks(region, new BlockPattern(block)); } /** @@ -881,12 +853,11 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); RegionVisitor visitor = new RegionVisitor(region, replace); Operations.completeLegacy(visitor); return visitor.getAffected(); @@ -897,14 +868,13 @@ public class EditSession implements Extent { * returned by a given pattern. * * @param region the region to replace the blocks within - * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.masks.ExistingBlockMask} + * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.function.mask.ExistingBlockMask} * @param replacement the replacement block * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int replaceBlocks(Region region, Set filter, BaseBlock replacement) throws MaxChangedBlocksException { - return replaceBlocks(region, filter, new SingleBlockPattern(replacement)); + return replaceBlocks(region, filter, new BlockPattern(replacement)); } /** @@ -912,12 +882,11 @@ public class EditSession implements Extent { * returned by a given pattern. * * @param region the region to replace the blocks within - * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.masks.ExistingBlockMask} + * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.function.mask.ExistingBlockMask} * @param pattern the pattern that provides the new blocks * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int replaceBlocks(Region region, Set filter, Pattern pattern) throws MaxChangedBlocksException { Mask mask = filter == null ? new ExistingBlockMask(this) : new FuzzyBlockMask(this, filter); return replaceBlocks(region, mask, pattern); @@ -933,13 +902,12 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(mask); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); RegionMaskingFilter filter = new RegionMaskingFilter(mask, replace); RegionVisitor visitor = new RegionVisitor(region, filter); Operations.completeLegacy(visitor); @@ -956,7 +924,6 @@ public class EditSession implements Extent { * @return the number of blocks placed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int center(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -978,9 +945,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidFaces(Region region, BaseBlock block) throws MaxChangedBlocksException { - return makeCuboidFaces(region, new SingleBlockPattern(block)); + return makeCuboidFaces(region, new BlockPattern(block)); } /** @@ -991,7 +957,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidFaces(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1011,7 +976,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeFaces(final Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1033,9 +997,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidWalls(Region region, BaseBlock block) throws MaxChangedBlocksException { - return makeCuboidWalls(region, new SingleBlockPattern(block)); + return makeCuboidWalls(region, new BlockPattern(block)); } /** @@ -1047,7 +1010,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidWalls(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1067,7 +1029,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeWalls(final Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1101,11 +1062,10 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int overlayCuboidBlocks(Region region, BaseBlock block) throws MaxChangedBlocksException { checkNotNull(block); - return overlayCuboidBlocks(region, new SingleBlockPattern(block)); + return overlayCuboidBlocks(region, new BlockPattern(block)); } /** @@ -1117,12 +1077,11 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int overlayCuboidBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); RegionOffset offset = new RegionOffset(new Vector(0, 1, 0), replace); GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), offset); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); @@ -1835,8 +1794,8 @@ public class EditSession implements Extent { * @return the results */ public List> getBlockDistribution(Region region) { - List> distribution = new ArrayList>(); - Map> map = new HashMap>(); + List> distribution = new ArrayList<>(); + Map> map = new HashMap<>(); if (region instanceof CuboidRegion) { // Doing this for speed @@ -1860,7 +1819,7 @@ public class EditSession implements Extent { if (map.containsKey(id)) { map.get(id).increment(); } else { - Countable c = new Countable(id, 1); + Countable c = new Countable<>(id, 1); map.put(id, c); distribution.add(c); } @@ -1874,7 +1833,7 @@ public class EditSession implements Extent { if (map.containsKey(id)) { map.get(id).increment(); } else { - Countable c = new Countable(id, 1); + Countable c = new Countable<>(id, 1); map.put(id, c); } } @@ -1894,8 +1853,8 @@ public class EditSession implements Extent { */ // TODO reduce code duplication - probably during ops-redux public List> getBlockDistributionWithData(Region region) { - List> distribution = new ArrayList>(); - Map> map = new HashMap>(); + List> distribution = new ArrayList<>(); + Map> map = new HashMap<>(); if (region instanceof CuboidRegion) { // Doing this for speed @@ -1919,7 +1878,7 @@ public class EditSession implements Extent { if (map.containsKey(blk)) { map.get(blk).increment(); } else { - Countable c = new Countable(blk, 1); + Countable c = new Countable<>(blk, 1); map.put(blk, c); distribution.add(c); } @@ -1933,7 +1892,7 @@ public class EditSession implements Extent { if (map.containsKey(blk)) { map.get(blk).increment(); } else { - Countable c = new Countable(blk, 1); + Countable c = new Countable<>(blk, 1); map.put(blk, c); } } @@ -1989,7 +1948,7 @@ public class EditSession implements Extent { final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero); expression.setEnvironment(environment); - final DoubleArrayList queue = new DoubleArrayList(false); + final DoubleArrayList queue = new DoubleArrayList<>(false); for (BlockVector position : region) { // offset, scale @@ -2035,7 +1994,7 @@ public class EditSession implements Extent { public int hollowOutRegion(Region region, int thickness, Pattern pattern) throws MaxChangedBlocksException { int affected = 0; - final Set outside = new HashSet(); + final Set outside = new HashSet<>(); final Vector min = region.getMinimumPoint(); final Vector max = region.getMaximumPoint(); @@ -2069,7 +2028,7 @@ public class EditSession implements Extent { } for (int i = 1; i < thickness; ++i) { - final Set newOutside = new HashSet(); + final Set newOutside = new HashSet<>(); outer: for (BlockVector position : region) { for (Vector recurseDirection: recurseDirections) { BlockVector neighbor = position.add(recurseDirection).toBlockVector(); @@ -2093,7 +2052,7 @@ public class EditSession implements Extent { } } - if (setBlock(position, pattern.next(position))) { + if (setBlock(position, pattern.apply(position))) { ++affected; } } @@ -2116,7 +2075,7 @@ public class EditSession implements Extent { public int drawLine(Pattern pattern, Vector pos1, Vector pos2, double radius, boolean filled) throws MaxChangedBlocksException { - Set vset = new HashSet(); + Set vset = new HashSet<>(); boolean notdrawn = true; int x1 = pos1.getBlockX(), y1 = pos1.getBlockY(), z1 = pos1.getBlockZ(); @@ -2187,8 +2146,8 @@ public class EditSession implements Extent { public int drawSpline(Pattern pattern, List nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) throws MaxChangedBlocksException { - Set vset = new HashSet(); - List nodes = new ArrayList(nodevectors.size()); + Set vset = new HashSet<>(); + List nodes = new ArrayList<>(nodevectors.size()); Interpolation interpol = new KochanekBartelsInterpolation(); @@ -2227,7 +2186,7 @@ public class EditSession implements Extent { } private static Set getBallooned(Set vset, double radius) { - Set returnset = new HashSet(); + Set returnset = new HashSet<>(); int ceilrad = (int) Math.ceil(radius); for (Vector v : vset) { @@ -2247,7 +2206,7 @@ public class EditSession implements Extent { } private static Set getHollowed(Set vset) { - Set returnset = new HashSet(); + Set returnset = new HashSet<>(); for (Vector v : vset) { double x = v.getX(), y = v.getY(), z = v.getZ(); if (!(vset.contains(new Vector(x + 1, y, z)) && @@ -2263,7 +2222,7 @@ public class EditSession implements Extent { } private void recurseHollow(Region region, BlockVector origin, Set outside) { - final LinkedList queue = new LinkedList(); + final LinkedList queue = new LinkedList<>(); queue.addLast(origin); while (!queue.isEmpty()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 9c04626ae..d59811fb7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -917,14 +917,4 @@ public class LocalSession { this.mask = mask; } - /** - * Set a mask. - * - * @param mask mask or null - */ - @SuppressWarnings("deprecation") - public void setMask(com.sk89q.worldedit.masks.Mask mask) { - setMask(mask != null ? Masks.wrap(mask) : null); - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 07d00ced6..6a665127e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -37,10 +37,6 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.PlatformManager; import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.function.mask.Masks; -import com.sk89q.worldedit.function.pattern.Patterns; -import com.sk89q.worldedit.masks.Mask; -import com.sk89q.worldedit.patterns.Pattern; import com.sk89q.worldedit.scripting.CraftScriptContext; import com.sk89q.worldedit.scripting.CraftScriptEngine; import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; @@ -313,32 +309,6 @@ public class WorldEdit { return blocks; } - /** - * @deprecated Use {@link #getPatternFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Pattern getBlockPattern(Player player, String input) throws WorldEditException { - ParserContext context = new ParserContext(); - context.setActor(player); - context.setWorld(player.getWorld()); - context.setSession(getSession(player)); - return Patterns.wrap(getPatternFactory().parseFromInput(input, context)); - } - - /** - * @deprecated Use {@link #getMaskFactory()} ()} and {@link MaskFactory#parseFromInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Mask getBlockMask(Player player, LocalSession session, String input) throws WorldEditException { - ParserContext context = new ParserContext(); - context.setActor(player); - context.setWorld(player.getWorld()); - context.setSession(session); - return Masks.wrap(getMaskFactory().parseFromInput(input, context)); - } - /** * Gets the path to a file. This method will check to see if the filename * has valid characters and has an extension. It also prevents directory diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector.java index c45b53ef8..db9407b26 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector.java @@ -25,7 +25,6 @@ import com.sk89q.worldedit.world.World; /** * @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible */ -@SuppressWarnings("deprecation") @Deprecated public class WorldVector extends Vector { @@ -127,7 +126,7 @@ public class WorldVector extends Vector { /** * Gets a BlockVector version. - * + * * @return BlockWorldVector */ public BlockWorldVector toWorldBlockVector() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVectorFace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVectorFace.java index 306b2ea34..9bd1b3a27 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVectorFace.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVectorFace.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit; /** * @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible */ -@SuppressWarnings("deprecation") @Deprecated public class WorldVectorFace extends WorldVector { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java index 4e5cd07f8..2846de359 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java @@ -25,7 +25,6 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.CuboidClipboard.FlipDirection; import com.sk89q.worldedit.blocks.type.BlockType; import com.sk89q.worldedit.blocks.type.BlockTypes; -import com.sk89q.worldedit.foundation.Block; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.world.registry.BundledBlockData; import com.sk89q.worldedit.world.registry.state.State; @@ -54,8 +53,7 @@ import javax.annotation.Nullable; * as a "wildcard" block value, even though a {@link Mask} would be * more appropriate.

*/ -@SuppressWarnings("deprecation") -public class BaseBlock extends Block implements TileEntityBlock { +public class BaseBlock implements TileEntityBlock { // Instances of this class should be _as small as possible_ because there will // be millions of instances of this object. @@ -158,7 +156,6 @@ public class BaseBlock extends Block implements TileEntityBlock { * * @return legacy numerical ID */ - @Override @Deprecated public int getId() { return this.blockType.getLegacyId(); @@ -182,7 +179,6 @@ public class BaseBlock extends Block implements TileEntityBlock { * * @param id block id */ - @Override @Deprecated public void setId(int id) { internalSetId(id); @@ -210,7 +206,6 @@ public class BaseBlock extends Block implements TileEntityBlock { * * @return data value (0-15) */ - @Override @Deprecated public int getData() { return 0; @@ -268,7 +263,6 @@ public class BaseBlock extends Block implements TileEntityBlock { * * @param data block data value */ - @Override @Deprecated public void setData(int data) { internalSetData(data); @@ -282,7 +276,6 @@ public class BaseBlock extends Block implements TileEntityBlock { * @see #setId(int) * @see #setData(int) */ - @Override @Deprecated public void setIdAndData(int id, int data) { setId(id); @@ -294,7 +287,6 @@ public class BaseBlock extends Block implements TileEntityBlock { * * @return true if there are no matched states */ - @Override public boolean hasWildcardData() { return getStates().isEmpty(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index edda882a8..5c1e47150 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -29,7 +29,6 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.regions.Region; @@ -117,7 +116,7 @@ public class GenerationCommands { worldEdit.checkMaxRadius(height); Vector pos = session.getPlacementPosition(player); - int affected = editSession.makeCylinder(pos, Patterns.wrap(pattern), radiusX, radiusZ, height, !hollow); + int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow); player.print(affected + " block(s) have been created."); } @@ -182,7 +181,7 @@ public class GenerationCommands { pos = pos.add(0, radiusY, 0); } - int affected = editSession.makeSphere(pos, Patterns.wrap(pattern), radiusX, radiusY, radiusZ, !hollow); + int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow); player.findFreePosition(); player.print(affected + " block(s) have been created."); } @@ -243,7 +242,7 @@ public class GenerationCommands { public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException { Vector pos = session.getPlacementPosition(player); worldEdit.checkMaxRadius(size); - int affected = editSession.makePyramid(pos, Patterns.wrap(pattern), size, !hollow); + int affected = editSession.makePyramid(pos, pattern, size, !hollow); player.findFreePosition(); player.print(affected + " block(s) have been created."); } @@ -306,7 +305,7 @@ public class GenerationCommands { } try { - final int affected = editSession.makeShape(region, zero, unit, Patterns.wrap(pattern), expression, hollow); + final int affected = editSession.makeShape(region, zero, unit, pattern, expression, hollow); player.findFreePosition(); player.print(affected + " block(s) have been created."); } catch (ExpressionException e) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index 174fe08de..8751c3453 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -33,7 +33,6 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.NoiseFilter2D; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; import com.sk89q.worldedit.function.visitor.LayerVisitor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.Selection; @@ -106,7 +105,7 @@ public class RegionCommands { CuboidRegion cuboidregion = (CuboidRegion) region; Vector pos1 = cuboidregion.getPos1(); Vector pos2 = cuboidregion.getPos2(); - int blocksChanged = editSession.drawLine(Patterns.wrap(pattern), pos1, pos2, thickness, !shell); + int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell); player.print(blocksChanged + " block(s) have been changed."); } @@ -137,9 +136,9 @@ public class RegionCommands { } ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region; - List vectors = new ArrayList(cpregion.getVertices()); + List vectors = new ArrayList<>(cpregion.getVertices()); - int blocksChanged = editSession.drawSpline(Patterns.wrap(pattern), vectors, 0, 0, 0, 10, thickness, !shell); + int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); player.print(blocksChanged + " block(s) have been changed."); } @@ -158,7 +157,7 @@ public class RegionCommands { if (from == null) { from = new ExistingBlockMask(editSession); } - int affected = editSession.replaceBlocks(region, from, Patterns.wrap(to)); + int affected = editSession.replaceBlocks(region, from, to); player.print(affected + " block(s) have been replaced."); } @@ -172,7 +171,7 @@ public class RegionCommands { @CommandPermissions("worldedit.region.overlay") @Logging(REGION) public void overlay(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.overlayCuboidBlocks(region, Patterns.wrap(pattern)); + int affected = editSession.overlayCuboidBlocks(region, pattern); player.print(affected + " block(s) have been overlaid."); } @@ -186,7 +185,7 @@ public class RegionCommands { @Logging(REGION) @CommandPermissions("worldedit.region.center") public void center(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.center(region, Patterns.wrap(pattern)); + int affected = editSession.center(region, pattern); player.print("Center set ("+ affected + " blocks changed)"); } @@ -214,7 +213,7 @@ public class RegionCommands { @CommandPermissions("worldedit.region.walls") @Logging(REGION) public void walls(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.makeCuboidWalls(region, Patterns.wrap(pattern)); + int affected = editSession.makeCuboidWalls(region, pattern); player.print(affected + " block(s) have been changed."); } @@ -228,7 +227,7 @@ public class RegionCommands { @CommandPermissions("worldedit.region.faces") @Logging(REGION) public void faces(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.makeCuboidFaces(region, Patterns.wrap(pattern)); + int affected = editSession.makeCuboidFaces(region, pattern); player.print(affected + " block(s) have been changed."); } @@ -422,7 +421,7 @@ public class RegionCommands { @Optional("0") @Range(min = 0) int thickness, @Optional("air") Pattern pattern) throws WorldEditException { - int affected = editSession.hollowOutRegion(region, thickness, Patterns.wrap(pattern)); + int affected = editSession.hollowOutRegion(region, thickness, pattern); player.print(affected + " block(s) have been changed."); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java index 46f0cde96..0e4734ecf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java @@ -26,8 +26,9 @@ import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.ItemType; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.command.tool.*; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.TreeGenerator; public class ToolCommands { @@ -139,7 +140,12 @@ public class ToolCommands { return; } - Pattern pattern = we.getBlockPattern(player, args.getString(0)); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); + session.setTool(player.getItemInHand(), new FloodFillTool(range, pattern)); player.print("Block flood fill tool bound to " + ItemType.toHeldName(player.getItemInHand()) + "."); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index 74d1bb88c..5da53420c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -36,17 +36,18 @@ import com.sk89q.worldedit.command.util.CreatureButcher; import com.sk89q.worldedit.command.util.EntityRemover; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.CommandManager; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.operation.Operations; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.visitor.EntityVisitor; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; -import com.sk89q.worldedit.patterns.Pattern; -import com.sk89q.worldedit.patterns.SingleBlockPattern; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CylinderRegion; import com.sk89q.worldedit.regions.Region; @@ -92,17 +93,20 @@ public class UtilityCommands { @Logging(PLACEMENT) public void fill(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Pattern pattern = we.getBlockPattern(player, args.getString(0)); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); + double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1; Vector pos = session.getPlacementPosition(player); - int affected = 0; - if (pattern instanceof SingleBlockPattern) { - affected = editSession.fillXZ(pos, - ((SingleBlockPattern) pattern).getBlock(), - radius, depth, false); + int affected; + if (pattern instanceof BlockPattern) { + affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, false); } else { affected = editSession.fillXZ(pos, pattern, radius, depth, false); } @@ -120,17 +124,20 @@ public class UtilityCommands { @Logging(PLACEMENT) public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Pattern pattern = we.getBlockPattern(player, args.getString(0)); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); + double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE; Vector pos = session.getPlacementPosition(player); int affected = 0; - if (pattern instanceof SingleBlockPattern) { - affected = editSession.fillXZ(pos, - ((SingleBlockPattern) pattern).getBlock(), - radius, depth, true); + if (pattern instanceof BlockPattern) { + affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true); } else { affected = editSession.fillXZ(pos, pattern, radius, depth, true); } @@ -267,12 +274,20 @@ public class UtilityCommands { int affected; Set from; Pattern to; + + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(false); + context.setPreferringWildcard(!args.hasFlag('f')); + if (args.argsLength() == 2) { from = null; - to = we.getBlockPattern(player, args.getString(1)); + to = we.getPatternFactory().parseFromInput(args.getString(1), context); } else { - from = we.getBlocks(player, args.getString(1), true, !args.hasFlag('f')); - to = we.getBlockPattern(player, args.getString(2)); + from = we.getBlockFactory().parseFromListInput(args.getString(1), context); + to = we.getPatternFactory().parseFromInput(args.getString(2), context); } Vector base = session.getPlacementPosition(player); @@ -280,8 +295,8 @@ public class UtilityCommands { Vector max = base.add(size, size, size); Region region = new CuboidRegion(player.getWorld(), min, max); - if (to instanceof SingleBlockPattern) { - affected = editSession.replaceBlocks(region, from, ((SingleBlockPattern) to).getBlock()); + if (to instanceof BlockPattern) { + affected = editSession.replaceBlocks(region, from, ((BlockPattern) to).getBlock()); } else { affected = editSession.replaceBlocks(region, from, to); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java index 592f13814..1db0ac5e5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java @@ -24,7 +24,7 @@ import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; @@ -87,7 +87,7 @@ public class FloodFillTool implements BlockTool { visited.add(pos); if (editSession.getBlock(pos).getType().getLegacyId() == initialType) { - editSession.setBlock(pos, pattern.next(pos)); + editSession.setBlock(pos, pattern.apply(pos)); } else { return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java index ca4d4c145..6f1eb3540 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java @@ -23,11 +23,9 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; public class CylinderBrush implements Brush { @@ -42,7 +40,7 @@ public class CylinderBrush implements Brush { if (pattern == null) { pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } - editSession.makeCylinder(position, Patterns.wrap(pattern), size, size, height, true); + editSession.makeCylinder(position, pattern, size, size, height, true); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java index 0fe74aa47..4c032eb28 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java @@ -23,11 +23,9 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; public class HollowCylinderBrush implements Brush { @@ -42,7 +40,7 @@ public class HollowCylinderBrush implements Brush { if (pattern == null) { pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } - editSession.makeCylinder(position, Patterns.wrap(pattern), size, size, height, false); + editSession.makeCylinder(position, pattern, size, size, height, false); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java index b28dc08a5..d3ed19ff8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java @@ -23,11 +23,9 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; public class HollowSphereBrush implements Brush { @@ -36,6 +34,6 @@ public class HollowSphereBrush implements Brush { if (pattern == null) { pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } - editSession.makeSphere(position, Patterns.wrap(pattern), size, size, size, false); + editSession.makeSphere(position, pattern, size, size, size, false); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java index 23a3eddb3..988c0c5bd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java @@ -23,11 +23,9 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; public class SphereBrush implements Brush { @@ -36,6 +34,6 @@ public class SphereBrush implements Brush { if (pattern == null) { pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } - editSession.makeSphere(position, Patterns.wrap(pattern), size, size, size, true); + editSession.makeSphere(position, pattern, size, size, size, true); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java index 4b0f1c802..6b9967250 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java @@ -19,14 +19,15 @@ package com.sk89q.worldedit.function.block; +import com.google.common.collect.Sets; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.LayerFunction; -import com.sk89q.worldedit.masks.BlockMask; -import com.sk89q.worldedit.masks.Mask; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.Mask; import static com.google.common.base.Preconditions.checkNotNull; @@ -37,11 +38,12 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class Naturalizer implements LayerFunction { + private static final BaseBlock grass = new BaseBlock(BlockTypes.GRASS_BLOCK); + private static final BaseBlock dirt = new BaseBlock(BlockTypes.DIRT); + private static final BaseBlock stone = new BaseBlock(BlockTypes.STONE); + private final EditSession editSession; - private final BaseBlock grass = new BaseBlock(BlockTypes.GRASS_BLOCK); - private final BaseBlock dirt = new BaseBlock(BlockTypes.DIRT); - private final BaseBlock stone = new BaseBlock(BlockTypes.STONE); - private final Mask mask = new BlockMask(grass, dirt, stone); + private final Mask mask; private int affected = 0; /** @@ -52,6 +54,7 @@ public class Naturalizer implements LayerFunction { public Naturalizer(EditSession editSession) { checkNotNull(editSession); this.editSession = editSession; + this.mask = new BlockMask(editSession, Sets.newHashSet(grass, dirt, stone)); } /** @@ -65,12 +68,12 @@ public class Naturalizer implements LayerFunction { @Override public boolean isGround(Vector position) { - return mask.matches(editSession, position); + return mask.test(position); } @Override public boolean apply(Vector position, int depth) throws WorldEditException { - if (mask.matches(editSession, position)) { + if (mask.test(position)) { affected++; switch (depth) { case 0: diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java index b6e94adc2..7c0a8f53f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java @@ -131,82 +131,6 @@ public final class Masks { }; } - /** - * Wrap an old-style mask and convert it to a new mask. - * - *

Note, however, that this is strongly not recommended because - * {@link com.sk89q.worldedit.masks.Mask#prepare(LocalSession, LocalPlayer, Vector)} - * is not called.

- * - * @param mask the old-style mask - * @param editSession the edit session to bind to - * @return a new-style mask - * @deprecated Please avoid if possible - */ - @Deprecated - @SuppressWarnings("deprecation") - public static Mask wrap(final com.sk89q.worldedit.masks.Mask mask, final EditSession editSession) { - checkNotNull(mask); - return new AbstractMask() { - @Override - public boolean test(Vector vector) { - return mask.matches(editSession, vector); - } - - @Nullable - @Override - public Mask2D toMask2D() { - return null; - } - }; - } - - /** - * Wrap an old-style mask and convert it to a new mask. - * - *

As an {@link EditSession} is not provided in this case, one will be - * taken from the {@link Request}, if possible. If not possible, then the - * mask will return false.

- * - * @param mask the old-style mask - * @return a new-style mask - */ - @SuppressWarnings("deprecation") - public static Mask wrap(final com.sk89q.worldedit.masks.Mask mask) { - checkNotNull(mask); - return new AbstractMask() { - @Override - public boolean test(Vector vector) { - EditSession editSession = Request.request().getEditSession(); - return editSession != null && mask.matches(editSession, vector); - } - - @Nullable - @Override - public Mask2D toMask2D() { - return null; - } - }; - } - - /** - * Convert a new-style mask to an old-style mask. - * - * @param mask the new-style mask - * @return an old-style mask - */ - @SuppressWarnings("deprecation") - public static com.sk89q.worldedit.masks.Mask wrap(final Mask mask) { - checkNotNull(mask); - return new com.sk89q.worldedit.masks.AbstractMask() { - @Override - public boolean matches(EditSession editSession, Vector position) { - Request.request().setEditSession(editSession); - return mask.test(position); - } - }; - } - private static class AlwaysTrue implements Mask, Mask2D { @Override public boolean test(Vector vector) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java deleted file mode 100644 index 4bb67c610..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.function.pattern; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Utility methods related to {@link Pattern}s. - */ -public final class Patterns { - - private Patterns() { - } - - /** - * Wrap an old-style pattern and return a new pattern. - * - * @param pattern the pattern - * @return a new-style pattern - */ - public static Pattern wrap(final com.sk89q.worldedit.patterns.Pattern pattern) { - checkNotNull(pattern); - return new Pattern() { - @Override - public BaseBlock apply(Vector position) { - return pattern.next(position); - } - }; - } - - /** - * Wrap a new-style pattern and return an old-style pattern. - * - * @param pattern the pattern - * @return an old-style pattern - */ - public static com.sk89q.worldedit.patterns.Pattern wrap(final Pattern pattern) { - checkNotNull(pattern); - return new com.sk89q.worldedit.patterns.Pattern() { - @Override - public BaseBlock next(Vector position) { - return pattern.apply(position); - } - - @Override - public BaseBlock next(int x, int y, int z) { - return next(new Vector(x, y, z)); - } - }; - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 258be2c6f..7777517c2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -48,14 +48,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { this(null, pos1, pos2); } - /** - * @deprecated cast {@code world} to {@link World} - */ - @Deprecated - public CuboidRegion(LocalWorld world, Vector pos1, Vector pos2) { - this((World) world, pos1, pos2); - } - /** * Construct a new instance of this cuboid using two corners of the cuboid. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java index 5dc3af057..f7cac803e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java @@ -48,7 +48,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Creates a {@code ConvexPolyhedralRegion} from a user's selections. */ -public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion { +public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion { private final transient ConvexPolyhedralRegion region; private transient BlockVector pos1; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java index 4265490f1..4b2f89705 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java @@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Creates a {@code CuboidRegion} from a user's selections. */ -public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegionSelector implements RegionSelector, CUIRegion { +public class CuboidRegionSelector implements RegionSelector, CUIRegion { protected transient BlockVector position1; protected transient BlockVector position2; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java index b2d3002c2..2ff239b93 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java @@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Creates a {@code CylinderRegionSelector} from a user's selections. */ -public class CylinderRegionSelector extends com.sk89q.worldedit.regions.CylinderRegionSelector implements RegionSelector, CUIRegion { +public class CylinderRegionSelector implements RegionSelector, CUIRegion { protected static transient final NumberFormat NUMBER_FORMAT; protected transient CylinderRegion region; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java index 5f3a956d4..ce330cb6b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java @@ -39,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Creates a {@code EllipsoidRegionSelector} from a user's selections. */ -public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.EllipsoidRegionSelector implements RegionSelector, CUIRegion { +public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { protected transient EllipsoidRegion region; protected transient boolean started = false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java index c9611c05f..cb6d03974 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java @@ -41,7 +41,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Creates a {@code Polygonal2DRegion} from a user's selections. */ -public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polygonal2DRegionSelector implements RegionSelector, CUIRegion { +public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { private transient BlockVector pos1; private transient Polygonal2DRegion region; @@ -248,7 +248,6 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg * * @return the number of points */ - @Override public int getPointCount() { return region.getPoints().size(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java index e630555b6..e9da33d08 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java @@ -25,7 +25,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.type.BlockTypes; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.Region; /** @@ -92,7 +92,7 @@ public abstract class ArbitraryShape { switch (cacheEntry) { case 0: // unknown, fetch material - final BaseBlock material = getMaterial(x, y, z, pattern.next(new BlockVector(x, y, z))); + final BaseBlock material = getMaterial(x, y, z, pattern.apply(new BlockVector(x, y, z))); if (material == null) { // outside cache[index] = -1; @@ -156,7 +156,7 @@ public abstract class ArbitraryShape { int z = position.getBlockZ(); if (!hollow) { - final BaseBlock material = getMaterial(x, y, z, pattern.next(position)); + final BaseBlock material = getMaterial(x, y, z, pattern.apply(position)); if (material != null && editSession.setBlock(position, material)) { ++affected; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java index 369b1944f..613f13a6c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java @@ -34,7 +34,7 @@ import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.data.DataException; +import com.sk89q.worldedit.world.DataException; import java.io.DataInputStream; import java.io.File; @@ -138,7 +138,7 @@ public class MCEditSchematicFormat extends SchematicFormat { List tileEntities = getChildTag(schematic, "TileEntities", ListTag.class) .getValue(); Map> tileEntitiesMap = - new HashMap>(); + new HashMap<>(); for (Tag tag : tileEntities) { if (!(tag instanceof CompoundTag)) continue; @@ -148,7 +148,7 @@ public class MCEditSchematicFormat extends SchematicFormat { int y = 0; int z = 0; - Map values = new HashMap(); + Map values = new HashMap<>(); for (Map.Entry entry : t.getValue().entrySet()) { if (entry.getKey().equals("x")) { @@ -216,7 +216,7 @@ public class MCEditSchematicFormat extends SchematicFormat { throw new DataException("Length of region too large for a .schematic"); } - HashMap schematic = new HashMap(); + HashMap schematic = new HashMap<>(); schematic.put("Width", new ShortTag((short) width)); schematic.put("Length", new ShortTag((short) length)); schematic.put("Height", new ShortTag((short) height)); @@ -232,7 +232,7 @@ public class MCEditSchematicFormat extends SchematicFormat { byte[] blocks = new byte[width * height * length]; byte[] addBlocks = null; byte[] blockData = new byte[width * height * length]; - ArrayList tileEntities = new ArrayList(); + ArrayList tileEntities = new ArrayList<>(); for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { @@ -257,7 +257,7 @@ public class MCEditSchematicFormat extends SchematicFormat { // Get the list of key/values from the block CompoundTag rawTag = block.getNbtData(); if (rawTag != null) { - Map values = new HashMap(); + Map values = new HashMap<>(); for (Entry entry : rawTag.getValue().entrySet()) { values.put(entry.getKey(), entry.getValue()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/SchematicFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/SchematicFormat.java index 1de675822..7ecbe0181 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/SchematicFormat.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/SchematicFormat.java @@ -21,7 +21,8 @@ package com.sk89q.worldedit.schematic; import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.data.DataException; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.world.DataException; import java.io.File; import java.io.IOException; @@ -29,13 +30,13 @@ import java.util.*; public abstract class SchematicFormat { - private static final Map SCHEMATIC_FORMATS = new HashMap(); + private static final Map SCHEMATIC_FORMATS = new HashMap<>(); // Built-in schematic formats public static final SchematicFormat MCEDIT = new MCEditSchematicFormat(); public static Set getFormats() { - return Collections.unmodifiableSet(new HashSet(SCHEMATIC_FORMATS.values())); + return Collections.unmodifiableSet(new HashSet<>(SCHEMATIC_FORMATS.values())); } public static SchematicFormat getFormat(String lookupName) { @@ -60,7 +61,7 @@ public abstract class SchematicFormat { protected SchematicFormat(String name, String... lookupNames) { this.name = name; - List registeredLookupNames = new ArrayList(lookupNames.length); + List registeredLookupNames = new ArrayList<>(lookupNames.length); for (int i = 0; i < lookupNames.length; ++i) { if (i == 0 || !SCHEMATIC_FORMATS.containsKey(lookupNames[i].toLowerCase())) { SCHEMATIC_FORMATS.put(lookupNames[i].toLowerCase(), this); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java index bca3f641a..0c5753d6d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java @@ -23,8 +23,9 @@ import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.command.InsufficientArgumentsException; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.io.file.FilenameException; import java.io.File; @@ -36,10 +37,9 @@ import java.util.Set; /** * The context given to scripts. */ -@SuppressWarnings("deprecation") public class CraftScriptContext extends CraftScriptEnvironment { - private List editSessions = new ArrayList(); + private List editSessions = new ArrayList<>(); private String[] args; public CraftScriptContext(WorldEdit controller, @@ -176,7 +176,11 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws DisallowedItemException */ public Pattern getBlockPattern(String list) throws WorldEditException { - return controller.getBlockPattern(player, list); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + return controller.getPatternFactory().parseFromInput(list, context); } /**