diff --git a/pom.xml b/pom.xml
index e2d251793..19983ad4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -96,18 +96,6 @@
compiletrue
-
- org.spout
- spoutapi
- dev-SNAPSHOT
- true
-
-
- org.spout
- vanilla
- 1.3.2-SNAPSHOT
- true
-
@@ -272,4 +260,46 @@
+
+
+ spout
+
+
+ org.spout
+ spoutapi
+ dev-SNAPSHOT
+ true
+
+
+ org.spout
+ vanilla
+ 1.3.2-SNAPSHOT
+ true
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.5
+
+
+ add-sources
+ generate-sources
+
+ add-source
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/sk89q/worldedit/blocks/BlockID.java b/src/main/java/com/sk89q/worldedit/blocks/BlockID.java
index b496389ab..1fb083320 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/BlockID.java
+++ b/src/main/java/com/sk89q/worldedit/blocks/BlockID.java
@@ -1,167 +1,167 @@
-// $Id$
-/*
- * WorldEdit
- * Copyright (C) 2010 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
-
-package com.sk89q.worldedit.blocks;
-
-/**
- * List of block IDs.
- *
- * @author sk89q
- */
-public final class BlockID {
- public static final int AIR = 0;
- public static final int STONE = 1;
- public static final int GRASS = 2;
- public static final int DIRT = 3;
- public static final int COBBLESTONE = 4;
- public static final int WOOD = 5;
- public static final int SAPLING = 6;
- public static final int BEDROCK = 7;
- public static final int WATER = 8;
- public static final int STATIONARY_WATER = 9;
- public static final int LAVA = 10;
- public static final int STATIONARY_LAVA = 11;
- public static final int SAND = 12;
- public static final int GRAVEL = 13;
- public static final int GOLD_ORE = 14;
- public static final int IRON_ORE = 15;
- public static final int COAL_ORE = 16;
- public static final int LOG = 17;
- public static final int LEAVES = 18;
- public static final int SPONGE = 19;
- public static final int GLASS = 20;
- public static final int LAPIS_LAZULI_ORE = 21;
- public static final int LAPIS_LAZULI_BLOCK = 22;
- public static final int DISPENSER = 23;
- public static final int SANDSTONE = 24;
- public static final int NOTE_BLOCK = 25;
- public static final int BED = 26;
- public static final int POWERED_RAIL = 27;
- public static final int DETECTOR_RAIL = 28;
- public static final int PISTON_STICKY_BASE = 29;
- public static final int WEB = 30;
- public static final int LONG_GRASS = 31;
- public static final int DEAD_BUSH = 32;
- public static final int PISTON_BASE = 33;
- public static final int PISTON_EXTENSION = 34;
- public static final int CLOTH = 35;
- public static final int PISTON_MOVING_PIECE = 36;
- public static final int YELLOW_FLOWER = 37;
- public static final int RED_FLOWER = 38;
- public static final int BROWN_MUSHROOM = 39;
- public static final int RED_MUSHROOM = 40;
- public static final int GOLD_BLOCK = 41;
- public static final int IRON_BLOCK = 42;
- public static final int DOUBLE_STEP = 43;
- public static final int STEP = 44;
- public static final int BRICK = 45;
- public static final int TNT = 46;
- public static final int BOOKCASE = 47;
- public static final int MOSSY_COBBLESTONE = 48;
- public static final int OBSIDIAN = 49;
- public static final int TORCH = 50;
- public static final int FIRE = 51;
- public static final int MOB_SPAWNER = 52;
- public static final int WOODEN_STAIRS = 53;
- public static final int OAK_WOOD_STAIRS = 53;
- public static final int CHEST = 54;
- public static final int REDSTONE_WIRE = 55;
- public static final int DIAMOND_ORE = 56;
- public static final int DIAMOND_BLOCK = 57;
- public static final int WORKBENCH = 58;
- public static final int CROPS = 59;
- public static final int SOIL = 60;
- public static final int FURNACE = 61;
- public static final int BURNING_FURNACE = 62;
- public static final int SIGN_POST = 63;
- public static final int WOODEN_DOOR = 64;
- public static final int LADDER = 65;
- public static final int MINECART_TRACKS = 66;
- public static final int COBBLESTONE_STAIRS = 67;
- public static final int WALL_SIGN = 68;
- public static final int LEVER = 69;
- public static final int STONE_PRESSURE_PLATE = 70;
- public static final int IRON_DOOR = 71;
- public static final int WOODEN_PRESSURE_PLATE = 72;
- public static final int REDSTONE_ORE = 73;
- public static final int GLOWING_REDSTONE_ORE = 74;
- public static final int REDSTONE_TORCH_OFF = 75;
- public static final int REDSTONE_TORCH_ON = 76;
- public static final int STONE_BUTTON = 77;
- public static final int SNOW = 78;
- public static final int ICE = 79;
- public static final int SNOW_BLOCK = 80;
- public static final int CACTUS = 81;
- public static final int CLAY = 82;
- public static final int REED = 83;
- public static final int JUKEBOX = 84;
- public static final int FENCE = 85;
- public static final int PUMPKIN = 86;
- public static final int NETHERSTONE = 87;
- public static final int NETHERRACK = 87;
- public static final int SLOW_SAND = 88;
- public static final int LIGHTSTONE = 89;
- public static final int PORTAL = 90;
- public static final int JACKOLANTERN = 91;
- public static final int CAKE_BLOCK = 92;
- public static final int REDSTONE_REPEATER_OFF = 93;
- public static final int REDSTONE_REPEATER_ON = 94;
- public static final int LOCKED_CHEST = 95;
- public static final int TRAP_DOOR = 96;
- public static final int SILVERFISH_BLOCK = 97;
- public static final int STONE_BRICK = 98;
- public static final int BROWN_MUSHROOM_CAP = 99;
- public static final int RED_MUSHROOM_CAP = 100;
- public static final int IRON_BARS = 101;
- public static final int GLASS_PANE = 102;
- public static final int MELON_BLOCK = 103;
- public static final int PUMPKIN_STEM = 104;
- public static final int MELON_STEM = 105;
- public static final int VINE = 106;
- public static final int FENCE_GATE = 107;
- public static final int BRICK_STAIRS = 108;
- public static final int STONE_BRICK_STAIRS = 109;
- public static final int MYCELIUM = 110;
- public static final int LILY_PAD = 111;
- public static final int NETHER_BRICK = 112;
- public static final int NETHER_BRICK_FENCE = 113;
- public static final int NETHER_BRICK_STAIRS = 114;
- public static final int NETHER_WART = 115;
- public static final int ENCHANTMENT_TABLE = 116;
- public static final int BREWING_STAND = 117;
- public static final int CAULDRON = 118;
- public static final int END_PORTAL = 119;
- public static final int END_PORTAL_FRAME = 120;
- public static final int END_STONE = 121;
- public static final int DRAGON_EGG = 122;
- public static final int REDSTONE_LAMP_OFF = 123;
- public static final int REDSTONE_LAMP_ON = 124;
- public static final int DOUBLE_WOODEN_STEP = 125;
- public static final int WOODEN_STEP = 126;
- public static final int COCOA_PLANT = 127;
- public static final int SANDSTONE_STAIRS = 128;
- public static final int EMERALD_ORE = 129;
- public static final int ENDER_CHEST = 130;
- public static final int TRIPWIRE_HOOK = 131;
- public static final int TRIPWIRE = 132;
- public static final int EMERALD_BLOCK = 133;
- public static final int SPRUCE_WOOD_STAIRS = 134;
- public static final int BIRCH_WOOD_STAIRS = 135;
- public static final int JUNGLE_WOOD_STAIRS = 136;
-}
+// $Id$
+/*
+ * WorldEdit
+ * Copyright (C) 2010 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+*/
+
+package com.sk89q.worldedit.blocks;
+
+/**
+ * List of block IDs.
+ *
+ * @author sk89q
+ */
+public final class BlockID {
+ public static final int AIR = 0;
+ public static final int STONE = 1;
+ public static final int GRASS = 2;
+ public static final int DIRT = 3;
+ public static final int COBBLESTONE = 4;
+ public static final int WOOD = 5;
+ public static final int SAPLING = 6;
+ public static final int BEDROCK = 7;
+ public static final int WATER = 8;
+ public static final int STATIONARY_WATER = 9;
+ public static final int LAVA = 10;
+ public static final int STATIONARY_LAVA = 11;
+ public static final int SAND = 12;
+ public static final int GRAVEL = 13;
+ public static final int GOLD_ORE = 14;
+ public static final int IRON_ORE = 15;
+ public static final int COAL_ORE = 16;
+ public static final int LOG = 17;
+ public static final int LEAVES = 18;
+ public static final int SPONGE = 19;
+ public static final int GLASS = 20;
+ public static final int LAPIS_LAZULI_ORE = 21;
+ public static final int LAPIS_LAZULI_BLOCK = 22;
+ public static final int DISPENSER = 23;
+ public static final int SANDSTONE = 24;
+ public static final int NOTE_BLOCK = 25;
+ public static final int BED = 26;
+ public static final int POWERED_RAIL = 27;
+ public static final int DETECTOR_RAIL = 28;
+ public static final int PISTON_STICKY_BASE = 29;
+ public static final int WEB = 30;
+ public static final int LONG_GRASS = 31;
+ public static final int DEAD_BUSH = 32;
+ public static final int PISTON_BASE = 33;
+ public static final int PISTON_EXTENSION = 34;
+ public static final int CLOTH = 35;
+ public static final int PISTON_MOVING_PIECE = 36;
+ public static final int YELLOW_FLOWER = 37;
+ public static final int RED_FLOWER = 38;
+ public static final int BROWN_MUSHROOM = 39;
+ public static final int RED_MUSHROOM = 40;
+ public static final int GOLD_BLOCK = 41;
+ public static final int IRON_BLOCK = 42;
+ public static final int DOUBLE_STEP = 43;
+ public static final int STEP = 44;
+ public static final int BRICK = 45;
+ public static final int TNT = 46;
+ public static final int BOOKCASE = 47;
+ public static final int MOSSY_COBBLESTONE = 48;
+ public static final int OBSIDIAN = 49;
+ public static final int TORCH = 50;
+ public static final int FIRE = 51;
+ public static final int MOB_SPAWNER = 52;
+ public static final int WOODEN_STAIRS = 53;
+ public static final int OAK_WOOD_STAIRS = 53;
+ public static final int CHEST = 54;
+ public static final int REDSTONE_WIRE = 55;
+ public static final int DIAMOND_ORE = 56;
+ public static final int DIAMOND_BLOCK = 57;
+ public static final int WORKBENCH = 58;
+ public static final int CROPS = 59;
+ public static final int SOIL = 60;
+ public static final int FURNACE = 61;
+ public static final int BURNING_FURNACE = 62;
+ public static final int SIGN_POST = 63;
+ public static final int WOODEN_DOOR = 64;
+ public static final int LADDER = 65;
+ public static final int MINECART_TRACKS = 66;
+ public static final int COBBLESTONE_STAIRS = 67;
+ public static final int WALL_SIGN = 68;
+ public static final int LEVER = 69;
+ public static final int STONE_PRESSURE_PLATE = 70;
+ public static final int IRON_DOOR = 71;
+ public static final int WOODEN_PRESSURE_PLATE = 72;
+ public static final int REDSTONE_ORE = 73;
+ public static final int GLOWING_REDSTONE_ORE = 74;
+ public static final int REDSTONE_TORCH_OFF = 75;
+ public static final int REDSTONE_TORCH_ON = 76;
+ public static final int STONE_BUTTON = 77;
+ public static final int SNOW = 78;
+ public static final int ICE = 79;
+ public static final int SNOW_BLOCK = 80;
+ public static final int CACTUS = 81;
+ public static final int CLAY = 82;
+ public static final int REED = 83;
+ public static final int JUKEBOX = 84;
+ public static final int FENCE = 85;
+ public static final int PUMPKIN = 86;
+ public static final int NETHERSTONE = 87;
+ public static final int NETHERRACK = 87;
+ public static final int SLOW_SAND = 88;
+ public static final int LIGHTSTONE = 89;
+ public static final int PORTAL = 90;
+ public static final int JACKOLANTERN = 91;
+ public static final int CAKE_BLOCK = 92;
+ public static final int REDSTONE_REPEATER_OFF = 93;
+ public static final int REDSTONE_REPEATER_ON = 94;
+ public static final int LOCKED_CHEST = 95;
+ public static final int TRAP_DOOR = 96;
+ public static final int SILVERFISH_BLOCK = 97;
+ public static final int STONE_BRICK = 98;
+ public static final int BROWN_MUSHROOM_CAP = 99;
+ public static final int RED_MUSHROOM_CAP = 100;
+ public static final int IRON_BARS = 101;
+ public static final int GLASS_PANE = 102;
+ public static final int MELON_BLOCK = 103;
+ public static final int PUMPKIN_STEM = 104;
+ public static final int MELON_STEM = 105;
+ public static final int VINE = 106;
+ public static final int FENCE_GATE = 107;
+ public static final int BRICK_STAIRS = 108;
+ public static final int STONE_BRICK_STAIRS = 109;
+ public static final int MYCELIUM = 110;
+ public static final int LILY_PAD = 111;
+ public static final int NETHER_BRICK = 112;
+ public static final int NETHER_BRICK_FENCE = 113;
+ public static final int NETHER_BRICK_STAIRS = 114;
+ public static final int NETHER_WART = 115;
+ public static final int ENCHANTMENT_TABLE = 116;
+ public static final int BREWING_STAND = 117;
+ public static final int CAULDRON = 118;
+ public static final int END_PORTAL = 119;
+ public static final int END_PORTAL_FRAME = 120;
+ public static final int END_STONE = 121;
+ public static final int DRAGON_EGG = 122;
+ public static final int REDSTONE_LAMP_OFF = 123;
+ public static final int REDSTONE_LAMP_ON = 124;
+ public static final int DOUBLE_WOODEN_STEP = 125;
+ public static final int WOODEN_STEP = 126;
+ public static final int COCOA_PLANT = 127;
+ public static final int SANDSTONE_STAIRS = 128;
+ public static final int EMERALD_ORE = 129;
+ public static final int ENDER_CHEST = 130;
+ public static final int TRIPWIRE_HOOK = 131;
+ public static final int TRIPWIRE = 132;
+ public static final int EMERALD_BLOCK = 133;
+ public static final int SPRUCE_WOOD_STAIRS = 134;
+ public static final int BIRCH_WOOD_STAIRS = 135;
+ public static final int JUNGLE_WOOD_STAIRS = 136;
+}
diff --git a/src/main/java/com/sk89q/worldedit/blocks/ItemID.java b/src/main/java/com/sk89q/worldedit/blocks/ItemID.java
index 615274714..66ea730d5 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/ItemID.java
+++ b/src/main/java/com/sk89q/worldedit/blocks/ItemID.java
@@ -1,174 +1,174 @@
-// $Id$
-/*
- * WorldEdit
- * Copyright (C) 2010 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
-
-package com.sk89q.worldedit.blocks;
-
-/**
- * List of item IDs.
- *
- * @author sk89q
- */
-public final class ItemID {
- public static final int IRON_SHOVEL = 256;
- public static final int IRON_PICK = 257;
- public static final int IRON_AXE = 258;
- public static final int FLINT_AND_TINDER = 259;
- public static final int RED_APPLE = 260;
- public static final int BOW = 261;
- public static final int ARROW = 262;
- public static final int COAL = 263;
- public static final int DIAMOND = 264;
- public static final int IRON_BAR = 265;
- public static final int GOLD_BAR = 266;
- public static final int IRON_SWORD = 267;
- public static final int WOOD_SWORD = 268;
- public static final int WOOD_SHOVEL = 269;
- public static final int WOOD_PICKAXE = 270;
- public static final int WOOD_AXE = 271;
- public static final int STONE_SWORD = 272;
- public static final int STONE_SHOVEL = 273;
- public static final int STONE_PICKAXE = 274;
- public static final int STONE_AXE = 275;
- public static final int DIAMOND_SWORD = 276;
- public static final int DIAMOND_SHOVEL = 277;
- public static final int DIAMOND_PICKAXE = 278;
- public static final int DIAMOND_AXE = 279;
- public static final int STICK = 280;
- public static final int BOWL = 281;
- public static final int MUSHROOM_SOUP = 282;
- public static final int GOLD_SWORD = 283;
- public static final int GOLD_SHOVEL = 284;
- public static final int GOLD_PICKAXE = 285;
- public static final int GOLD_AXE = 286;
- public static final int STRING = 287;
- public static final int FEATHER = 288;
- public static final int SULPHUR = 289;
- public static final int WOOD_HOE = 290;
- public static final int STONE_HOE = 291;
- public static final int IRON_HOE = 292;
- public static final int DIAMOND_HOE = 293;
- public static final int GOLD_HOE = 294;
- public static final int SEEDS = 295;
- public static final int WHEAT = 296;
- public static final int BREAD = 297;
- public static final int LEATHER_HELMET = 298;
- public static final int LEATHER_CHEST = 299;
- public static final int LEATHER_PANTS = 300;
- public static final int LEATHER_BOOTS = 301;
- public static final int CHAINMAIL_HELMET = 302;
- public static final int CHAINMAIL_CHEST = 303;
- public static final int CHAINMAIL_PANTS = 304;
- public static final int CHAINMAIL_BOOTS = 305;
- public static final int IRON_HELMET = 306;
- public static final int IRON_CHEST = 307;
- public static final int IRON_PANTS = 308;
- public static final int IRON_BOOTS = 309;
- public static final int DIAMOND_HELMET = 310;
- public static final int DIAMOND_CHEST = 311;
- public static final int DIAMOND_PANTS = 312;
- public static final int DIAMOND_BOOTS = 313;
- public static final int GOLD_HELMET = 314;
- public static final int GOLD_CHEST = 315;
- public static final int GOLD_PANTS = 316;
- public static final int GOLD_BOOTS = 317;
- public static final int FLINT = 318;
- public static final int RAW_PORKCHOP = 319;
- public static final int COOKED_PORKCHOP = 320;
- public static final int PAINTING = 321;
- public static final int GOLD_APPLE = 322;
- public static final int SIGN = 323;
- public static final int WOODEN_DOOR_ITEM = 324;
- public static final int BUCKET = 325;
- public static final int WATER_BUCKET = 326;
- public static final int LAVA_BUCKET = 327;
- public static final int MINECART = 328;
- public static final int SADDLE = 329;
- public static final int IRON_DOOR_ITEM = 330;
- public static final int REDSTONE_DUST = 331;
- public static final int SNOWBALL = 332;
- public static final int WOOD_BOAT = 333;
- public static final int LEATHER = 334;
- public static final int MILK_BUCKET = 335;
- public static final int BRICK_BAR = 336;
- public static final int CLAY_BALL = 337;
- public static final int SUGAR_CANE_ITEM = 338;
- public static final int PAPER = 339;
- public static final int BOOK = 340;
- public static final int SLIME_BALL = 341;
- public static final int STORAGE_MINECART = 342;
- public static final int POWERED_MINECART = 343;
- public static final int EGG = 344;
- public static final int COMPASS = 345;
- public static final int FISHING_ROD = 346;
- public static final int WATCH = 347;
- public static final int LIGHTSTONE_DUST = 348;
- public static final int RAW_FISH = 349;
- public static final int COOKED_FISH = 350;
- public static final int INK_SACK = 351;
- public static final int BONE = 352;
- public static final int SUGAR = 353;
- public static final int CAKE_ITEM = 354;
- public static final int BED_ITEM = 355;
- public static final int REDSTONE_REPEATER = 356;
- public static final int COOKIE = 357;
- public static final int MAP = 358;
- public static final int SHEARS = 359;
- public static final int MELON = 360;
- public static final int PUMPKIN_SEEDS = 361;
- public static final int MELON_SEEDS = 362;
- public static final int RAW_BEEF = 363;
- public static final int COOKED_BEEF = 364;
- public static final int RAW_CHICKEN = 365;
- public static final int COOKED_CHICKEN = 366;
- public static final int ROTTEN_FLESH = 367;
- public static final int ENDER_PEARL = 368;
- public static final int BLAZE_ROD = 369;
- public static final int GHAST_TEAR = 370;
- public static final int GOLD_NUGGET = 371;
- public static final int NETHER_WART_SEED = 372;
- public static final int POTION = 373;
- public static final int GLASS_BOTTLE = 374;
- public static final int SPIDER_EYE = 375;
- public static final int FERMENTED_SPIDER_EYE = 376;
- public static final int BLAZE_POWDER = 377;
- public static final int MAGMA_CREAM = 378;
- public static final int BREWING_STAND = 379;
- public static final int CAULDRON = 380;
- public static final int EYE_OF_ENDER = 381;
- public static final int GLISTERING_MELON = 382;
- public static final int SPAWN_EGG = 383;
- public static final int BOTTLE_O_ENCHANTING = 384;
- public static final int FIRE_CHARGE = 385;
- public static final int BOOK_AND_QUILL = 386;
- public static final int WRITTEN_BOOK = 387;
- public static final int EMERALD = 388;
- @Deprecated public static final int GOLD_RECORD = 2256; // deprecated, but leave it there
- @Deprecated public static final int GREEN_RECORD = 2257; // deprecated, but leave it there
- public static final int DISC_13 = 2256;
- public static final int DISC_CAT = 2257;
- public static final int DISC_BLOCKS = 2258;
- public static final int DISC_CHIRP = 2259;
- public static final int DISC_FAR = 2260;
- public static final int DISC_MALL = 2261;
- public static final int DISC_MELLOHI = 2262;
- public static final int DISC_STAL = 2263;
- public static final int DISC_STRAD = 2264;
- public static final int DISC_WARD = 2265;
- public static final int DISC_11 = 2266;
-}
+// $Id$
+/*
+ * WorldEdit
+ * Copyright (C) 2010 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+*/
+
+package com.sk89q.worldedit.blocks;
+
+/**
+ * List of item IDs.
+ *
+ * @author sk89q
+ */
+public final class ItemID {
+ public static final int IRON_SHOVEL = 256;
+ public static final int IRON_PICK = 257;
+ public static final int IRON_AXE = 258;
+ public static final int FLINT_AND_TINDER = 259;
+ public static final int RED_APPLE = 260;
+ public static final int BOW = 261;
+ public static final int ARROW = 262;
+ public static final int COAL = 263;
+ public static final int DIAMOND = 264;
+ public static final int IRON_BAR = 265;
+ public static final int GOLD_BAR = 266;
+ public static final int IRON_SWORD = 267;
+ public static final int WOOD_SWORD = 268;
+ public static final int WOOD_SHOVEL = 269;
+ public static final int WOOD_PICKAXE = 270;
+ public static final int WOOD_AXE = 271;
+ public static final int STONE_SWORD = 272;
+ public static final int STONE_SHOVEL = 273;
+ public static final int STONE_PICKAXE = 274;
+ public static final int STONE_AXE = 275;
+ public static final int DIAMOND_SWORD = 276;
+ public static final int DIAMOND_SHOVEL = 277;
+ public static final int DIAMOND_PICKAXE = 278;
+ public static final int DIAMOND_AXE = 279;
+ public static final int STICK = 280;
+ public static final int BOWL = 281;
+ public static final int MUSHROOM_SOUP = 282;
+ public static final int GOLD_SWORD = 283;
+ public static final int GOLD_SHOVEL = 284;
+ public static final int GOLD_PICKAXE = 285;
+ public static final int GOLD_AXE = 286;
+ public static final int STRING = 287;
+ public static final int FEATHER = 288;
+ public static final int SULPHUR = 289;
+ public static final int WOOD_HOE = 290;
+ public static final int STONE_HOE = 291;
+ public static final int IRON_HOE = 292;
+ public static final int DIAMOND_HOE = 293;
+ public static final int GOLD_HOE = 294;
+ public static final int SEEDS = 295;
+ public static final int WHEAT = 296;
+ public static final int BREAD = 297;
+ public static final int LEATHER_HELMET = 298;
+ public static final int LEATHER_CHEST = 299;
+ public static final int LEATHER_PANTS = 300;
+ public static final int LEATHER_BOOTS = 301;
+ public static final int CHAINMAIL_HELMET = 302;
+ public static final int CHAINMAIL_CHEST = 303;
+ public static final int CHAINMAIL_PANTS = 304;
+ public static final int CHAINMAIL_BOOTS = 305;
+ public static final int IRON_HELMET = 306;
+ public static final int IRON_CHEST = 307;
+ public static final int IRON_PANTS = 308;
+ public static final int IRON_BOOTS = 309;
+ public static final int DIAMOND_HELMET = 310;
+ public static final int DIAMOND_CHEST = 311;
+ public static final int DIAMOND_PANTS = 312;
+ public static final int DIAMOND_BOOTS = 313;
+ public static final int GOLD_HELMET = 314;
+ public static final int GOLD_CHEST = 315;
+ public static final int GOLD_PANTS = 316;
+ public static final int GOLD_BOOTS = 317;
+ public static final int FLINT = 318;
+ public static final int RAW_PORKCHOP = 319;
+ public static final int COOKED_PORKCHOP = 320;
+ public static final int PAINTING = 321;
+ public static final int GOLD_APPLE = 322;
+ public static final int SIGN = 323;
+ public static final int WOODEN_DOOR_ITEM = 324;
+ public static final int BUCKET = 325;
+ public static final int WATER_BUCKET = 326;
+ public static final int LAVA_BUCKET = 327;
+ public static final int MINECART = 328;
+ public static final int SADDLE = 329;
+ public static final int IRON_DOOR_ITEM = 330;
+ public static final int REDSTONE_DUST = 331;
+ public static final int SNOWBALL = 332;
+ public static final int WOOD_BOAT = 333;
+ public static final int LEATHER = 334;
+ public static final int MILK_BUCKET = 335;
+ public static final int BRICK_BAR = 336;
+ public static final int CLAY_BALL = 337;
+ public static final int SUGAR_CANE_ITEM = 338;
+ public static final int PAPER = 339;
+ public static final int BOOK = 340;
+ public static final int SLIME_BALL = 341;
+ public static final int STORAGE_MINECART = 342;
+ public static final int POWERED_MINECART = 343;
+ public static final int EGG = 344;
+ public static final int COMPASS = 345;
+ public static final int FISHING_ROD = 346;
+ public static final int WATCH = 347;
+ public static final int LIGHTSTONE_DUST = 348;
+ public static final int RAW_FISH = 349;
+ public static final int COOKED_FISH = 350;
+ public static final int INK_SACK = 351;
+ public static final int BONE = 352;
+ public static final int SUGAR = 353;
+ public static final int CAKE_ITEM = 354;
+ public static final int BED_ITEM = 355;
+ public static final int REDSTONE_REPEATER = 356;
+ public static final int COOKIE = 357;
+ public static final int MAP = 358;
+ public static final int SHEARS = 359;
+ public static final int MELON = 360;
+ public static final int PUMPKIN_SEEDS = 361;
+ public static final int MELON_SEEDS = 362;
+ public static final int RAW_BEEF = 363;
+ public static final int COOKED_BEEF = 364;
+ public static final int RAW_CHICKEN = 365;
+ public static final int COOKED_CHICKEN = 366;
+ public static final int ROTTEN_FLESH = 367;
+ public static final int ENDER_PEARL = 368;
+ public static final int BLAZE_ROD = 369;
+ public static final int GHAST_TEAR = 370;
+ public static final int GOLD_NUGGET = 371;
+ public static final int NETHER_WART_SEED = 372;
+ public static final int POTION = 373;
+ public static final int GLASS_BOTTLE = 374;
+ public static final int SPIDER_EYE = 375;
+ public static final int FERMENTED_SPIDER_EYE = 376;
+ public static final int BLAZE_POWDER = 377;
+ public static final int MAGMA_CREAM = 378;
+ public static final int BREWING_STAND = 379;
+ public static final int CAULDRON = 380;
+ public static final int EYE_OF_ENDER = 381;
+ public static final int GLISTERING_MELON = 382;
+ public static final int SPAWN_EGG = 383;
+ public static final int BOTTLE_O_ENCHANTING = 384;
+ public static final int FIRE_CHARGE = 385;
+ public static final int BOOK_AND_QUILL = 386;
+ public static final int WRITTEN_BOOK = 387;
+ public static final int EMERALD = 388;
+ @Deprecated public static final int GOLD_RECORD = 2256; // deprecated, but leave it there
+ @Deprecated public static final int GREEN_RECORD = 2257; // deprecated, but leave it there
+ public static final int DISC_13 = 2256;
+ public static final int DISC_CAT = 2257;
+ public static final int DISC_BLOCKS = 2258;
+ public static final int DISC_CHIRP = 2259;
+ public static final int DISC_FAR = 2260;
+ public static final int DISC_MALL = 2261;
+ public static final int DISC_MELLOHI = 2262;
+ public static final int DISC_STAL = 2263;
+ public static final int DISC_STRAD = 2264;
+ public static final int DISC_WARD = 2265;
+ public static final int DISC_11 = 2266;
+}
diff --git a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java
index e058fc63c..848d0f8dc 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java
+++ b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java
@@ -1,642 +1,642 @@
-// $Id$
-/*
- * WorldEdit
- * Copyright (C) 2010 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
-
-package com.sk89q.worldedit.blocks;
-
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumSet;
-import java.util.Set;
-
-import com.sk89q.util.StringUtil;
-
-/**
- * ItemType types.
- *
- * @author sk89q
- */
-public enum ItemType {
- // Blocks
- AIR(BlockID.AIR, "Air", "air"),
- STONE(BlockID.STONE, "Stone", "stone", "rock"),
- GRASS(BlockID.GRASS, "Grass", "grass"),
- DIRT(BlockID.DIRT, "Dirt", "dirt"),
- COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"),
- WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
- SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"),
- BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"),
- WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
- STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
- LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
- STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
- SAND(BlockID.SAND, "Sand", "sand"),
- GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"),
- GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"),
- IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"),
- COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"),
- LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
- LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"),
- SPONGE(BlockID.SPONGE, "Sponge", "sponge"),
- GLASS(BlockID.GLASS, "Glass", "glass"),
- LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
- LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
- DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"),
- SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"),
- NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
- BED(BlockID.BED, "Bed", "bed"),
- POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
- DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"),
- PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"),
- WEB(BlockID.WEB, "Web", "web", "spiderweb"),
- LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"),
- DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
- PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"),
- PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"),
- CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"),
- PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"),
- YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"),
- RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"),
- BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"),
- RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"),
- GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"),
- IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"),
- DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
- STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"),
- BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"),
- TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"),
- BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
- MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
- OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"),
- TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"),
- FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"),
- MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"),
- WOODEN_STAIRS(BlockID.WOODEN_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
- CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"),
- REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"),
- DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"),
- DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"),
- WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"),
- CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"),
- SOIL(BlockID.SOIL, "Soil", "soil", "farmland"),
- FURNACE(BlockID.FURNACE, "Furnace", "furnace"),
- BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"),
- SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"),
- WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"),
- LADDER(BlockID.LADDER, "Ladder", "ladder"),
- MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
- COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
- WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"),
- LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
- STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"),
- IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"),
- WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
- REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"),
- GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"),
- REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
- REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
- STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"),
- SNOW(BlockID.SNOW, "Snow", "snow"),
- ICE(BlockID.ICE, "Ice", "ice"),
- SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"),
- CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"),
- CLAY(BlockID.CLAY, "Clay", "clay"),
- SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
- JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"),
- FENCE(BlockID.FENCE, "Fence", "fence"),
- PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"),
- NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
- SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
- GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
- PORTAL(BlockID.PORTAL, "Portal", "portal"),
- JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
- CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"),
- REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"),
- REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
- LOCKED_CHEST(BlockID.LOCKED_CHEST, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
- TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"),
- SILVERFISH_BLOCK(BlockID.SILVERFISH_BLOCK, "Silverfish block", "silverfish", "silver"),
- STONE_BRICK(BlockID.STONE_BRICK, "Stone brick", "stonebrick", "sbrick", "smoothstonebrick"),
- RED_MUSHROOM_CAP(BlockID.RED_MUSHROOM_CAP, "Red mushroom cap", "giantmushroomred", "redgiantmushroom", "redmushroomcap"),
- BROWN_MUSHROOM_CAP(BlockID.BROWN_MUSHROOM_CAP, "Brown mushroom cap", "giantmushroombrown", "browngiantmushoom", "brownmushroomcap"),
- IRON_BARS(BlockID.IRON_BARS, "Iron bars", "ironbars", "ironfence"),
- GLASS_PANE(BlockID.GLASS_PANE, "Glass pane", "window", "glasspane", "glasswindow"),
- MELON_BLOCK(BlockID.MELON_BLOCK, "Melon (block)", "melonblock"),
- PUMPKIN_STEM(BlockID.PUMPKIN_STEM, "Pumpkin stem", "pumpkinstem"),
- MELON_STEM(BlockID.MELON_STEM, "Melon stem", "melonstem"),
- VINE(BlockID.VINE, "Vine", "vine", "vines", "creepers"),
- FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"),
- BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"),
- STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"),
- MYCELIUM(BlockID.MYCELIUM, "Mycelium", "fungus", "mycel"),
- LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"),
- NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"),
- NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"),
- NETHER_BRICK_STAIRS(BlockID.NETHER_BRICK_STAIRS, "Nether brick stairs", "netherbrickstairs", "netherbricksteps", "netherstairs", "nethersteps"),
- NETHER_WART(BlockID.NETHER_WART, "Nether wart", "netherwart", "netherstalk"),
- ENCHANTMENT_TABLE(BlockID.ENCHANTMENT_TABLE, "Enchantment table", "enchantmenttable", "enchanttable"),
- BREWING_STAND(BlockID.BREWING_STAND, "Brewing Stand", "brewingstand"),
- CAULDRON(BlockID.CAULDRON, "Cauldron"),
- END_PORTAL(BlockID.END_PORTAL, "End Portal", "endportal", "blackstuff", "airportal", "weirdblackstuff"),
- END_PORTAL_FRAME(BlockID.END_PORTAL_FRAME, "End Portal Frame", "endportalframe", "airportalframe", "crystalblock"),
- END_STONE(BlockID.END_STONE, "End Stone", "endstone", "enderstone", "endersand"),
- DRAGON_EGG(BlockID.DRAGON_EGG, "Dragon Egg", "dragonegg", "dragons"),
- REDSTONE_LAMP_OFF(BlockID.REDSTONE_LAMP_OFF, "Redstone lamp (off)", "redstonelamp", "redstonelampoff", "rslamp", "rslampoff", "rsglow", "rsglowoff"),
- REDSTONE_LAMP_ON(BlockID.REDSTONE_LAMP_ON, "Redstone lamp (on)", "redstonelampon", "rslampon", "rsglowon"),
- DOUBLE_WOODEN_STEP(BlockID.DOUBLE_WOODEN_STEP, "Double wood step", "doublewoodslab", "doublewoodstep"),
- WOODEN_STEP(BlockID.WOODEN_STEP, "Wood step", "woodenslab", "woodslab", "woodstep", "woodhalfstep"),
- COCOA_PLANT(BlockID.COCOA_PLANT, "Cocoa plant", "cocoplant", "cocoaplant"),
- SANDSTONE_STAIRS(BlockID.SANDSTONE_STAIRS, "Sandstone stairs", "sandstairs", "sandstonestairs"),
- EMERALD_ORE(BlockID.EMERALD_ORE, "Emerald ore", "emeraldore"),
- ENDER_CHEST(BlockID.ENDER_CHEST, "Ender chest", "enderchest"),
- TRIPWIRE_HOOK(BlockID.TRIPWIRE_HOOK, "Tripwire hook", "tripwirehook"),
- TRIPWIRE(BlockID.TRIPWIRE, "Tripwire", "tripwire", "string"),
- EMERALD_BLOCK(BlockID.EMERALD_BLOCK, "Emerald block", "emeraldblock", "emerald"),
- SPRUCE_WOOD_STAIRS(BlockID.SPRUCE_WOOD_STAIRS, "Spruce wood stairs", "sprucestairs", "sprucewoodstairs"),
- BIRCH_WOOD_STAIRS(BlockID.BIRCH_WOOD_STAIRS, "Birch wood stairs", "birchstairs", "birchwoodstairs"),
- JUNGLE_WOOD_STAIRS(BlockID.JUNGLE_WOOD_STAIRS, "Jungle wood stairs", "junglestairs", "junglewoodstairs"),
-
- // Items
- IRON_SHOVEL(ItemID.IRON_SHOVEL, "Iron shovel", "ironshovel"),
- IRON_PICK(ItemID.IRON_PICK, "Iron pick", "ironpick", "ironpickaxe"),
- IRON_AXE(ItemID.IRON_AXE, "Iron axe", "ironaxe"),
- FLINT_AND_TINDER(ItemID.FLINT_AND_TINDER, "Flint and tinder", "flintandtinder", "lighter", "flintandsteel", "flintsteel", "flintandiron", "flintnsteel", "flintniron", "flintntinder"),
- RED_APPLE(ItemID.RED_APPLE, "Red apple", "redapple", "apple"),
- BOW(ItemID.BOW, "Bow", "bow"),
- ARROW(ItemID.ARROW, "Arrow", "arrow"),
- COAL(ItemID.COAL, "Coal", "coal"),
- DIAMOND(ItemID.DIAMOND, "Diamond", "diamond"),
- IRON_BAR(ItemID.IRON_BAR, "Iron bar", "ironbar", "iron"),
- GOLD_BAR(ItemID.GOLD_BAR, "Gold bar", "goldbar", "gold"),
- IRON_SWORD(ItemID.IRON_SWORD, "Iron sword", "ironsword"),
- WOOD_SWORD(ItemID.WOOD_SWORD, "Wooden sword", "woodsword"),
- WOOD_SHOVEL(ItemID.WOOD_SHOVEL, "Wooden shovel", "woodshovel"),
- WOOD_PICKAXE(ItemID.WOOD_PICKAXE, "Wooden pickaxe", "woodpick", "woodpickaxe"),
- WOOD_AXE(ItemID.WOOD_AXE, "Wooden axe", "woodaxe"),
- STONE_SWORD(ItemID.STONE_SWORD, "Stone sword", "stonesword"),
- STONE_SHOVEL(ItemID.STONE_SHOVEL, "Stone shovel", "stoneshovel"),
- STONE_PICKAXE(ItemID.STONE_PICKAXE, "Stone pickaxe", "stonepick", "stonepickaxe"),
- STONE_AXE(ItemID.STONE_AXE, "Stone pickaxe", "stoneaxe"),
- DIAMOND_SWORD(ItemID.DIAMOND_SWORD, "Diamond sword", "diamondsword"),
- DIAMOND_SHOVEL(ItemID.DIAMOND_SHOVEL, "Diamond shovel", "diamondshovel"),
- DIAMOND_PICKAXE(ItemID.DIAMOND_PICKAXE, "Diamond pickaxe", "diamondpick", "diamondpickaxe"),
- DIAMOND_AXE(ItemID.DIAMOND_AXE, "Diamond axe", "diamondaxe"),
- STICK(ItemID.STICK, "Stick", "stick"),
- BOWL(ItemID.BOWL, "Bowl", "bowl"),
- MUSHROOM_SOUP(ItemID.MUSHROOM_SOUP, "Mushroom soup", "mushroomsoup", "soup", "brbsoup"),
- GOLD_SWORD(ItemID.GOLD_SWORD, "Golden sword", "goldsword"),
- GOLD_SHOVEL(ItemID.GOLD_SHOVEL, "Golden shovel", "goldshovel"),
- GOLD_PICKAXE(ItemID.GOLD_PICKAXE, "Golden pickaxe", "goldpick", "goldpickaxe"),
- GOLD_AXE(ItemID.GOLD_AXE, "Golden axe", "goldaxe"),
- STRING(ItemID.STRING, "String", "string"),
- FEATHER(ItemID.FEATHER, "Feather", "feather"),
- SULPHUR(ItemID.SULPHUR, "Sulphur", "sulphur", "sulfur", "gunpowder"),
- WOOD_HOE(ItemID.WOOD_HOE, "Wooden hoe", "woodhoe"),
- STONE_HOE(ItemID.STONE_HOE, "Stone hoe", "stonehoe"),
- IRON_HOE(ItemID.IRON_HOE, "Iron hoe", "ironhoe"),
- DIAMOND_HOE(ItemID.DIAMOND_HOE, "Diamond hoe", "diamondhoe"),
- GOLD_HOE(ItemID.GOLD_HOE, "Golden hoe", "goldhoe"),
- SEEDS(ItemID.SEEDS, "Seeds", "seeds", "seed"),
- WHEAT(ItemID.WHEAT, "Wheat", "wheat"),
- BREAD(ItemID.BREAD, "Bread", "bread"),
- LEATHER_HELMET(ItemID.LEATHER_HELMET, "Leather helmet", "leatherhelmet", "leatherhat"),
- LEATHER_CHEST(ItemID.LEATHER_CHEST, "Leather chestplate", "leatherchest", "leatherchestplate", "leathervest", "leatherbreastplate", "leatherplate", "leathercplate", "leatherbody"),
- LEATHER_PANTS(ItemID.LEATHER_PANTS, "Leather pants", "leatherpants", "leathergreaves", "leatherlegs", "leatherleggings", "leatherstockings", "leatherbreeches"),
- LEATHER_BOOTS(ItemID.LEATHER_BOOTS, "Leather boots", "leatherboots", "leathershoes", "leatherfoot", "leatherfeet"),
- CHAINMAIL_HELMET(ItemID.CHAINMAIL_HELMET, "Chainmail helmet", "chainmailhelmet", "chainmailhat"),
- CHAINMAIL_CHEST(ItemID.CHAINMAIL_CHEST, "Chainmail chestplate", "chainmailchest", "chainmailchestplate", "chainmailvest", "chainmailbreastplate", "chainmailplate", "chainmailcplate", "chainmailbody"),
- CHAINMAIL_PANTS(ItemID.CHAINMAIL_PANTS, "Chainmail pants", "chainmailpants", "chainmailgreaves", "chainmaillegs", "chainmailleggings", "chainmailstockings", "chainmailbreeches"),
- CHAINMAIL_BOOTS(ItemID.CHAINMAIL_BOOTS, "Chainmail boots", "chainmailboots", "chainmailshoes", "chainmailfoot", "chainmailfeet"),
- IRON_HELMET(ItemID.IRON_HELMET, "Iron helmet", "ironhelmet", "ironhat"),
- IRON_CHEST(ItemID.IRON_CHEST, "Iron chestplate", "ironchest", "ironchestplate", "ironvest", "ironbreastplate", "ironplate", "ironcplate", "ironbody"),
- IRON_PANTS(ItemID.IRON_PANTS, "Iron pants", "ironpants", "irongreaves", "ironlegs", "ironleggings", "ironstockings", "ironbreeches"),
- IRON_BOOTS(ItemID.IRON_BOOTS, "Iron boots", "ironboots", "ironshoes", "ironfoot", "ironfeet"),
- DIAMOND_HELMET(ItemID.DIAMOND_HELMET, "Diamond helmet", "diamondhelmet", "diamondhat"),
- DIAMOND_CHEST(ItemID.DIAMOND_CHEST, "Diamond chestplate", "diamondchest", "diamondchestplate", "diamondvest", "diamondbreastplate", "diamondplate", "diamondcplate", "diamondbody"),
- DIAMOND_PANTS(ItemID.DIAMOND_PANTS, "Diamond pants", "diamondpants", "diamondgreaves", "diamondlegs", "diamondleggings", "diamondstockings", "diamondbreeches"),
- DIAMOND_BOOTS(ItemID.DIAMOND_BOOTS, "Diamond boots", "diamondboots", "diamondshoes", "diamondfoot", "diamondfeet"),
- GOLD_HELMET(ItemID.GOLD_HELMET, "Gold helmet", "goldhelmet", "goldhat"),
- GOLD_CHEST(ItemID.GOLD_CHEST, "Gold chestplate", "goldchest", "goldchestplate", "goldvest", "goldbreastplate", "goldplate", "goldcplate", "goldbody"),
- GOLD_PANTS(ItemID.GOLD_PANTS, "Gold pants", "goldpants", "goldgreaves", "goldlegs", "goldleggings", "goldstockings", "goldbreeches"),
- GOLD_BOOTS(ItemID.GOLD_BOOTS, "Gold boots", "goldboots", "goldshoes", "goldfoot", "goldfeet"),
- FLINT(ItemID.FLINT, "Flint", "flint"),
- RAW_PORKCHOP(ItemID.RAW_PORKCHOP, "Raw porkchop", "rawpork", "rawporkchop", "rawbacon", "baconstrips", "rawmeat"),
- COOKED_PORKCHOP(ItemID.COOKED_PORKCHOP, "Cooked porkchop", "pork", "cookedpork", "cookedporkchop", "cookedbacon", "bacon", "meat"),
- PAINTING(ItemID.PAINTING, "Painting", "painting"),
- GOLD_APPLE(ItemID.GOLD_APPLE, "Golden apple", "goldapple", "goldenapple"),
- SIGN(ItemID.SIGN, "Wooden sign", "sign"),
- WOODEN_DOOR_ITEM(ItemID.WOODEN_DOOR_ITEM, "Wooden door", "wooddoor", "door"),
- BUCKET(ItemID.BUCKET, "Bucket", "bucket", "bukkit"),
- WATER_BUCKET(ItemID.WATER_BUCKET, "Water bucket", "waterbucket", "waterbukkit"),
- LAVA_BUCKET(ItemID.LAVA_BUCKET, "Lava bucket", "lavabucket", "lavabukkit"),
- MINECART(ItemID.MINECART, "Minecart", "minecart", "cart"),
- SADDLE(ItemID.SADDLE, "Saddle", "saddle"),
- IRON_DOOR_ITEM(ItemID.IRON_DOOR_ITEM, "Iron door", "irondoor"),
- REDSTONE_DUST(ItemID.REDSTONE_DUST, "Redstone dust", "redstonedust", "reddust", "redstone", "dust", "wire"),
- SNOWBALL(ItemID.SNOWBALL, "Snowball", "snowball"),
- WOOD_BOAT(ItemID.WOOD_BOAT, "Wooden boat", "woodboat", "woodenboat", "boat"),
- LEATHER(ItemID.LEATHER, "Leather", "leather", "cowhide"),
- MILK_BUCKET(ItemID.MILK_BUCKET, "Milk bucket", "milkbucket", "milk", "milkbukkit"),
- BRICK_BAR(ItemID.BRICK_BAR, "Brick", "brickbar"),
- CLAY_BALL(ItemID.CLAY_BALL, "Clay", "clay"),
- SUGAR_CANE_ITEM(ItemID.SUGAR_CANE_ITEM, "Sugar cane", "sugarcane", "reed", "reeds"),
- PAPER(ItemID.PAPER, "Paper", "paper"),
- BOOK(ItemID.BOOK, "Book", "book"),
- SLIME_BALL(ItemID.SLIME_BALL, "Slime ball", "slimeball", "slime"),
- STORAGE_MINECART(ItemID.STORAGE_MINECART, "Storage minecart", "storageminecart", "storagecart"),
- POWERED_MINECART(ItemID.POWERED_MINECART, "Powered minecart", "poweredminecart", "poweredcart"),
- EGG(ItemID.EGG, "Egg", "egg"),
- COMPASS(ItemID.COMPASS, "Compass", "compass"),
- FISHING_ROD(ItemID.FISHING_ROD, "Fishing rod", "fishingrod", "fishingpole"),
- WATCH(ItemID.WATCH, "Watch", "watch", "clock", "timer"),
- LIGHTSTONE_DUST(ItemID.LIGHTSTONE_DUST, "Glowstone dust", "lightstonedust", "glowstonedone", "brightstonedust", "brittlegolddust", "brimstonedust"),
- RAW_FISH(ItemID.RAW_FISH, "Raw fish", "rawfish", "fish"),
- COOKED_FISH(ItemID.COOKED_FISH, "Cooked fish", "cookedfish"),
- INK_SACK(ItemID.INK_SACK, "Ink sac", "inksac", "ink", "dye", "inksack"),
- BONE(ItemID.BONE, "Bone", "bone"),
- SUGAR(ItemID.SUGAR, "Sugar", "sugar"),
- CAKE_ITEM(ItemID.CAKE_ITEM, "Cake", "cake"),
- BED_ITEM(ItemID.BED_ITEM, "Bed", "bed"),
- REDSTONE_REPEATER(ItemID.REDSTONE_REPEATER, "Redstone repeater", "redstonerepeater", "diode", "delayer", "repeater"),
- COOKIE(ItemID.COOKIE, "Cookie", "cookie"),
- MAP(ItemID.MAP, "Map", "map"),
- SHEARS(ItemID.SHEARS, "Shears", "shears", "scissors"),
- MELON(ItemID.MELON, "Melon Slice", "melon", "melonslice"),
- PUMPKIN_SEEDS(ItemID.PUMPKIN_SEEDS, "Pumpkin seeds", "pumpkinseed", "pumpkinseeds"),
- MELON_SEEDS(ItemID.MELON_SEEDS, "Melon seeds", "melonseed", "melonseeds"),
- RAW_BEEF(ItemID.RAW_BEEF, "Raw beef", "rawbeef", "rawcow", "beef"),
- COOKED_BEEF(ItemID.COOKED_BEEF, "Steak", "steak", "cookedbeef", "cookedcow"),
- RAW_CHICKEN(ItemID.RAW_CHICKEN, "Raw chicken", "rawchicken"),
- COOKED_CHICKEN(ItemID.COOKED_CHICKEN, "Cooked chicken", "cookedchicken", "chicken", "grilledchicken"),
- ROTTEN_FLESH(ItemID.ROTTEN_FLESH, "Rotten flesh", "rottenflesh", "zombiemeat", "flesh"),
- ENDER_PEARL(ItemID.ENDER_PEARL, "Ender pearl", "pearl", "enderpearl"),
- BLAZE_ROD(ItemID.BLAZE_ROD, "Blaze rod", "blazerod"),
- GHAST_TEAR(ItemID.GHAST_TEAR, "Ghast tear", "ghasttear"),
- GOLD_NUGGET(ItemID.GOLD_NUGGET, "Gold nuggest", "goldnugget"),
- NETHER_WART_ITEM(ItemID.NETHER_WART_SEED, "Nether wart", "netherwart", "netherwartseed"),
- POTION(ItemID.POTION, "Potion", "potion"),
- GLASS_BOTTLE(ItemID.GLASS_BOTTLE, "Glass bottle", "glassbottle"),
- SPIDER_EYE(ItemID.SPIDER_EYE, "Spider eye", "spidereye"),
- FERMENTED_SPIDER_EYE(ItemID.FERMENTED_SPIDER_EYE, "Fermented spider eye", "fermentedspidereye", "fermentedeye"),
- BLAZE_POWDER(ItemID.BLAZE_POWDER, "Blaze powder", "blazepowder"),
- MAGMA_CREAM(ItemID.MAGMA_CREAM, "Magma cream", "magmacream"),
- BREWING_STAND_ITEM(ItemID.BREWING_STAND, "Brewing stand", "brewingstand"),
- CAULDRON_ITEM(ItemID.CAULDRON, "Cauldron", "cauldron"),
- EYE_OF_ENDER(ItemID.EYE_OF_ENDER, "Eye of Ender", "eyeofender", "endereye"),
- GLISTERING_MELON(ItemID.GLISTERING_MELON, "Glistering Melon", "glisteringmelon", "goldmelon"),
- SPAWN_EGG(ItemID.SPAWN_EGG, "Spawn Egg", "spawnegg", "spawn", "mobspawnegg"),
- BOTTLE_O_ENCHANTING(ItemID.BOTTLE_O_ENCHANTING, "Bottle o' Enchanting", "expbottle", "bottleoenchanting", "experiencebottle", "exppotion", "experiencepotion"),
- FIRE_CHARGE(ItemID.FIRE_CHARGE, "Fire Charge", "firecharge", "firestarter", "firerock"),
- BOOK_AND_QUILL(ItemID.BOOK_AND_QUILL, "Book and Quill", "bookandquill", "quill", "writingbook"),
- WRITTEN_BOOK(ItemID.WRITTEN_BOOK, "Written Book", "writtenbook"),
- EMERALD(ItemID.EMERALD, "Emerald", "emeraldingot", "emerald"),
- DISC_13(ItemID.DISC_13, "Music Disc - 13", "disc_13"),
- DISC_CAT(ItemID.DISC_CAT, "Music Disc - Cat", "disc_cat"),
- DISC_BLOCKS(ItemID.DISC_BLOCKS, "Music Disc - blocks", "disc_blocks"),
- DISC_CHIRP(ItemID.DISC_CHIRP, "Music Disc - chirp", "disc_chirp"),
- DISC_FAR(ItemID.DISC_FAR, "Music Disc - far", "disc_far"),
- DISC_MALL(ItemID.DISC_MALL, "Music Disc - mall", "disc_mall"),
- DISC_MELLOHI(ItemID.DISC_MELLOHI, "Music Disc - mellohi", "disc_mellohi"),
- DISC_STAL(ItemID.DISC_STAL, "Music Disc - stal", "disc_stal"),
- DISC_STRAD(ItemID.DISC_STRAD, "Music Disc - strad", "disc_strad"),
- DISC_WARD(ItemID.DISC_WARD, "Music Disc - ward", "disc_ward"),
- DISC_11(ItemID.DISC_11, "Music Disc - 11", "disc_11"),
-
- // deprecated
- @Deprecated GOLD_RECORD(ItemID.GOLD_RECORD, "Gold Record", "goldrecord", "golddisc"),
- @Deprecated GREEN_RECORD(ItemID.GREEN_RECORD, "Green Record", "greenrecord", "greenddisc");
-
- /**
- * Stores a map of the IDs for fast access.
- */
- private static final Map ids = new HashMap();
- /**
- * Stores a map of the names for fast access.
- */
- private static final Map lookup = new LinkedHashMap();
-
- private final int id;
- private final String name;
- private final String[] lookupKeys;
-
- static {
- for (ItemType type : EnumSet.allOf(ItemType.class)) {
- ids.put(type.id, type);
- for (String key : type.lookupKeys) {
- lookup.put(key, type);
- }
- }
- }
-
-
- /**
- * Construct the type.
- *
- * @param id
- * @param name
- */
- ItemType(int id, String name, String lookupKey) {
- this.id = id;
- this.name = name;
- this.lookupKeys = new String[] { lookupKey };
- }
-
- /**
- * Construct the type.
- *
- * @param id
- * @param name
- */
- ItemType(int id, String name, String... lookupKeys) {
- this.id = id;
- this.name = name;
- this.lookupKeys = lookupKeys;
- }
-
- /**
- * Return type from ID. May return null.
- *
- * @param id
- * @return
- */
- public static ItemType fromID(int id) {
- return ids.get(id);
- }
-
- /**
- * Get a name for the item.
- *
- * @param id
- * @return
- */
- public static String toName(int id) {
- ItemType type = ids.get(id);
- if (type != null) {
- return type.getName();
- } else {
- return "#" + id;
- }
- }
-
- /**
- * Get a name for a held item.
- *
- * @param id
- * @return
- */
- public static String toHeldName(int id) {
- if (id == 0) {
- return "Hand";
- }
- ItemType type = ids.get(id);
- if (type != null) {
- return type.getName();
- } else {
- return "#" + id;
- }
- }
-
- /**
- * Return type from name. May return null.
- *
- * @param name
- * @return
- */
- public static ItemType lookup(String name) {
- return lookup(name, true);
- }
-
- /**
- * Return type from name. May return null.
- *
- * @param name
- * @param fuzzy
- * @return
- */
- public static ItemType lookup(String name, boolean fuzzy) {
- try {
- return fromID(Integer.parseInt(name));
- } catch (NumberFormatException e) {
- return StringUtil.lookup(lookup, name, fuzzy);
- }
- }
-
- /**
- * Get item numeric ID.
- *
- * @return
- */
- public int getID() {
- return id;
- }
-
- /**
- * Get user-friendly item name.
- *
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get a list of aliases.
- *
- * @return
- */
- public String[] getAliases() {
- return lookupKeys;
- }
-
- private static final Set shouldNotStack = new HashSet();
- static {
- shouldNotStack.add(ItemID.IRON_SHOVEL);
- shouldNotStack.add(ItemID.IRON_PICK);
- shouldNotStack.add(ItemID.IRON_AXE);
- shouldNotStack.add(ItemID.FLINT_AND_TINDER);
- shouldNotStack.add(ItemID.BOW);
- shouldNotStack.add(ItemID.IRON_SWORD);
- shouldNotStack.add(ItemID.WOOD_SWORD);
- shouldNotStack.add(ItemID.WOOD_SHOVEL);
- shouldNotStack.add(ItemID.WOOD_PICKAXE);
- shouldNotStack.add(ItemID.WOOD_AXE);
- shouldNotStack.add(ItemID.STONE_SWORD);
- shouldNotStack.add(ItemID.STONE_SHOVEL);
- shouldNotStack.add(ItemID.STONE_PICKAXE);
- shouldNotStack.add(ItemID.STONE_AXE);
- shouldNotStack.add(ItemID.DIAMOND_SWORD);
- shouldNotStack.add(ItemID.DIAMOND_SHOVEL);
- shouldNotStack.add(ItemID.DIAMOND_PICKAXE);
- shouldNotStack.add(ItemID.DIAMOND_AXE);
- shouldNotStack.add(ItemID.BOWL);
- shouldNotStack.add(ItemID.GOLD_SWORD);
- shouldNotStack.add(ItemID.GOLD_SHOVEL);
- shouldNotStack.add(ItemID.GOLD_PICKAXE);
- shouldNotStack.add(ItemID.GOLD_AXE);
- shouldNotStack.add(ItemID.WOOD_HOE);
- shouldNotStack.add(ItemID.STONE_HOE);
- shouldNotStack.add(ItemID.IRON_HOE);
- shouldNotStack.add(ItemID.DIAMOND_HOE);
- shouldNotStack.add(ItemID.GOLD_HOE);
- shouldNotStack.add(ItemID.LEATHER_HELMET);
- shouldNotStack.add(ItemID.LEATHER_CHEST);
- shouldNotStack.add(ItemID.LEATHER_PANTS);
- shouldNotStack.add(ItemID.LEATHER_BOOTS);
- shouldNotStack.add(ItemID.CHAINMAIL_CHEST);
- shouldNotStack.add(ItemID.CHAINMAIL_HELMET);
- shouldNotStack.add(ItemID.CHAINMAIL_BOOTS);
- shouldNotStack.add(ItemID.CHAINMAIL_PANTS);
- shouldNotStack.add(ItemID.IRON_HELMET);
- shouldNotStack.add(ItemID.IRON_CHEST);
- shouldNotStack.add(ItemID.IRON_PANTS);
- shouldNotStack.add(ItemID.IRON_BOOTS);
- shouldNotStack.add(ItemID.DIAMOND_HELMET);
- shouldNotStack.add(ItemID.DIAMOND_PANTS);
- shouldNotStack.add(ItemID.DIAMOND_CHEST);
- shouldNotStack.add(ItemID.DIAMOND_BOOTS);
- shouldNotStack.add(ItemID.GOLD_HELMET);
- shouldNotStack.add(ItemID.GOLD_CHEST);
- shouldNotStack.add(ItemID.GOLD_PANTS);
- shouldNotStack.add(ItemID.GOLD_BOOTS);
- shouldNotStack.add(ItemID.WOODEN_DOOR_ITEM);
- shouldNotStack.add(ItemID.WATER_BUCKET);
- shouldNotStack.add(ItemID.LAVA_BUCKET);
- shouldNotStack.add(ItemID.MINECART);
- shouldNotStack.add(ItemID.SADDLE);
- shouldNotStack.add(ItemID.IRON_DOOR_ITEM);
- shouldNotStack.add(ItemID.WOOD_BOAT);
- shouldNotStack.add(ItemID.MILK_BUCKET);
- shouldNotStack.add(ItemID.STORAGE_MINECART);
- shouldNotStack.add(ItemID.POWERED_MINECART);
- shouldNotStack.add(ItemID.WATCH);
- shouldNotStack.add(ItemID.CAKE_ITEM);
- shouldNotStack.add(ItemID.BED_ITEM);
- shouldNotStack.add(ItemID.MAP);
- shouldNotStack.add(ItemID.SHEARS);
- shouldNotStack.add(ItemID.DISC_13);
- shouldNotStack.add(ItemID.DISC_CAT);
- shouldNotStack.add(ItemID.DISC_BLOCKS);
- shouldNotStack.add(ItemID.DISC_CHIRP);
- shouldNotStack.add(ItemID.DISC_FAR);
- shouldNotStack.add(ItemID.DISC_MALL);
- shouldNotStack.add(ItemID.DISC_MELLOHI);
- shouldNotStack.add(ItemID.DISC_STAL);
- shouldNotStack.add(ItemID.DISC_STRAD);
- shouldNotStack.add(ItemID.DISC_WARD);
- shouldNotStack.add(ItemID.DISC_11);
- }
-
- /**
- * Returns true if an item should not be stacked.
- *
- * @param id
- * @return
- */
- public static boolean shouldNotStack(int id) {
- return shouldNotStack.contains(id);
- }
-
- private static final Set usesDamageValue = new HashSet();
- static {
- usesDamageValue.add(BlockID.SAPLING);
- //usesDamageValue.add(BlockID.WATER);
- //usesDamageValue.add(BlockID.STATIONARY_WATER);
- //usesDamageValue.add(BlockID.LAVA);
- //usesDamageValue.add(BlockID.STATIONARY_LAVA);
- usesDamageValue.add(BlockID.LOG);
- usesDamageValue.add(BlockID.LEAVES);
- //usesDamageValue.add(BlockID.DISPENSER);
- //usesDamageValue.add(BlockID.BED);
- //usesDamageValue.add(BlockID.POWERED_RAIL);
- //usesDamageValue.add(BlockID.DETECTOR_RAIL);
- //usesDamageValue.add(BlockID.PISTON_STICKY_BASE);
- //usesDamageValue.add(BlockID.LONG_GRASS);
- //usesDamageValue.add(BlockID.PISTON_BASE);
- //usesDamageValue.add(BlockID.PISTON_EXTENSION);
- usesDamageValue.add(BlockID.CLOTH);
- usesDamageValue.add(BlockID.DOUBLE_STEP);
- usesDamageValue.add(BlockID.STEP);
- //usesDamageValue.add(BlockID.TORCH);
- //usesDamageValue.add(BlockID.FIRE);
- //usesDamageValue.add(BlockID.WOODEN_STAIRS);
- //usesDamageValue.add(BlockID.CHEST);
- //usesDamageValue.add(BlockID.REDSTONE_WIRE);
- //usesDamageValue.add(BlockID.CROPS);
- //usesDamageValue.add(BlockID.SOIL);
- //usesDamageValue.add(BlockID.FURNACE);
- //usesDamageValue.add(BlockID.BURNING_FURNACE);
- //usesDamageValue.add(BlockID.SIGN_POST);
- //usesDamageValue.add(BlockID.WOODEN_DOOR);
- //usesDamageValue.add(BlockID.LADDER);
- //usesDamageValue.add(BlockID.MINECART_TRACKS);
- //usesDamageValue.add(BlockID.COBBLESTONE_STAIRS);
- //usesDamageValue.add(BlockID.WALL_SIGN);
- //usesDamageValue.add(BlockID.LEVER);
- //usesDamageValue.add(BlockID.STONE_PRESSURE_PLATE);
- //usesDamageValue.add(BlockID.IRON_DOOR);
- //usesDamageValue.add(BlockID.WOODEN_PRESSURE_PLATE);
- //usesDamageValue.add(BlockID.REDSTONE_TORCH_OFF);
- //usesDamageValue.add(BlockID.REDSTONE_TORCH_ON);
- //usesDamageValue.add(BlockID.STONE_BUTTON);
- //usesDamageValue.add(BlockID.SNOW);
- //usesDamageValue.add(BlockID.CACTUS);
- //usesDamageValue.add(BlockID.REED);
- //usesDamageValue.add(BlockID.JUKEBOX);
- //usesDamageValue.add(BlockID.PUMPKIN);
- //usesDamageValue.add(BlockID.JACKOLANTERN);
- //usesDamageValue.add(BlockID.CAKE_BLOCK);
- //usesDamageValue.add(BlockID.REDSTONE_REPEATER_OFF);
- //usesDamageValue.add(BlockID.REDSTONE_REPEATER_ON);
- //usesDamageValue.add(BlockID.TRAP_DOOR);
- //usesDamageValue.add(BlockID.SILVERFISH_BLOCK);
- usesDamageValue.add(BlockID.STONE_BRICK);
- //usesDamageValue.add(BlockID.RED_MUSHROOM_CAP);
- //usesDamageValue.add(BlockID.BROWN_MUSHROOM_CAP);
- //usesDamageValue.add(BlockID.PUMPKIN_STEM);
- //usesDamageValue.add(BlockID.MELON_STEM);
- //usesDamageValue.add(BlockID.VINE);
- //usesDamageValue.add(BlockID.FENCE_GATE);
- //usesDamageValue.add(BlockID.BRICK_STAIRS);
- //usesDamageValue.add(BlockID.STONE_BRICK_STAIRS);
- //usesDamageValue.add(BlockID.NETHER_BRICK_STAIRS);
- //usesDamageValue.add(BlockID.NETHER_WART);
- //usesDamageValue.add(BlockID.ENCHANTMENT_TABLE);
- //usesDamageValue.add(BlockID.BREWING_STAND);
- //usesDamageValue.add(BlockID.CAULDRON);
- //usesDamageValue.add(BlockID.END_PORTAL_FRAME);
- usesDamageValue.add(ItemID.COAL);
- usesDamageValue.add(ItemID.INK_SACK);
- usesDamageValue.add(ItemID.POTION);
- usesDamageValue.add(ItemID.GLASS_BOTTLE);
- usesDamageValue.add(ItemID.SPAWN_EGG);
- usesDamageValue.add(ItemID.MAP);
- }
-
- /**
- * Returns true if an item uses its damage value for something
- * other than damage.
- *
- * @param id
- * @return
- */
- public static boolean usesDamageValue(int id) {
- return usesDamageValue.contains(id);
- }
-}
+// $Id$
+/*
+ * WorldEdit
+ * Copyright (C) 2010 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+*/
+
+package com.sk89q.worldedit.blocks;
+
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumSet;
+import java.util.Set;
+
+import com.sk89q.util.StringUtil;
+
+/**
+ * ItemType types.
+ *
+ * @author sk89q
+ */
+public enum ItemType {
+ // Blocks
+ AIR(BlockID.AIR, "Air", "air"),
+ STONE(BlockID.STONE, "Stone", "stone", "rock"),
+ GRASS(BlockID.GRASS, "Grass", "grass"),
+ DIRT(BlockID.DIRT, "Dirt", "dirt"),
+ COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"),
+ WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
+ SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"),
+ BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"),
+ WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
+ STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
+ LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
+ STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
+ SAND(BlockID.SAND, "Sand", "sand"),
+ GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"),
+ GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"),
+ IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"),
+ COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"),
+ LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
+ LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"),
+ SPONGE(BlockID.SPONGE, "Sponge", "sponge"),
+ GLASS(BlockID.GLASS, "Glass", "glass"),
+ LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
+ LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
+ DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"),
+ SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"),
+ NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
+ BED(BlockID.BED, "Bed", "bed"),
+ POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
+ DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"),
+ PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"),
+ WEB(BlockID.WEB, "Web", "web", "spiderweb"),
+ LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"),
+ DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
+ PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"),
+ PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"),
+ CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"),
+ PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"),
+ YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"),
+ RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"),
+ BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"),
+ RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"),
+ GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"),
+ IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"),
+ DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
+ STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"),
+ BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"),
+ TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"),
+ BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
+ MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
+ OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"),
+ TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"),
+ FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"),
+ MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"),
+ WOODEN_STAIRS(BlockID.WOODEN_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
+ CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"),
+ REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"),
+ DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"),
+ DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"),
+ WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"),
+ CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"),
+ SOIL(BlockID.SOIL, "Soil", "soil", "farmland"),
+ FURNACE(BlockID.FURNACE, "Furnace", "furnace"),
+ BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"),
+ SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"),
+ WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"),
+ LADDER(BlockID.LADDER, "Ladder", "ladder"),
+ MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
+ COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
+ WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"),
+ LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
+ STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"),
+ IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"),
+ WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
+ REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"),
+ GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"),
+ REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
+ REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
+ STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"),
+ SNOW(BlockID.SNOW, "Snow", "snow"),
+ ICE(BlockID.ICE, "Ice", "ice"),
+ SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"),
+ CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"),
+ CLAY(BlockID.CLAY, "Clay", "clay"),
+ SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
+ JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"),
+ FENCE(BlockID.FENCE, "Fence", "fence"),
+ PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"),
+ NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
+ SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
+ GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
+ PORTAL(BlockID.PORTAL, "Portal", "portal"),
+ JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
+ CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"),
+ REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"),
+ REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
+ LOCKED_CHEST(BlockID.LOCKED_CHEST, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
+ TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"),
+ SILVERFISH_BLOCK(BlockID.SILVERFISH_BLOCK, "Silverfish block", "silverfish", "silver"),
+ STONE_BRICK(BlockID.STONE_BRICK, "Stone brick", "stonebrick", "sbrick", "smoothstonebrick"),
+ RED_MUSHROOM_CAP(BlockID.RED_MUSHROOM_CAP, "Red mushroom cap", "giantmushroomred", "redgiantmushroom", "redmushroomcap"),
+ BROWN_MUSHROOM_CAP(BlockID.BROWN_MUSHROOM_CAP, "Brown mushroom cap", "giantmushroombrown", "browngiantmushoom", "brownmushroomcap"),
+ IRON_BARS(BlockID.IRON_BARS, "Iron bars", "ironbars", "ironfence"),
+ GLASS_PANE(BlockID.GLASS_PANE, "Glass pane", "window", "glasspane", "glasswindow"),
+ MELON_BLOCK(BlockID.MELON_BLOCK, "Melon (block)", "melonblock"),
+ PUMPKIN_STEM(BlockID.PUMPKIN_STEM, "Pumpkin stem", "pumpkinstem"),
+ MELON_STEM(BlockID.MELON_STEM, "Melon stem", "melonstem"),
+ VINE(BlockID.VINE, "Vine", "vine", "vines", "creepers"),
+ FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"),
+ BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"),
+ STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"),
+ MYCELIUM(BlockID.MYCELIUM, "Mycelium", "fungus", "mycel"),
+ LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"),
+ NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"),
+ NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"),
+ NETHER_BRICK_STAIRS(BlockID.NETHER_BRICK_STAIRS, "Nether brick stairs", "netherbrickstairs", "netherbricksteps", "netherstairs", "nethersteps"),
+ NETHER_WART(BlockID.NETHER_WART, "Nether wart", "netherwart", "netherstalk"),
+ ENCHANTMENT_TABLE(BlockID.ENCHANTMENT_TABLE, "Enchantment table", "enchantmenttable", "enchanttable"),
+ BREWING_STAND(BlockID.BREWING_STAND, "Brewing Stand", "brewingstand"),
+ CAULDRON(BlockID.CAULDRON, "Cauldron"),
+ END_PORTAL(BlockID.END_PORTAL, "End Portal", "endportal", "blackstuff", "airportal", "weirdblackstuff"),
+ END_PORTAL_FRAME(BlockID.END_PORTAL_FRAME, "End Portal Frame", "endportalframe", "airportalframe", "crystalblock"),
+ END_STONE(BlockID.END_STONE, "End Stone", "endstone", "enderstone", "endersand"),
+ DRAGON_EGG(BlockID.DRAGON_EGG, "Dragon Egg", "dragonegg", "dragons"),
+ REDSTONE_LAMP_OFF(BlockID.REDSTONE_LAMP_OFF, "Redstone lamp (off)", "redstonelamp", "redstonelampoff", "rslamp", "rslampoff", "rsglow", "rsglowoff"),
+ REDSTONE_LAMP_ON(BlockID.REDSTONE_LAMP_ON, "Redstone lamp (on)", "redstonelampon", "rslampon", "rsglowon"),
+ DOUBLE_WOODEN_STEP(BlockID.DOUBLE_WOODEN_STEP, "Double wood step", "doublewoodslab", "doublewoodstep"),
+ WOODEN_STEP(BlockID.WOODEN_STEP, "Wood step", "woodenslab", "woodslab", "woodstep", "woodhalfstep"),
+ COCOA_PLANT(BlockID.COCOA_PLANT, "Cocoa plant", "cocoplant", "cocoaplant"),
+ SANDSTONE_STAIRS(BlockID.SANDSTONE_STAIRS, "Sandstone stairs", "sandstairs", "sandstonestairs"),
+ EMERALD_ORE(BlockID.EMERALD_ORE, "Emerald ore", "emeraldore"),
+ ENDER_CHEST(BlockID.ENDER_CHEST, "Ender chest", "enderchest"),
+ TRIPWIRE_HOOK(BlockID.TRIPWIRE_HOOK, "Tripwire hook", "tripwirehook"),
+ TRIPWIRE(BlockID.TRIPWIRE, "Tripwire", "tripwire", "string"),
+ EMERALD_BLOCK(BlockID.EMERALD_BLOCK, "Emerald block", "emeraldblock", "emerald"),
+ SPRUCE_WOOD_STAIRS(BlockID.SPRUCE_WOOD_STAIRS, "Spruce wood stairs", "sprucestairs", "sprucewoodstairs"),
+ BIRCH_WOOD_STAIRS(BlockID.BIRCH_WOOD_STAIRS, "Birch wood stairs", "birchstairs", "birchwoodstairs"),
+ JUNGLE_WOOD_STAIRS(BlockID.JUNGLE_WOOD_STAIRS, "Jungle wood stairs", "junglestairs", "junglewoodstairs"),
+
+ // Items
+ IRON_SHOVEL(ItemID.IRON_SHOVEL, "Iron shovel", "ironshovel"),
+ IRON_PICK(ItemID.IRON_PICK, "Iron pick", "ironpick", "ironpickaxe"),
+ IRON_AXE(ItemID.IRON_AXE, "Iron axe", "ironaxe"),
+ FLINT_AND_TINDER(ItemID.FLINT_AND_TINDER, "Flint and tinder", "flintandtinder", "lighter", "flintandsteel", "flintsteel", "flintandiron", "flintnsteel", "flintniron", "flintntinder"),
+ RED_APPLE(ItemID.RED_APPLE, "Red apple", "redapple", "apple"),
+ BOW(ItemID.BOW, "Bow", "bow"),
+ ARROW(ItemID.ARROW, "Arrow", "arrow"),
+ COAL(ItemID.COAL, "Coal", "coal"),
+ DIAMOND(ItemID.DIAMOND, "Diamond", "diamond"),
+ IRON_BAR(ItemID.IRON_BAR, "Iron bar", "ironbar", "iron"),
+ GOLD_BAR(ItemID.GOLD_BAR, "Gold bar", "goldbar", "gold"),
+ IRON_SWORD(ItemID.IRON_SWORD, "Iron sword", "ironsword"),
+ WOOD_SWORD(ItemID.WOOD_SWORD, "Wooden sword", "woodsword"),
+ WOOD_SHOVEL(ItemID.WOOD_SHOVEL, "Wooden shovel", "woodshovel"),
+ WOOD_PICKAXE(ItemID.WOOD_PICKAXE, "Wooden pickaxe", "woodpick", "woodpickaxe"),
+ WOOD_AXE(ItemID.WOOD_AXE, "Wooden axe", "woodaxe"),
+ STONE_SWORD(ItemID.STONE_SWORD, "Stone sword", "stonesword"),
+ STONE_SHOVEL(ItemID.STONE_SHOVEL, "Stone shovel", "stoneshovel"),
+ STONE_PICKAXE(ItemID.STONE_PICKAXE, "Stone pickaxe", "stonepick", "stonepickaxe"),
+ STONE_AXE(ItemID.STONE_AXE, "Stone pickaxe", "stoneaxe"),
+ DIAMOND_SWORD(ItemID.DIAMOND_SWORD, "Diamond sword", "diamondsword"),
+ DIAMOND_SHOVEL(ItemID.DIAMOND_SHOVEL, "Diamond shovel", "diamondshovel"),
+ DIAMOND_PICKAXE(ItemID.DIAMOND_PICKAXE, "Diamond pickaxe", "diamondpick", "diamondpickaxe"),
+ DIAMOND_AXE(ItemID.DIAMOND_AXE, "Diamond axe", "diamondaxe"),
+ STICK(ItemID.STICK, "Stick", "stick"),
+ BOWL(ItemID.BOWL, "Bowl", "bowl"),
+ MUSHROOM_SOUP(ItemID.MUSHROOM_SOUP, "Mushroom soup", "mushroomsoup", "soup", "brbsoup"),
+ GOLD_SWORD(ItemID.GOLD_SWORD, "Golden sword", "goldsword"),
+ GOLD_SHOVEL(ItemID.GOLD_SHOVEL, "Golden shovel", "goldshovel"),
+ GOLD_PICKAXE(ItemID.GOLD_PICKAXE, "Golden pickaxe", "goldpick", "goldpickaxe"),
+ GOLD_AXE(ItemID.GOLD_AXE, "Golden axe", "goldaxe"),
+ STRING(ItemID.STRING, "String", "string"),
+ FEATHER(ItemID.FEATHER, "Feather", "feather"),
+ SULPHUR(ItemID.SULPHUR, "Sulphur", "sulphur", "sulfur", "gunpowder"),
+ WOOD_HOE(ItemID.WOOD_HOE, "Wooden hoe", "woodhoe"),
+ STONE_HOE(ItemID.STONE_HOE, "Stone hoe", "stonehoe"),
+ IRON_HOE(ItemID.IRON_HOE, "Iron hoe", "ironhoe"),
+ DIAMOND_HOE(ItemID.DIAMOND_HOE, "Diamond hoe", "diamondhoe"),
+ GOLD_HOE(ItemID.GOLD_HOE, "Golden hoe", "goldhoe"),
+ SEEDS(ItemID.SEEDS, "Seeds", "seeds", "seed"),
+ WHEAT(ItemID.WHEAT, "Wheat", "wheat"),
+ BREAD(ItemID.BREAD, "Bread", "bread"),
+ LEATHER_HELMET(ItemID.LEATHER_HELMET, "Leather helmet", "leatherhelmet", "leatherhat"),
+ LEATHER_CHEST(ItemID.LEATHER_CHEST, "Leather chestplate", "leatherchest", "leatherchestplate", "leathervest", "leatherbreastplate", "leatherplate", "leathercplate", "leatherbody"),
+ LEATHER_PANTS(ItemID.LEATHER_PANTS, "Leather pants", "leatherpants", "leathergreaves", "leatherlegs", "leatherleggings", "leatherstockings", "leatherbreeches"),
+ LEATHER_BOOTS(ItemID.LEATHER_BOOTS, "Leather boots", "leatherboots", "leathershoes", "leatherfoot", "leatherfeet"),
+ CHAINMAIL_HELMET(ItemID.CHAINMAIL_HELMET, "Chainmail helmet", "chainmailhelmet", "chainmailhat"),
+ CHAINMAIL_CHEST(ItemID.CHAINMAIL_CHEST, "Chainmail chestplate", "chainmailchest", "chainmailchestplate", "chainmailvest", "chainmailbreastplate", "chainmailplate", "chainmailcplate", "chainmailbody"),
+ CHAINMAIL_PANTS(ItemID.CHAINMAIL_PANTS, "Chainmail pants", "chainmailpants", "chainmailgreaves", "chainmaillegs", "chainmailleggings", "chainmailstockings", "chainmailbreeches"),
+ CHAINMAIL_BOOTS(ItemID.CHAINMAIL_BOOTS, "Chainmail boots", "chainmailboots", "chainmailshoes", "chainmailfoot", "chainmailfeet"),
+ IRON_HELMET(ItemID.IRON_HELMET, "Iron helmet", "ironhelmet", "ironhat"),
+ IRON_CHEST(ItemID.IRON_CHEST, "Iron chestplate", "ironchest", "ironchestplate", "ironvest", "ironbreastplate", "ironplate", "ironcplate", "ironbody"),
+ IRON_PANTS(ItemID.IRON_PANTS, "Iron pants", "ironpants", "irongreaves", "ironlegs", "ironleggings", "ironstockings", "ironbreeches"),
+ IRON_BOOTS(ItemID.IRON_BOOTS, "Iron boots", "ironboots", "ironshoes", "ironfoot", "ironfeet"),
+ DIAMOND_HELMET(ItemID.DIAMOND_HELMET, "Diamond helmet", "diamondhelmet", "diamondhat"),
+ DIAMOND_CHEST(ItemID.DIAMOND_CHEST, "Diamond chestplate", "diamondchest", "diamondchestplate", "diamondvest", "diamondbreastplate", "diamondplate", "diamondcplate", "diamondbody"),
+ DIAMOND_PANTS(ItemID.DIAMOND_PANTS, "Diamond pants", "diamondpants", "diamondgreaves", "diamondlegs", "diamondleggings", "diamondstockings", "diamondbreeches"),
+ DIAMOND_BOOTS(ItemID.DIAMOND_BOOTS, "Diamond boots", "diamondboots", "diamondshoes", "diamondfoot", "diamondfeet"),
+ GOLD_HELMET(ItemID.GOLD_HELMET, "Gold helmet", "goldhelmet", "goldhat"),
+ GOLD_CHEST(ItemID.GOLD_CHEST, "Gold chestplate", "goldchest", "goldchestplate", "goldvest", "goldbreastplate", "goldplate", "goldcplate", "goldbody"),
+ GOLD_PANTS(ItemID.GOLD_PANTS, "Gold pants", "goldpants", "goldgreaves", "goldlegs", "goldleggings", "goldstockings", "goldbreeches"),
+ GOLD_BOOTS(ItemID.GOLD_BOOTS, "Gold boots", "goldboots", "goldshoes", "goldfoot", "goldfeet"),
+ FLINT(ItemID.FLINT, "Flint", "flint"),
+ RAW_PORKCHOP(ItemID.RAW_PORKCHOP, "Raw porkchop", "rawpork", "rawporkchop", "rawbacon", "baconstrips", "rawmeat"),
+ COOKED_PORKCHOP(ItemID.COOKED_PORKCHOP, "Cooked porkchop", "pork", "cookedpork", "cookedporkchop", "cookedbacon", "bacon", "meat"),
+ PAINTING(ItemID.PAINTING, "Painting", "painting"),
+ GOLD_APPLE(ItemID.GOLD_APPLE, "Golden apple", "goldapple", "goldenapple"),
+ SIGN(ItemID.SIGN, "Wooden sign", "sign"),
+ WOODEN_DOOR_ITEM(ItemID.WOODEN_DOOR_ITEM, "Wooden door", "wooddoor", "door"),
+ BUCKET(ItemID.BUCKET, "Bucket", "bucket", "bukkit"),
+ WATER_BUCKET(ItemID.WATER_BUCKET, "Water bucket", "waterbucket", "waterbukkit"),
+ LAVA_BUCKET(ItemID.LAVA_BUCKET, "Lava bucket", "lavabucket", "lavabukkit"),
+ MINECART(ItemID.MINECART, "Minecart", "minecart", "cart"),
+ SADDLE(ItemID.SADDLE, "Saddle", "saddle"),
+ IRON_DOOR_ITEM(ItemID.IRON_DOOR_ITEM, "Iron door", "irondoor"),
+ REDSTONE_DUST(ItemID.REDSTONE_DUST, "Redstone dust", "redstonedust", "reddust", "redstone", "dust", "wire"),
+ SNOWBALL(ItemID.SNOWBALL, "Snowball", "snowball"),
+ WOOD_BOAT(ItemID.WOOD_BOAT, "Wooden boat", "woodboat", "woodenboat", "boat"),
+ LEATHER(ItemID.LEATHER, "Leather", "leather", "cowhide"),
+ MILK_BUCKET(ItemID.MILK_BUCKET, "Milk bucket", "milkbucket", "milk", "milkbukkit"),
+ BRICK_BAR(ItemID.BRICK_BAR, "Brick", "brickbar"),
+ CLAY_BALL(ItemID.CLAY_BALL, "Clay", "clay"),
+ SUGAR_CANE_ITEM(ItemID.SUGAR_CANE_ITEM, "Sugar cane", "sugarcane", "reed", "reeds"),
+ PAPER(ItemID.PAPER, "Paper", "paper"),
+ BOOK(ItemID.BOOK, "Book", "book"),
+ SLIME_BALL(ItemID.SLIME_BALL, "Slime ball", "slimeball", "slime"),
+ STORAGE_MINECART(ItemID.STORAGE_MINECART, "Storage minecart", "storageminecart", "storagecart"),
+ POWERED_MINECART(ItemID.POWERED_MINECART, "Powered minecart", "poweredminecart", "poweredcart"),
+ EGG(ItemID.EGG, "Egg", "egg"),
+ COMPASS(ItemID.COMPASS, "Compass", "compass"),
+ FISHING_ROD(ItemID.FISHING_ROD, "Fishing rod", "fishingrod", "fishingpole"),
+ WATCH(ItemID.WATCH, "Watch", "watch", "clock", "timer"),
+ LIGHTSTONE_DUST(ItemID.LIGHTSTONE_DUST, "Glowstone dust", "lightstonedust", "glowstonedone", "brightstonedust", "brittlegolddust", "brimstonedust"),
+ RAW_FISH(ItemID.RAW_FISH, "Raw fish", "rawfish", "fish"),
+ COOKED_FISH(ItemID.COOKED_FISH, "Cooked fish", "cookedfish"),
+ INK_SACK(ItemID.INK_SACK, "Ink sac", "inksac", "ink", "dye", "inksack"),
+ BONE(ItemID.BONE, "Bone", "bone"),
+ SUGAR(ItemID.SUGAR, "Sugar", "sugar"),
+ CAKE_ITEM(ItemID.CAKE_ITEM, "Cake", "cake"),
+ BED_ITEM(ItemID.BED_ITEM, "Bed", "bed"),
+ REDSTONE_REPEATER(ItemID.REDSTONE_REPEATER, "Redstone repeater", "redstonerepeater", "diode", "delayer", "repeater"),
+ COOKIE(ItemID.COOKIE, "Cookie", "cookie"),
+ MAP(ItemID.MAP, "Map", "map"),
+ SHEARS(ItemID.SHEARS, "Shears", "shears", "scissors"),
+ MELON(ItemID.MELON, "Melon Slice", "melon", "melonslice"),
+ PUMPKIN_SEEDS(ItemID.PUMPKIN_SEEDS, "Pumpkin seeds", "pumpkinseed", "pumpkinseeds"),
+ MELON_SEEDS(ItemID.MELON_SEEDS, "Melon seeds", "melonseed", "melonseeds"),
+ RAW_BEEF(ItemID.RAW_BEEF, "Raw beef", "rawbeef", "rawcow", "beef"),
+ COOKED_BEEF(ItemID.COOKED_BEEF, "Steak", "steak", "cookedbeef", "cookedcow"),
+ RAW_CHICKEN(ItemID.RAW_CHICKEN, "Raw chicken", "rawchicken"),
+ COOKED_CHICKEN(ItemID.COOKED_CHICKEN, "Cooked chicken", "cookedchicken", "chicken", "grilledchicken"),
+ ROTTEN_FLESH(ItemID.ROTTEN_FLESH, "Rotten flesh", "rottenflesh", "zombiemeat", "flesh"),
+ ENDER_PEARL(ItemID.ENDER_PEARL, "Ender pearl", "pearl", "enderpearl"),
+ BLAZE_ROD(ItemID.BLAZE_ROD, "Blaze rod", "blazerod"),
+ GHAST_TEAR(ItemID.GHAST_TEAR, "Ghast tear", "ghasttear"),
+ GOLD_NUGGET(ItemID.GOLD_NUGGET, "Gold nuggest", "goldnugget"),
+ NETHER_WART_ITEM(ItemID.NETHER_WART_SEED, "Nether wart", "netherwart", "netherwartseed"),
+ POTION(ItemID.POTION, "Potion", "potion"),
+ GLASS_BOTTLE(ItemID.GLASS_BOTTLE, "Glass bottle", "glassbottle"),
+ SPIDER_EYE(ItemID.SPIDER_EYE, "Spider eye", "spidereye"),
+ FERMENTED_SPIDER_EYE(ItemID.FERMENTED_SPIDER_EYE, "Fermented spider eye", "fermentedspidereye", "fermentedeye"),
+ BLAZE_POWDER(ItemID.BLAZE_POWDER, "Blaze powder", "blazepowder"),
+ MAGMA_CREAM(ItemID.MAGMA_CREAM, "Magma cream", "magmacream"),
+ BREWING_STAND_ITEM(ItemID.BREWING_STAND, "Brewing stand", "brewingstand"),
+ CAULDRON_ITEM(ItemID.CAULDRON, "Cauldron", "cauldron"),
+ EYE_OF_ENDER(ItemID.EYE_OF_ENDER, "Eye of Ender", "eyeofender", "endereye"),
+ GLISTERING_MELON(ItemID.GLISTERING_MELON, "Glistering Melon", "glisteringmelon", "goldmelon"),
+ SPAWN_EGG(ItemID.SPAWN_EGG, "Spawn Egg", "spawnegg", "spawn", "mobspawnegg"),
+ BOTTLE_O_ENCHANTING(ItemID.BOTTLE_O_ENCHANTING, "Bottle o' Enchanting", "expbottle", "bottleoenchanting", "experiencebottle", "exppotion", "experiencepotion"),
+ FIRE_CHARGE(ItemID.FIRE_CHARGE, "Fire Charge", "firecharge", "firestarter", "firerock"),
+ BOOK_AND_QUILL(ItemID.BOOK_AND_QUILL, "Book and Quill", "bookandquill", "quill", "writingbook"),
+ WRITTEN_BOOK(ItemID.WRITTEN_BOOK, "Written Book", "writtenbook"),
+ EMERALD(ItemID.EMERALD, "Emerald", "emeraldingot", "emerald"),
+ DISC_13(ItemID.DISC_13, "Music Disc - 13", "disc_13"),
+ DISC_CAT(ItemID.DISC_CAT, "Music Disc - Cat", "disc_cat"),
+ DISC_BLOCKS(ItemID.DISC_BLOCKS, "Music Disc - blocks", "disc_blocks"),
+ DISC_CHIRP(ItemID.DISC_CHIRP, "Music Disc - chirp", "disc_chirp"),
+ DISC_FAR(ItemID.DISC_FAR, "Music Disc - far", "disc_far"),
+ DISC_MALL(ItemID.DISC_MALL, "Music Disc - mall", "disc_mall"),
+ DISC_MELLOHI(ItemID.DISC_MELLOHI, "Music Disc - mellohi", "disc_mellohi"),
+ DISC_STAL(ItemID.DISC_STAL, "Music Disc - stal", "disc_stal"),
+ DISC_STRAD(ItemID.DISC_STRAD, "Music Disc - strad", "disc_strad"),
+ DISC_WARD(ItemID.DISC_WARD, "Music Disc - ward", "disc_ward"),
+ DISC_11(ItemID.DISC_11, "Music Disc - 11", "disc_11"),
+
+ // deprecated
+ @Deprecated GOLD_RECORD(ItemID.GOLD_RECORD, "Gold Record", "goldrecord", "golddisc"),
+ @Deprecated GREEN_RECORD(ItemID.GREEN_RECORD, "Green Record", "greenrecord", "greenddisc");
+
+ /**
+ * Stores a map of the IDs for fast access.
+ */
+ private static final Map ids = new HashMap();
+ /**
+ * Stores a map of the names for fast access.
+ */
+ private static final Map lookup = new LinkedHashMap();
+
+ private final int id;
+ private final String name;
+ private final String[] lookupKeys;
+
+ static {
+ for (ItemType type : EnumSet.allOf(ItemType.class)) {
+ ids.put(type.id, type);
+ for (String key : type.lookupKeys) {
+ lookup.put(key, type);
+ }
+ }
+ }
+
+
+ /**
+ * Construct the type.
+ *
+ * @param id
+ * @param name
+ */
+ ItemType(int id, String name, String lookupKey) {
+ this.id = id;
+ this.name = name;
+ this.lookupKeys = new String[] { lookupKey };
+ }
+
+ /**
+ * Construct the type.
+ *
+ * @param id
+ * @param name
+ */
+ ItemType(int id, String name, String... lookupKeys) {
+ this.id = id;
+ this.name = name;
+ this.lookupKeys = lookupKeys;
+ }
+
+ /**
+ * Return type from ID. May return null.
+ *
+ * @param id
+ * @return
+ */
+ public static ItemType fromID(int id) {
+ return ids.get(id);
+ }
+
+ /**
+ * Get a name for the item.
+ *
+ * @param id
+ * @return
+ */
+ public static String toName(int id) {
+ ItemType type = ids.get(id);
+ if (type != null) {
+ return type.getName();
+ } else {
+ return "#" + id;
+ }
+ }
+
+ /**
+ * Get a name for a held item.
+ *
+ * @param id
+ * @return
+ */
+ public static String toHeldName(int id) {
+ if (id == 0) {
+ return "Hand";
+ }
+ ItemType type = ids.get(id);
+ if (type != null) {
+ return type.getName();
+ } else {
+ return "#" + id;
+ }
+ }
+
+ /**
+ * Return type from name. May return null.
+ *
+ * @param name
+ * @return
+ */
+ public static ItemType lookup(String name) {
+ return lookup(name, true);
+ }
+
+ /**
+ * Return type from name. May return null.
+ *
+ * @param name
+ * @param fuzzy
+ * @return
+ */
+ public static ItemType lookup(String name, boolean fuzzy) {
+ try {
+ return fromID(Integer.parseInt(name));
+ } catch (NumberFormatException e) {
+ return StringUtil.lookup(lookup, name, fuzzy);
+ }
+ }
+
+ /**
+ * Get item numeric ID.
+ *
+ * @return
+ */
+ public int getID() {
+ return id;
+ }
+
+ /**
+ * Get user-friendly item name.
+ *
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get a list of aliases.
+ *
+ * @return
+ */
+ public String[] getAliases() {
+ return lookupKeys;
+ }
+
+ private static final Set shouldNotStack = new HashSet();
+ static {
+ shouldNotStack.add(ItemID.IRON_SHOVEL);
+ shouldNotStack.add(ItemID.IRON_PICK);
+ shouldNotStack.add(ItemID.IRON_AXE);
+ shouldNotStack.add(ItemID.FLINT_AND_TINDER);
+ shouldNotStack.add(ItemID.BOW);
+ shouldNotStack.add(ItemID.IRON_SWORD);
+ shouldNotStack.add(ItemID.WOOD_SWORD);
+ shouldNotStack.add(ItemID.WOOD_SHOVEL);
+ shouldNotStack.add(ItemID.WOOD_PICKAXE);
+ shouldNotStack.add(ItemID.WOOD_AXE);
+ shouldNotStack.add(ItemID.STONE_SWORD);
+ shouldNotStack.add(ItemID.STONE_SHOVEL);
+ shouldNotStack.add(ItemID.STONE_PICKAXE);
+ shouldNotStack.add(ItemID.STONE_AXE);
+ shouldNotStack.add(ItemID.DIAMOND_SWORD);
+ shouldNotStack.add(ItemID.DIAMOND_SHOVEL);
+ shouldNotStack.add(ItemID.DIAMOND_PICKAXE);
+ shouldNotStack.add(ItemID.DIAMOND_AXE);
+ shouldNotStack.add(ItemID.BOWL);
+ shouldNotStack.add(ItemID.GOLD_SWORD);
+ shouldNotStack.add(ItemID.GOLD_SHOVEL);
+ shouldNotStack.add(ItemID.GOLD_PICKAXE);
+ shouldNotStack.add(ItemID.GOLD_AXE);
+ shouldNotStack.add(ItemID.WOOD_HOE);
+ shouldNotStack.add(ItemID.STONE_HOE);
+ shouldNotStack.add(ItemID.IRON_HOE);
+ shouldNotStack.add(ItemID.DIAMOND_HOE);
+ shouldNotStack.add(ItemID.GOLD_HOE);
+ shouldNotStack.add(ItemID.LEATHER_HELMET);
+ shouldNotStack.add(ItemID.LEATHER_CHEST);
+ shouldNotStack.add(ItemID.LEATHER_PANTS);
+ shouldNotStack.add(ItemID.LEATHER_BOOTS);
+ shouldNotStack.add(ItemID.CHAINMAIL_CHEST);
+ shouldNotStack.add(ItemID.CHAINMAIL_HELMET);
+ shouldNotStack.add(ItemID.CHAINMAIL_BOOTS);
+ shouldNotStack.add(ItemID.CHAINMAIL_PANTS);
+ shouldNotStack.add(ItemID.IRON_HELMET);
+ shouldNotStack.add(ItemID.IRON_CHEST);
+ shouldNotStack.add(ItemID.IRON_PANTS);
+ shouldNotStack.add(ItemID.IRON_BOOTS);
+ shouldNotStack.add(ItemID.DIAMOND_HELMET);
+ shouldNotStack.add(ItemID.DIAMOND_PANTS);
+ shouldNotStack.add(ItemID.DIAMOND_CHEST);
+ shouldNotStack.add(ItemID.DIAMOND_BOOTS);
+ shouldNotStack.add(ItemID.GOLD_HELMET);
+ shouldNotStack.add(ItemID.GOLD_CHEST);
+ shouldNotStack.add(ItemID.GOLD_PANTS);
+ shouldNotStack.add(ItemID.GOLD_BOOTS);
+ shouldNotStack.add(ItemID.WOODEN_DOOR_ITEM);
+ shouldNotStack.add(ItemID.WATER_BUCKET);
+ shouldNotStack.add(ItemID.LAVA_BUCKET);
+ shouldNotStack.add(ItemID.MINECART);
+ shouldNotStack.add(ItemID.SADDLE);
+ shouldNotStack.add(ItemID.IRON_DOOR_ITEM);
+ shouldNotStack.add(ItemID.WOOD_BOAT);
+ shouldNotStack.add(ItemID.MILK_BUCKET);
+ shouldNotStack.add(ItemID.STORAGE_MINECART);
+ shouldNotStack.add(ItemID.POWERED_MINECART);
+ shouldNotStack.add(ItemID.WATCH);
+ shouldNotStack.add(ItemID.CAKE_ITEM);
+ shouldNotStack.add(ItemID.BED_ITEM);
+ shouldNotStack.add(ItemID.MAP);
+ shouldNotStack.add(ItemID.SHEARS);
+ shouldNotStack.add(ItemID.DISC_13);
+ shouldNotStack.add(ItemID.DISC_CAT);
+ shouldNotStack.add(ItemID.DISC_BLOCKS);
+ shouldNotStack.add(ItemID.DISC_CHIRP);
+ shouldNotStack.add(ItemID.DISC_FAR);
+ shouldNotStack.add(ItemID.DISC_MALL);
+ shouldNotStack.add(ItemID.DISC_MELLOHI);
+ shouldNotStack.add(ItemID.DISC_STAL);
+ shouldNotStack.add(ItemID.DISC_STRAD);
+ shouldNotStack.add(ItemID.DISC_WARD);
+ shouldNotStack.add(ItemID.DISC_11);
+ }
+
+ /**
+ * Returns true if an item should not be stacked.
+ *
+ * @param id
+ * @return
+ */
+ public static boolean shouldNotStack(int id) {
+ return shouldNotStack.contains(id);
+ }
+
+ private static final Set usesDamageValue = new HashSet();
+ static {
+ usesDamageValue.add(BlockID.SAPLING);
+ //usesDamageValue.add(BlockID.WATER);
+ //usesDamageValue.add(BlockID.STATIONARY_WATER);
+ //usesDamageValue.add(BlockID.LAVA);
+ //usesDamageValue.add(BlockID.STATIONARY_LAVA);
+ usesDamageValue.add(BlockID.LOG);
+ usesDamageValue.add(BlockID.LEAVES);
+ //usesDamageValue.add(BlockID.DISPENSER);
+ //usesDamageValue.add(BlockID.BED);
+ //usesDamageValue.add(BlockID.POWERED_RAIL);
+ //usesDamageValue.add(BlockID.DETECTOR_RAIL);
+ //usesDamageValue.add(BlockID.PISTON_STICKY_BASE);
+ //usesDamageValue.add(BlockID.LONG_GRASS);
+ //usesDamageValue.add(BlockID.PISTON_BASE);
+ //usesDamageValue.add(BlockID.PISTON_EXTENSION);
+ usesDamageValue.add(BlockID.CLOTH);
+ usesDamageValue.add(BlockID.DOUBLE_STEP);
+ usesDamageValue.add(BlockID.STEP);
+ //usesDamageValue.add(BlockID.TORCH);
+ //usesDamageValue.add(BlockID.FIRE);
+ //usesDamageValue.add(BlockID.WOODEN_STAIRS);
+ //usesDamageValue.add(BlockID.CHEST);
+ //usesDamageValue.add(BlockID.REDSTONE_WIRE);
+ //usesDamageValue.add(BlockID.CROPS);
+ //usesDamageValue.add(BlockID.SOIL);
+ //usesDamageValue.add(BlockID.FURNACE);
+ //usesDamageValue.add(BlockID.BURNING_FURNACE);
+ //usesDamageValue.add(BlockID.SIGN_POST);
+ //usesDamageValue.add(BlockID.WOODEN_DOOR);
+ //usesDamageValue.add(BlockID.LADDER);
+ //usesDamageValue.add(BlockID.MINECART_TRACKS);
+ //usesDamageValue.add(BlockID.COBBLESTONE_STAIRS);
+ //usesDamageValue.add(BlockID.WALL_SIGN);
+ //usesDamageValue.add(BlockID.LEVER);
+ //usesDamageValue.add(BlockID.STONE_PRESSURE_PLATE);
+ //usesDamageValue.add(BlockID.IRON_DOOR);
+ //usesDamageValue.add(BlockID.WOODEN_PRESSURE_PLATE);
+ //usesDamageValue.add(BlockID.REDSTONE_TORCH_OFF);
+ //usesDamageValue.add(BlockID.REDSTONE_TORCH_ON);
+ //usesDamageValue.add(BlockID.STONE_BUTTON);
+ //usesDamageValue.add(BlockID.SNOW);
+ //usesDamageValue.add(BlockID.CACTUS);
+ //usesDamageValue.add(BlockID.REED);
+ //usesDamageValue.add(BlockID.JUKEBOX);
+ //usesDamageValue.add(BlockID.PUMPKIN);
+ //usesDamageValue.add(BlockID.JACKOLANTERN);
+ //usesDamageValue.add(BlockID.CAKE_BLOCK);
+ //usesDamageValue.add(BlockID.REDSTONE_REPEATER_OFF);
+ //usesDamageValue.add(BlockID.REDSTONE_REPEATER_ON);
+ //usesDamageValue.add(BlockID.TRAP_DOOR);
+ //usesDamageValue.add(BlockID.SILVERFISH_BLOCK);
+ usesDamageValue.add(BlockID.STONE_BRICK);
+ //usesDamageValue.add(BlockID.RED_MUSHROOM_CAP);
+ //usesDamageValue.add(BlockID.BROWN_MUSHROOM_CAP);
+ //usesDamageValue.add(BlockID.PUMPKIN_STEM);
+ //usesDamageValue.add(BlockID.MELON_STEM);
+ //usesDamageValue.add(BlockID.VINE);
+ //usesDamageValue.add(BlockID.FENCE_GATE);
+ //usesDamageValue.add(BlockID.BRICK_STAIRS);
+ //usesDamageValue.add(BlockID.STONE_BRICK_STAIRS);
+ //usesDamageValue.add(BlockID.NETHER_BRICK_STAIRS);
+ //usesDamageValue.add(BlockID.NETHER_WART);
+ //usesDamageValue.add(BlockID.ENCHANTMENT_TABLE);
+ //usesDamageValue.add(BlockID.BREWING_STAND);
+ //usesDamageValue.add(BlockID.CAULDRON);
+ //usesDamageValue.add(BlockID.END_PORTAL_FRAME);
+ usesDamageValue.add(ItemID.COAL);
+ usesDamageValue.add(ItemID.INK_SACK);
+ usesDamageValue.add(ItemID.POTION);
+ usesDamageValue.add(ItemID.GLASS_BOTTLE);
+ usesDamageValue.add(ItemID.SPAWN_EGG);
+ usesDamageValue.add(ItemID.MAP);
+ }
+
+ /**
+ * Returns true if an item uses its damage value for something
+ * other than damage.
+ *
+ * @param id
+ * @return
+ */
+ public static boolean usesDamageValue(int id) {
+ return usesDamageValue.contains(id);
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/SessionTimer.java b/src/spout/java/com/sk89q/worldedit/spout/SessionTimer.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/spout/SessionTimer.java
rename to src/spout/java/com/sk89q/worldedit/spout/SessionTimer.java
index 6a4d7a41e..f08556d13 100644
--- a/src/main/java/com/sk89q/worldedit/spout/SessionTimer.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/SessionTimer.java
@@ -1,54 +1,54 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.worldedit.SessionCheck;
-import com.sk89q.worldedit.WorldEdit;
-import org.spout.api.Engine;
-import org.spout.api.Server;
-import org.spout.api.entity.Player;
-
-/**
- * Used to remove expired sessions in Bukkit.
- *
- * @author sk89q
- */
-public class SessionTimer implements Runnable {
-
- private WorldEdit worldEdit;
- private SessionCheck checker;
-
- public SessionTimer(WorldEdit worldEdit, final Server game) {
- this.worldEdit = worldEdit;
- this.checker = new SessionCheck() {
- public boolean isOnlinePlayer(String name) {
- Player player = game.getPlayer(name, true);
- return player != null && player.isOnline();
- }
- };
- }
-
- public void run() {
- worldEdit.flushExpiredSessions(checker);
- }
-
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.worldedit.SessionCheck;
+import com.sk89q.worldedit.WorldEdit;
+import org.spout.api.Engine;
+import org.spout.api.Server;
+import org.spout.api.entity.Player;
+
+/**
+ * Used to remove expired sessions in Bukkit.
+ *
+ * @author sk89q
+ */
+public class SessionTimer implements Runnable {
+
+ private WorldEdit worldEdit;
+ private SessionCheck checker;
+
+ public SessionTimer(WorldEdit worldEdit, final Server game) {
+ this.worldEdit = worldEdit;
+ this.checker = new SessionCheck() {
+ public boolean isOnlinePlayer(String name) {
+ Player player = game.getPlayer(name, true);
+ return player != null && player.isOnline();
+ }
+ };
+ }
+
+ public void run() {
+ worldEdit.flushExpiredSessions(checker);
+ }
+
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeType.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutBiomeType.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutBiomeType.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutBiomeType.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutCommandSender.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutCommandSender.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutCommandSender.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutCommandSender.java
index 908939e5e..899618062 100644
--- a/src/main/java/com/sk89q/worldedit/spout/SpoutCommandSender.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/SpoutCommandSender.java
@@ -1,126 +1,126 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.worldedit.LocalPlayer;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.PlayerNeededException;
-import com.sk89q.worldedit.ServerInterface;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.WorldVector;
-import com.sk89q.worldedit.bags.BlockBag;
-import org.spout.api.chat.style.ChatStyle;
-import org.spout.api.command.CommandSource;
-import org.spout.api.entity.Player;
-
-public class SpoutCommandSender extends LocalPlayer {
- private CommandSource sender;
- @SuppressWarnings("unused")
- private WorldEditPlugin plugin;
-
- public SpoutCommandSender(WorldEditPlugin plugin, ServerInterface server, CommandSource sender) {
- super(server);
- this.plugin = plugin;
- this.sender = sender;
- }
-
- @Override
- public String getName() {
- return sender.getName();
- }
-
- @Override
- public void printRaw(String msg) {
- sender.sendRawMessage(msg);
- }
-
- @Override
- public void printDebug(String msg) {
- sender.sendMessage(ChatStyle.GRAY, msg);
-
- }
-
- @Override
- public void print(String msg) {
- sender.sendMessage(ChatStyle.PURPLE, msg);
- }
-
- @Override
- public void printError(String msg) {
- sender.sendMessage(ChatStyle.RED, msg);
- }
-
- @Override
- public String[] getGroups() {
- return sender.getGroups();
- }
-
- @Override
- public boolean hasPermission(String perm) {
- return sender.hasPermission(perm);
- }
-
- @Override
- public boolean isPlayer() {
- return sender instanceof Player;
- }
-
- @Override
- public int getItemInHand() {
- throw new PlayerNeededException();
- }
-
- @Override
- public WorldVector getPosition() {
- throw new PlayerNeededException();
- }
-
- @Override
- public LocalWorld getWorld() {
- throw new PlayerNeededException();
- }
-
- @Override
- public double getPitch() {
- throw new PlayerNeededException();
- }
-
- @Override
- public double getYaw() {
- throw new PlayerNeededException();
- }
-
- @Override
- public void giveItem(int type, int amt) {
- throw new PlayerNeededException();
- }
-
- @Override
- public void setPosition(Vector pos, float pitch, float yaw) {
- throw new PlayerNeededException();
- }
-
- @Override
- public BlockBag getInventoryBlockBag() {
- throw new PlayerNeededException();
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.worldedit.LocalPlayer;
+import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.PlayerNeededException;
+import com.sk89q.worldedit.ServerInterface;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.WorldVector;
+import com.sk89q.worldedit.bags.BlockBag;
+import org.spout.api.chat.style.ChatStyle;
+import org.spout.api.command.CommandSource;
+import org.spout.api.entity.Player;
+
+public class SpoutCommandSender extends LocalPlayer {
+ private CommandSource sender;
+ @SuppressWarnings("unused")
+ private WorldEditPlugin plugin;
+
+ public SpoutCommandSender(WorldEditPlugin plugin, ServerInterface server, CommandSource sender) {
+ super(server);
+ this.plugin = plugin;
+ this.sender = sender;
+ }
+
+ @Override
+ public String getName() {
+ return sender.getName();
+ }
+
+ @Override
+ public void printRaw(String msg) {
+ sender.sendRawMessage(msg);
+ }
+
+ @Override
+ public void printDebug(String msg) {
+ sender.sendMessage(ChatStyle.GRAY, msg);
+
+ }
+
+ @Override
+ public void print(String msg) {
+ sender.sendMessage(ChatStyle.PURPLE, msg);
+ }
+
+ @Override
+ public void printError(String msg) {
+ sender.sendMessage(ChatStyle.RED, msg);
+ }
+
+ @Override
+ public String[] getGroups() {
+ return sender.getGroups();
+ }
+
+ @Override
+ public boolean hasPermission(String perm) {
+ return sender.hasPermission(perm);
+ }
+
+ @Override
+ public boolean isPlayer() {
+ return sender instanceof Player;
+ }
+
+ @Override
+ public int getItemInHand() {
+ throw new PlayerNeededException();
+ }
+
+ @Override
+ public WorldVector getPosition() {
+ throw new PlayerNeededException();
+ }
+
+ @Override
+ public LocalWorld getWorld() {
+ throw new PlayerNeededException();
+ }
+
+ @Override
+ public double getPitch() {
+ throw new PlayerNeededException();
+ }
+
+ @Override
+ public double getYaw() {
+ throw new PlayerNeededException();
+ }
+
+ @Override
+ public void giveItem(int type, int amt) {
+ throw new PlayerNeededException();
+ }
+
+ @Override
+ public void setPosition(Vector pos, float pitch, float yaw) {
+ throw new PlayerNeededException();
+ }
+
+ @Override
+ public BlockBag getInventoryBlockBag() {
+ throw new PlayerNeededException();
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutConfiguration.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutConfiguration.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutConfiguration.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutConfiguration.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutEntity.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutEntity.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutEntity.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutEntity.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutPlayer.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutPlayer.java
index 57586784c..fab38985a 100644
--- a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/SpoutPlayer.java
@@ -1,158 +1,158 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.worldedit.LocalPlayer;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.ServerInterface;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.WorldVector;
-import com.sk89q.worldedit.bags.BlockBag;
-import com.sk89q.worldedit.cui.CUIEvent;
-
-import org.spout.api.Client;
-import org.spout.api.chat.style.ChatStyle;
-import org.spout.api.component.components.TransformComponent;
-import org.spout.api.geo.discrete.Point;
-import org.spout.api.inventory.Inventory;
-import org.spout.api.inventory.ItemStack;
-import org.spout.api.entity.Player;
-import org.spout.vanilla.component.inventory.window.Window;
-import org.spout.vanilla.component.living.Human;
-import org.spout.vanilla.material.VanillaMaterial;
-import org.spout.vanilla.material.VanillaMaterials;
-
-public class SpoutPlayer extends LocalPlayer {
- private Player player;
- @SuppressWarnings("unused")
- private WorldEditPlugin plugin;
-
- public SpoutPlayer(WorldEditPlugin plugin, ServerInterface server, Player player) {
- super(server);
- this.plugin = plugin;
- this.player = player;
- }
-
- @Override
- public int getItemInHand() {
- if (player.has(Human.class)) {
- return ((VanillaMaterial) player.get(Human.class).getInventory().getQuickbar()
- .getCurrentItem().getMaterial()).getMinecraftId();
- } else {
- return 0;
- }
- }
-
- @Override
- public String getName() {
- return player.getName();
- }
-
- @Override
- public WorldVector getPosition() {
- Point loc = player.getTransform().getPosition();
- return new WorldVector(SpoutUtil.getLocalWorld(loc.getWorld()),
- loc.getX(), loc.getY(), loc.getZ());
- }
-
- @Override
- public double getPitch() {
- return player.getTransform().getPitch();
- }
-
- @Override
- public double getYaw() {
- return player.getTransform().getYaw();
- }
-
- @Override
- public void giveItem(int type, int amt) {
- if (player.has(Human.class)) {
- player.get(Human.class).getInventory().add(new ItemStack(VanillaMaterials.getMaterial((short) type), amt));
- }
- }
-
- @Override
- public void printRaw(String msg) {
- for (String part : msg.split("\n")) {
- player.sendMessage(part);
- }
- }
-
- @Override
- public void print(String msg) {
- for (String part : msg.split("\n")) {
- player.sendMessage(ChatStyle.PINK, part);
- }
- }
-
- @Override
- public void printDebug(String msg) {
- for (String part : msg.split("\n")) {
- player.sendMessage(ChatStyle.GRAY, part);
- }
- }
-
- @Override
- public void printError(String msg) {
- for (String part : msg.split("\n")) {
- player.sendMessage(ChatStyle.RED, part);
- }
- }
-
- @Override
- public void setPosition(Vector pos, float pitch, float yaw) {
- TransformComponent component = player.getTransform();
- player.teleport(SpoutUtil.toPoint(player.getWorld(), pos));
- component.setPitch(pitch);
- component.setYaw(yaw);
- }
-
- @Override
- public String[] getGroups() {
- return player.getGroups();
- }
-
- @Override
- public BlockBag getInventoryBlockBag() {
- return new SpoutPlayerBlockBag(player);
- }
-
- @Override
- public boolean hasPermission(String perm) {
- return player.hasPermission(perm);
- }
-
- @Override
- public LocalWorld getWorld() {
- return SpoutUtil.getLocalWorld(player.getWorld());
- }
-
- @Override
- public void dispatchCUIEvent(CUIEvent event) {
- player.getSession().send(player.getSession().getEngine() instanceof Client, new WorldEditCUIMessage(event));
- }
-
- public Player getPlayer() {
- return player;
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.worldedit.LocalPlayer;
+import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.ServerInterface;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.WorldVector;
+import com.sk89q.worldedit.bags.BlockBag;
+import com.sk89q.worldedit.cui.CUIEvent;
+
+import org.spout.api.Client;
+import org.spout.api.chat.style.ChatStyle;
+import org.spout.api.component.components.TransformComponent;
+import org.spout.api.geo.discrete.Point;
+import org.spout.api.inventory.Inventory;
+import org.spout.api.inventory.ItemStack;
+import org.spout.api.entity.Player;
+import org.spout.vanilla.component.inventory.window.Window;
+import org.spout.vanilla.component.living.Human;
+import org.spout.vanilla.material.VanillaMaterial;
+import org.spout.vanilla.material.VanillaMaterials;
+
+public class SpoutPlayer extends LocalPlayer {
+ private Player player;
+ @SuppressWarnings("unused")
+ private WorldEditPlugin plugin;
+
+ public SpoutPlayer(WorldEditPlugin plugin, ServerInterface server, Player player) {
+ super(server);
+ this.plugin = plugin;
+ this.player = player;
+ }
+
+ @Override
+ public int getItemInHand() {
+ if (player.has(Human.class)) {
+ return ((VanillaMaterial) player.get(Human.class).getInventory().getQuickbar()
+ .getCurrentItem().getMaterial()).getMinecraftId();
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public String getName() {
+ return player.getName();
+ }
+
+ @Override
+ public WorldVector getPosition() {
+ Point loc = player.getTransform().getPosition();
+ return new WorldVector(SpoutUtil.getLocalWorld(loc.getWorld()),
+ loc.getX(), loc.getY(), loc.getZ());
+ }
+
+ @Override
+ public double getPitch() {
+ return player.getTransform().getPitch();
+ }
+
+ @Override
+ public double getYaw() {
+ return player.getTransform().getYaw();
+ }
+
+ @Override
+ public void giveItem(int type, int amt) {
+ if (player.has(Human.class)) {
+ player.get(Human.class).getInventory().add(new ItemStack(VanillaMaterials.getMaterial((short) type), amt));
+ }
+ }
+
+ @Override
+ public void printRaw(String msg) {
+ for (String part : msg.split("\n")) {
+ player.sendMessage(part);
+ }
+ }
+
+ @Override
+ public void print(String msg) {
+ for (String part : msg.split("\n")) {
+ player.sendMessage(ChatStyle.PINK, part);
+ }
+ }
+
+ @Override
+ public void printDebug(String msg) {
+ for (String part : msg.split("\n")) {
+ player.sendMessage(ChatStyle.GRAY, part);
+ }
+ }
+
+ @Override
+ public void printError(String msg) {
+ for (String part : msg.split("\n")) {
+ player.sendMessage(ChatStyle.RED, part);
+ }
+ }
+
+ @Override
+ public void setPosition(Vector pos, float pitch, float yaw) {
+ TransformComponent component = player.getTransform();
+ player.teleport(SpoutUtil.toPoint(player.getWorld(), pos));
+ component.setPitch(pitch);
+ component.setYaw(yaw);
+ }
+
+ @Override
+ public String[] getGroups() {
+ return player.getGroups();
+ }
+
+ @Override
+ public BlockBag getInventoryBlockBag() {
+ return new SpoutPlayerBlockBag(player);
+ }
+
+ @Override
+ public boolean hasPermission(String perm) {
+ return player.hasPermission(perm);
+ }
+
+ @Override
+ public LocalWorld getWorld() {
+ return SpoutUtil.getLocalWorld(player.getWorld());
+ }
+
+ @Override
+ public void dispatchCUIEvent(CUIEvent event) {
+ player.getSession().send(player.getSession().getEngine() instanceof Client, new WorldEditCUIMessage(event));
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java
index 2a3f4020b..88ef284dc 100644
--- a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java
@@ -1,269 +1,269 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.worldedit.WorldVector;
-import com.sk89q.worldedit.bags.BlockBag;
-import com.sk89q.worldedit.bags.BlockBagException;
-import com.sk89q.worldedit.bags.OutOfBlocksException;
-import com.sk89q.worldedit.bags.OutOfSpaceException;
-import com.sk89q.worldedit.blocks.BaseItem;
-import com.sk89q.worldedit.blocks.BaseItemStack;
-import com.sk89q.worldedit.blocks.BlockID;
-import org.spout.api.inventory.Inventory;
-import org.spout.api.inventory.ItemStack;
-import org.spout.api.material.Material;
-import org.spout.api.entity.Player;
-import org.spout.vanilla.component.inventory.PlayerInventory;
-import org.spout.vanilla.component.living.Human;
-import org.spout.vanilla.material.VanillaMaterials;
-import org.spout.vanilla.util.VanillaPlayerUtil;
-
-public class SpoutPlayerBlockBag extends BlockBag {
- /**
- * Player instance.
- */
- private Player player;
- /**
- * The player's inventory;
- */
- private ItemInfo items;
-
- private static class ItemInfo {
- ItemStack[] inventory;
- boolean includesFullInventory;
-
- public ItemInfo(ItemStack[] inventory, boolean full) {
- this.inventory = inventory;
- this.includesFullInventory = full;
- }
- }
-
- /**
- * Construct the object.
- *
- * @param player
- */
- public SpoutPlayerBlockBag(Player player) {
- this.player = player;
- }
-
- /**
- * Loads inventory on first use.
- */
- private void loadInventory() {
- if (items == null) {
- items = getViewableItems(player);
- }
- }
-
- private ItemInfo getViewableItems(Player player) {
- boolean includesFullInventory = true;
- ItemStack[] items;
- Human human = player.get(Human.class);
- PlayerInventory inv = human.getInventory();
- if (human.isCreative()) {
- includesFullInventory = false;
- items = new ItemStack[inv.getQuickbar().size()];
- } else {
- items = new ItemStack[inv.getQuickbar().size() + inv.getMain().size()];
- }
- int index = 0;
- for (; index < inv.getQuickbar().size(); ++index) {
- items[index] = inv.getQuickbar().get(index);
- }
-
- if (!human.isCreative()) {
- for (int i = 0; i < inv.getMain().size() && index < items.length; ++i) {
- items[index++] = inv.getMain().get(i);
- }
- }
- return new ItemInfo(items, includesFullInventory);
- }
-
- /**
- * Get the player.
- *
- * @return
- */
- public Player getPlayer() {
- return player;
- }
-
- /**
- * Get a block.
- *
- * @param item
- */
- @Override
- public void fetchItem(BaseItem item) throws BlockBagException {
- final short id = (short)item.getType();
- final short damage = item.getData();
- int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
- assert(amount == 1);
- Material mat = VanillaMaterials.getMaterial(id, damage);
-
- if (mat == VanillaMaterials.AIR) {
- throw new IllegalArgumentException("Can't fetch air block");
- }
-
- loadInventory();
-
- boolean found = false;
-
- for (int slot = 0; slot < items.inventory.length; ++slot) {
- ItemStack spoutItem = items.inventory[slot];
-
- if (spoutItem == null) {
- continue;
- }
-
- if (!spoutItem.getMaterial().equals(mat)) {
- // Type id or damage value doesn't fit
- continue;
- }
-
- int currentAmount = spoutItem.getAmount();
- if (currentAmount < 0) {
- // Unlimited
- return;
- }
-
- if (currentAmount > 1) {
- spoutItem.setAmount(currentAmount - 1);
- found = true;
- } else {
- items.inventory[slot] = null;
- found = true;
- }
-
- break;
- }
-
- if (!found) {
- throw new OutOfBlocksException();
- }
- }
-
- /**
- * Store a block.
- *
- * @param item
- */
- @Override
- public void storeItem(BaseItem item) throws BlockBagException {
- final short id = (short) item.getType();
- final short damage = item.getData();
- Material mat = VanillaMaterials.getMaterial(id, damage);
- int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
- assert(amount <= mat.getMaxStackSize());
-
- if (mat == VanillaMaterials.AIR) {
- throw new IllegalArgumentException("Can't store air block");
- }
-
- loadInventory();
-
- int freeSlot = -1;
-
- for (int slot = 0; slot < items.inventory.length; ++slot) {
- ItemStack spoutItem = items.inventory[slot];
-
- if (spoutItem == null) {
- // Delay using up a free slot until we know there are no stacks
- // of this item to merge into
-
- if (freeSlot == -1) {
- freeSlot = slot;
- }
- continue;
- }
-
- if (!spoutItem.getMaterial().equals(mat)) {
- // Type id or damage value doesn't fit
- continue;
- }
-
- int currentAmount = spoutItem.getAmount();
- if (currentAmount < 0) {
- // Unlimited
- return;
- }
- if (currentAmount >= mat.getMaxStackSize()) {
- // Full stack
- continue;
- }
-
- int spaceLeft = mat.getMaxStackSize() - currentAmount;
- if (spaceLeft >= amount) {
- spoutItem.setAmount(currentAmount + amount);
- return;
- }
-
- spoutItem.setAmount(mat.getMaxStackSize());
- amount -= spaceLeft;
- }
-
- if (freeSlot > -1) {
- items.inventory[freeSlot] = new ItemStack(mat, amount);
- return;
- }
-
- throw new OutOfSpaceException(id);
- }
-
- /**
- * Flush any changes. This is called at the end.
- */
- @Override
- public void flushChanges() {
- if (items != null) {
- PlayerInventory inv = player.get(Human.class).getInventory();
- for (int i = 0; i < inv.getQuickbar().size(); i++) {
- inv.getQuickbar().set(i, items.inventory[i]);
- }
-
- for (int i = 0; i < inv.getMain().size(); ++i) {
- inv.getMain().set(i, items.inventory[inv.getQuickbar().size() + i]);
- }
- items = null;
- }
- }
-
- /**
- * Adds a position to be used a source.
- * (TODO: Figure out what this does)
- * @param pos
- */
- @Override
- public void addSourcePosition(WorldVector pos) {
- }
-
- /**
- * Adds a position to be used a source.
- * (TODO: Figure out what this does)
- * @param pos
- */
- @Override
- public void addSingleSourcePosition(WorldVector pos) {
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.worldedit.WorldVector;
+import com.sk89q.worldedit.bags.BlockBag;
+import com.sk89q.worldedit.bags.BlockBagException;
+import com.sk89q.worldedit.bags.OutOfBlocksException;
+import com.sk89q.worldedit.bags.OutOfSpaceException;
+import com.sk89q.worldedit.blocks.BaseItem;
+import com.sk89q.worldedit.blocks.BaseItemStack;
+import com.sk89q.worldedit.blocks.BlockID;
+import org.spout.api.inventory.Inventory;
+import org.spout.api.inventory.ItemStack;
+import org.spout.api.material.Material;
+import org.spout.api.entity.Player;
+import org.spout.vanilla.component.inventory.PlayerInventory;
+import org.spout.vanilla.component.living.Human;
+import org.spout.vanilla.material.VanillaMaterials;
+import org.spout.vanilla.util.VanillaPlayerUtil;
+
+public class SpoutPlayerBlockBag extends BlockBag {
+ /**
+ * Player instance.
+ */
+ private Player player;
+ /**
+ * The player's inventory;
+ */
+ private ItemInfo items;
+
+ private static class ItemInfo {
+ ItemStack[] inventory;
+ boolean includesFullInventory;
+
+ public ItemInfo(ItemStack[] inventory, boolean full) {
+ this.inventory = inventory;
+ this.includesFullInventory = full;
+ }
+ }
+
+ /**
+ * Construct the object.
+ *
+ * @param player
+ */
+ public SpoutPlayerBlockBag(Player player) {
+ this.player = player;
+ }
+
+ /**
+ * Loads inventory on first use.
+ */
+ private void loadInventory() {
+ if (items == null) {
+ items = getViewableItems(player);
+ }
+ }
+
+ private ItemInfo getViewableItems(Player player) {
+ boolean includesFullInventory = true;
+ ItemStack[] items;
+ Human human = player.get(Human.class);
+ PlayerInventory inv = human.getInventory();
+ if (human.isCreative()) {
+ includesFullInventory = false;
+ items = new ItemStack[inv.getQuickbar().size()];
+ } else {
+ items = new ItemStack[inv.getQuickbar().size() + inv.getMain().size()];
+ }
+ int index = 0;
+ for (; index < inv.getQuickbar().size(); ++index) {
+ items[index] = inv.getQuickbar().get(index);
+ }
+
+ if (!human.isCreative()) {
+ for (int i = 0; i < inv.getMain().size() && index < items.length; ++i) {
+ items[index++] = inv.getMain().get(i);
+ }
+ }
+ return new ItemInfo(items, includesFullInventory);
+ }
+
+ /**
+ * Get the player.
+ *
+ * @return
+ */
+ public Player getPlayer() {
+ return player;
+ }
+
+ /**
+ * Get a block.
+ *
+ * @param item
+ */
+ @Override
+ public void fetchItem(BaseItem item) throws BlockBagException {
+ final short id = (short)item.getType();
+ final short damage = item.getData();
+ int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
+ assert(amount == 1);
+ Material mat = VanillaMaterials.getMaterial(id, damage);
+
+ if (mat == VanillaMaterials.AIR) {
+ throw new IllegalArgumentException("Can't fetch air block");
+ }
+
+ loadInventory();
+
+ boolean found = false;
+
+ for (int slot = 0; slot < items.inventory.length; ++slot) {
+ ItemStack spoutItem = items.inventory[slot];
+
+ if (spoutItem == null) {
+ continue;
+ }
+
+ if (!spoutItem.getMaterial().equals(mat)) {
+ // Type id or damage value doesn't fit
+ continue;
+ }
+
+ int currentAmount = spoutItem.getAmount();
+ if (currentAmount < 0) {
+ // Unlimited
+ return;
+ }
+
+ if (currentAmount > 1) {
+ spoutItem.setAmount(currentAmount - 1);
+ found = true;
+ } else {
+ items.inventory[slot] = null;
+ found = true;
+ }
+
+ break;
+ }
+
+ if (!found) {
+ throw new OutOfBlocksException();
+ }
+ }
+
+ /**
+ * Store a block.
+ *
+ * @param item
+ */
+ @Override
+ public void storeItem(BaseItem item) throws BlockBagException {
+ final short id = (short) item.getType();
+ final short damage = item.getData();
+ Material mat = VanillaMaterials.getMaterial(id, damage);
+ int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
+ assert(amount <= mat.getMaxStackSize());
+
+ if (mat == VanillaMaterials.AIR) {
+ throw new IllegalArgumentException("Can't store air block");
+ }
+
+ loadInventory();
+
+ int freeSlot = -1;
+
+ for (int slot = 0; slot < items.inventory.length; ++slot) {
+ ItemStack spoutItem = items.inventory[slot];
+
+ if (spoutItem == null) {
+ // Delay using up a free slot until we know there are no stacks
+ // of this item to merge into
+
+ if (freeSlot == -1) {
+ freeSlot = slot;
+ }
+ continue;
+ }
+
+ if (!spoutItem.getMaterial().equals(mat)) {
+ // Type id or damage value doesn't fit
+ continue;
+ }
+
+ int currentAmount = spoutItem.getAmount();
+ if (currentAmount < 0) {
+ // Unlimited
+ return;
+ }
+ if (currentAmount >= mat.getMaxStackSize()) {
+ // Full stack
+ continue;
+ }
+
+ int spaceLeft = mat.getMaxStackSize() - currentAmount;
+ if (spaceLeft >= amount) {
+ spoutItem.setAmount(currentAmount + amount);
+ return;
+ }
+
+ spoutItem.setAmount(mat.getMaxStackSize());
+ amount -= spaceLeft;
+ }
+
+ if (freeSlot > -1) {
+ items.inventory[freeSlot] = new ItemStack(mat, amount);
+ return;
+ }
+
+ throw new OutOfSpaceException(id);
+ }
+
+ /**
+ * Flush any changes. This is called at the end.
+ */
+ @Override
+ public void flushChanges() {
+ if (items != null) {
+ PlayerInventory inv = player.get(Human.class).getInventory();
+ for (int i = 0; i < inv.getQuickbar().size(); i++) {
+ inv.getQuickbar().set(i, items.inventory[i]);
+ }
+
+ for (int i = 0; i < inv.getMain().size(); ++i) {
+ inv.getMain().set(i, items.inventory[inv.getQuickbar().size() + i]);
+ }
+ items = null;
+ }
+ }
+
+ /**
+ * Adds a position to be used a source.
+ * (TODO: Figure out what this does)
+ * @param pos
+ */
+ @Override
+ public void addSourcePosition(WorldVector pos) {
+ }
+
+ /**
+ * Adds a position to be used a source.
+ * (TODO: Figure out what this does)
+ * @param pos
+ */
+ @Override
+ public void addSingleSourcePosition(WorldVector pos) {
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutRawCommandExecutor.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutRawCommandExecutor.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutRawCommandExecutor.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutRawCommandExecutor.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutServerInterface.java
similarity index 97%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutServerInterface.java
index 3527ca252..65ec39fb3 100644
--- a/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/SpoutServerInterface.java
@@ -1,107 +1,107 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.minecraft.util.commands.Command;
-import com.sk89q.minecraft.util.commands.CommandPermissions;
-import com.sk89q.minecraft.util.commands.CommandsManager;
-import com.sk89q.worldedit.LocalPlayer;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.ServerInterface;
-import org.spout.api.Engine;
-import org.spout.api.geo.World;
-import org.spout.api.material.Material;
-import org.spout.api.material.MaterialRegistry;
-import org.spout.api.scheduler.TaskPriority;
-import org.spout.vanilla.material.VanillaMaterial;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class SpoutServerInterface extends ServerInterface {
- public Engine game;
- public WorldEditPlugin plugin;
- private final SpoutRawCommandExecutor executor;
- private SpoutBiomeTypes biomes;
-
- public SpoutServerInterface(WorldEditPlugin plugin, Engine game) {
- this.plugin = plugin;
- this.game = game;
- this.biomes = new SpoutBiomeTypes();
- this.executor = new SpoutRawCommandExecutor(plugin);
- }
-
- @Override
- public int resolveItem(String name) {
- Material mat = MaterialRegistry.get(name);
- return mat == null || !(mat instanceof VanillaMaterial) ? 0 : ((VanillaMaterial) mat).getMinecraftId();
- }
-
- @Override
- public boolean isValidMobType(String type) {
- return false;
- //return CreatureType.fromName(type) != null;
- }
-
- @Override
- public void reload() {
- plugin.loadConfiguration();
- }
-
- @Override
- public SpoutBiomeTypes getBiomes() {
- return biomes;
- }
-
- @Override
- public int schedule(long delay, long period, Runnable task) {
- return game.getScheduler().scheduleSyncRepeatingTask(plugin, task, delay * 50, period * 50, TaskPriority.NORMAL);
- }
-
- @Override
- public List getWorlds() {
- Collection worlds = game.getWorlds();
- List ret = new ArrayList(worlds.size());
-
- for (World world : worlds) {
- ret.add(SpoutUtil.getLocalWorld(world));
- }
-
- return ret;
- }
-
- @Override
- public void onCommandRegistration(List commands, CommandsManager manager) {
- for (Command command : commands) {
- org.spout.api.command.Command spoutCommand = game.getRootCommand().addSubCommand(plugin, command.aliases()[0])
- .addAlias(command.aliases()).setRawExecutor(executor)
- .setHelp("/" + command.aliases()[0] + " " + command.usage() + " - " + command.desc());
- Method cmdMethod = manager.getMethods().get(null).get(command.aliases()[0]);
- if (cmdMethod != null && cmdMethod.isAnnotationPresent(CommandPermissions.class)) {
- spoutCommand.setPermissions(false, cmdMethod.getAnnotation(CommandPermissions.class).value());
- }
- spoutCommand.closeSubCommand();
- }
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.minecraft.util.commands.Command;
+import com.sk89q.minecraft.util.commands.CommandPermissions;
+import com.sk89q.minecraft.util.commands.CommandsManager;
+import com.sk89q.worldedit.LocalPlayer;
+import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.ServerInterface;
+import org.spout.api.Engine;
+import org.spout.api.geo.World;
+import org.spout.api.material.Material;
+import org.spout.api.material.MaterialRegistry;
+import org.spout.api.scheduler.TaskPriority;
+import org.spout.vanilla.material.VanillaMaterial;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class SpoutServerInterface extends ServerInterface {
+ public Engine game;
+ public WorldEditPlugin plugin;
+ private final SpoutRawCommandExecutor executor;
+ private SpoutBiomeTypes biomes;
+
+ public SpoutServerInterface(WorldEditPlugin plugin, Engine game) {
+ this.plugin = plugin;
+ this.game = game;
+ this.biomes = new SpoutBiomeTypes();
+ this.executor = new SpoutRawCommandExecutor(plugin);
+ }
+
+ @Override
+ public int resolveItem(String name) {
+ Material mat = MaterialRegistry.get(name);
+ return mat == null || !(mat instanceof VanillaMaterial) ? 0 : ((VanillaMaterial) mat).getMinecraftId();
+ }
+
+ @Override
+ public boolean isValidMobType(String type) {
+ return false;
+ //return CreatureType.fromName(type) != null;
+ }
+
+ @Override
+ public void reload() {
+ plugin.loadConfiguration();
+ }
+
+ @Override
+ public SpoutBiomeTypes getBiomes() {
+ return biomes;
+ }
+
+ @Override
+ public int schedule(long delay, long period, Runnable task) {
+ return game.getScheduler().scheduleSyncRepeatingTask(plugin, task, delay * 50, period * 50, TaskPriority.NORMAL);
+ }
+
+ @Override
+ public List getWorlds() {
+ Collection worlds = game.getWorlds();
+ List ret = new ArrayList(worlds.size());
+
+ for (World world : worlds) {
+ ret.add(SpoutUtil.getLocalWorld(world));
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void onCommandRegistration(List commands, CommandsManager manager) {
+ for (Command command : commands) {
+ org.spout.api.command.Command spoutCommand = game.getRootCommand().addSubCommand(plugin, command.aliases()[0])
+ .addAlias(command.aliases()).setRawExecutor(executor)
+ .setHelp("/" + command.aliases()[0] + " " + command.usage() + " - " + command.desc());
+ Method cmdMethod = manager.getMethods().get(null).get(command.aliases()[0]);
+ if (cmdMethod != null && cmdMethod.isAnnotationPresent(CommandPermissions.class)) {
+ spoutCommand.setPermissions(false, cmdMethod.getAnnotation(CommandPermissions.class).value());
+ }
+ spoutCommand.closeSubCommand();
+ }
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutUtil.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutUtil.java
similarity index 97%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutUtil.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutUtil.java
index d4fddef91..834757ba3 100644
--- a/src/main/java/com/sk89q/worldedit/spout/SpoutUtil.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/SpoutUtil.java
@@ -1,115 +1,115 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.worldedit.BlockVector;
-import com.sk89q.worldedit.BlockWorldVector;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.Location;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.WorldVector;
-import org.spout.api.Engine;
-import org.spout.api.Server;
-import org.spout.api.entity.Entity;
-import org.spout.api.geo.World;
-import org.spout.api.geo.cuboid.Block;
-import org.spout.api.geo.discrete.Point;
-import org.spout.api.material.block.BlockFace;
-import org.spout.api.math.MathHelper;
-import org.spout.api.math.Vector3;
-import org.spout.api.entity.Player;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class SpoutUtil {
- private SpoutUtil() {
- }
-
- private static final Map wlw = new HashMap();
-
- public static LocalWorld getLocalWorld(World w) {
- LocalWorld lw = wlw.get(w);
- if (lw == null) {
- lw = new SpoutWorld(w);
- wlw.put(w, lw);
- }
- return lw;
- }
-
- public static BlockVector toVector(Block block) {
- return new BlockVector(block.getX(), block.getY(), block.getZ());
- }
-
- public static BlockVector toVector(BlockFace face) {
- return toBlockVector(face.getOffset());
- }
-
- public static BlockVector toBlockVector(Vector3 vector) {
- return new BlockVector(vector.getX(), vector.getY(), vector.getZ());
- }
-
- public static BlockWorldVector toWorldVector(Block block) {
- return new BlockWorldVector(getLocalWorld(block.getWorld()), block.getX(), block.getY(), block.getZ());
- }
-
- public static Vector toVector(Point loc) {
- return new Vector(loc.getX(), loc.getY(), loc.getZ());
- }
-
- public static Vector toVector(org.spout.api.math.Vector3 vector) {
- return new Vector(vector.getX(), vector.getY(), vector.getZ());
- }
-
- public static Point toPoint(WorldVector pt) {
- return new Point(toWorld(pt), (float)pt.getX(), (float)pt.getY(), (float)pt.getZ());
- }
-
- public static Point toPoint(World world, Vector pt) {
- return new Point(world, (float)pt.getX(), (float)pt.getY(), (float)pt.getZ());
- }
-
- public static Point center(Point loc) {
- return new Point(
- loc.getWorld(),
- MathHelper.floor(loc.getX()) + 0.5F,
- MathHelper.floor(loc.getY()) + 0.5F,
- MathHelper.floor(loc.getZ()) + 0.5F
- );
- }
-
- public static Player matchSinglePlayer(Engine game, String name) {
- return game instanceof Server ? ((Server) game).getPlayer(name, false) : null;
- }
-
- public static Block toBlock(BlockWorldVector pt) {
- return toWorld(pt).getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), WorldEditPlugin.getInstance());
- }
-
- public static World toWorld(WorldVector pt) {
- return ((SpoutWorld) pt.getWorld()).getWorld();
- }
-
- public static Location toLocation(Entity ent) {
- return new Location(getLocalWorld(ent.getWorld()), toVector(ent.getTransform().getPosition()), ent.getTransform().getYaw(), ent.getTransform().getPitch());
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.worldedit.BlockVector;
+import com.sk89q.worldedit.BlockWorldVector;
+import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.Location;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.WorldVector;
+import org.spout.api.Engine;
+import org.spout.api.Server;
+import org.spout.api.entity.Entity;
+import org.spout.api.geo.World;
+import org.spout.api.geo.cuboid.Block;
+import org.spout.api.geo.discrete.Point;
+import org.spout.api.material.block.BlockFace;
+import org.spout.api.math.MathHelper;
+import org.spout.api.math.Vector3;
+import org.spout.api.entity.Player;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SpoutUtil {
+ private SpoutUtil() {
+ }
+
+ private static final Map wlw = new HashMap();
+
+ public static LocalWorld getLocalWorld(World w) {
+ LocalWorld lw = wlw.get(w);
+ if (lw == null) {
+ lw = new SpoutWorld(w);
+ wlw.put(w, lw);
+ }
+ return lw;
+ }
+
+ public static BlockVector toVector(Block block) {
+ return new BlockVector(block.getX(), block.getY(), block.getZ());
+ }
+
+ public static BlockVector toVector(BlockFace face) {
+ return toBlockVector(face.getOffset());
+ }
+
+ public static BlockVector toBlockVector(Vector3 vector) {
+ return new BlockVector(vector.getX(), vector.getY(), vector.getZ());
+ }
+
+ public static BlockWorldVector toWorldVector(Block block) {
+ return new BlockWorldVector(getLocalWorld(block.getWorld()), block.getX(), block.getY(), block.getZ());
+ }
+
+ public static Vector toVector(Point loc) {
+ return new Vector(loc.getX(), loc.getY(), loc.getZ());
+ }
+
+ public static Vector toVector(org.spout.api.math.Vector3 vector) {
+ return new Vector(vector.getX(), vector.getY(), vector.getZ());
+ }
+
+ public static Point toPoint(WorldVector pt) {
+ return new Point(toWorld(pt), (float)pt.getX(), (float)pt.getY(), (float)pt.getZ());
+ }
+
+ public static Point toPoint(World world, Vector pt) {
+ return new Point(world, (float)pt.getX(), (float)pt.getY(), (float)pt.getZ());
+ }
+
+ public static Point center(Point loc) {
+ return new Point(
+ loc.getWorld(),
+ MathHelper.floor(loc.getX()) + 0.5F,
+ MathHelper.floor(loc.getY()) + 0.5F,
+ MathHelper.floor(loc.getZ()) + 0.5F
+ );
+ }
+
+ public static Player matchSinglePlayer(Engine game, String name) {
+ return game instanceof Server ? ((Server) game).getPlayer(name, false) : null;
+ }
+
+ public static Block toBlock(BlockWorldVector pt) {
+ return toWorld(pt).getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), WorldEditPlugin.getInstance());
+ }
+
+ public static World toWorld(WorldVector pt) {
+ return ((SpoutWorld) pt.getWorld()).getWorld();
+ }
+
+ public static Location toLocation(Entity ent) {
+ return new Location(getLocalWorld(ent.getWorld()), toVector(ent.getTransform().getPosition()), ent.getTransform().getYaw(), ent.getTransform().getPitch());
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java b/src/spout/java/com/sk89q/worldedit/spout/SpoutWorld.java
similarity index 97%
rename from src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java
rename to src/spout/java/com/sk89q/worldedit/spout/SpoutWorld.java
index 03b38886f..6183f56a5 100644
--- a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/SpoutWorld.java
@@ -1,814 +1,814 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.sk89q.worldedit.BiomeType;
-import com.sk89q.worldedit.BlockVector2D;
-import com.sk89q.worldedit.EditSession;
-import com.sk89q.worldedit.EntityType;
-import com.sk89q.worldedit.LocalEntity;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.MaxChangedBlocksException;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.Vector2D;
-import com.sk89q.worldedit.blocks.BaseBlock;
-import com.sk89q.worldedit.blocks.BaseItemStack;
-import com.sk89q.worldedit.regions.Region;
-
-import com.sk89q.worldedit.util.TreeGenerator;
-import org.spout.api.component.Component;
-import org.spout.api.entity.Entity;
-import org.spout.api.generator.biome.BiomeGenerator;
-import org.spout.api.geo.LoadOption;
-import org.spout.api.geo.World;
-import org.spout.api.geo.cuboid.Chunk;
-import org.spout.api.inventory.ItemStack;
-import org.spout.api.material.BlockMaterial;
-import org.spout.api.material.Material;
-import org.spout.api.math.Vector3;
-import org.spout.vanilla.component.substance.Item;
-import org.spout.vanilla.component.substance.Painting;
-import org.spout.vanilla.component.substance.XPOrb;
-import org.spout.vanilla.component.substance.object.Tnt;
-import org.spout.vanilla.component.substance.object.projectile.Arrow;
-import org.spout.vanilla.component.substance.object.vehicle.Boat;
-import org.spout.vanilla.component.substance.object.vehicle.Minecart;
-import org.spout.vanilla.material.VanillaMaterial;
-import org.spout.vanilla.material.VanillaMaterials;
-import org.spout.vanilla.world.generator.normal.object.tree.TreeObject;
-import org.spout.vanilla.world.generator.normal.object.tree.SmallTreeObject;
-
-import javax.annotation.Nullable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class SpoutWorld extends LocalWorld {
- private World world;
-
- /**
- * Construct the object.
- * @param world
- */
- public SpoutWorld(World world) {
- this.world = world;
- }
-
- /**
- * Get the world handle.
- *
- * @return
- */
- public World getWorld() {
- return world;
- }
-
- /**
- * Get the name of the world
- *
- * @return
- */
- @Override
- public String getName() {
- return world.getName();
- }
-
- /**
- * Set block type.
- *
- * @param pt
- * @param type
- * @return
- */
- @Override
- public boolean setBlockType(Vector pt, int type) {
- Material mat = VanillaMaterials.getMaterial((short) type);
- if (mat != null && mat instanceof BlockMaterial) {
- final int x = pt.getBlockX();
- final int y = pt.getBlockY();
- final int z = pt.getBlockZ();
- return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) 0, WorldEditPlugin.getInstance());
- }
- return false;
- }
-
- /**
- * Set block type.
- *
- * @param pt
- * @param type
- * @return
- */
- @Override
- public boolean setBlockTypeFast(Vector pt, int type) {
- return setBlockType(pt, type);
- }
-
- /**
- * set block type & data
- * @param pt
- * @param type
- * @param data
- * @return
- */
- @Override
- public boolean setTypeIdAndData(Vector pt, int type, int data) {
- Material mat = VanillaMaterials.getMaterial((short) type, (short) data);
- if (mat != null && mat instanceof BlockMaterial) {
- final int x = pt.getBlockX();
- final int y = pt.getBlockY();
- final int z = pt.getBlockZ();
- return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) data, WorldEditPlugin.getInstance());
- }
- return false;
- }
-
- /**
- * set block type & data
- * Everything is threaded, so no need for fastmode here.
- * @param pt
- * @param type
- * @param data
- * @return
- */
- @Override
- public boolean setTypeIdAndDataFast(Vector pt, int type, int data) {
- return setTypeIdAndData(pt, type, data);
- }
-
- /**
- * Get block type.
- *
- * @param pt
- * @return
- */
- @Override
- public int getBlockType(Vector pt) {
- final int x = pt.getBlockX();
- final int y = pt.getBlockY();
- final int z = pt.getBlockZ();
- Material mat = world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).getBlockMaterial(x, y, z);
- return mat instanceof VanillaMaterial ? ((VanillaMaterial) mat).getMinecraftId() : 0;
- }
-
- /**
- * Set block data.
- *
- * @param pt
- * @param data
- */
- @Override
- public void setBlockData(Vector pt, int data) {
- final int x = pt.getBlockX();
- final int y = pt.getBlockY();
- final int z = pt.getBlockZ();
- world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockData(x, y, z, (short) data, WorldEditPlugin.getInstance());
- }
-
- /**
- * Set block data.
- *
- * @param pt
- * @param data
- */
- @Override
- public void setBlockDataFast(Vector pt, int data) {
- setBlockData(pt, data);
- }
-
- /**
- * Get block data.
- *
- * @param pt
- * @return
- */
- @Override
- public int getBlockData(Vector pt) {
- final int x = pt.getBlockX();
- final int y = pt.getBlockY();
- final int z = pt.getBlockZ();
- return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).getBlockData(x, y, z);
- }
-
- /**
- * Get block light level.
- *
- * @param pt
- * @return
- */
- @Override
- public int getBlockLightLevel(Vector pt) {
- final int x = pt.getBlockX();
- final int y = pt.getBlockY();
- final int z = pt.getBlockZ();
- return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).getBlockLight(x, y, z);
- }
-
- /**
- * Get biome type
- *
- * @param pt
- * @return
- */
- public BiomeType getBiome(Vector2D pt) {
- if (world.getGenerator() instanceof BiomeGenerator) {
- BiomeGenerator gen = (BiomeGenerator) world.getGenerator();
- return new SpoutBiomeType(gen.getBiome(pt.getBlockX(), pt.getBlockZ(), world.getSeed()));
- }
- return BiomeType.UNKNOWN;
- }
-
- public void setBiome(Vector2D pt, BiomeType biome) {
- if (biome instanceof SpoutBiomeType &&
- world.getGenerator() instanceof BiomeGenerator) {
- throw new UnsupportedOperationException("Biome changing is not yet supported in Spout");
- //BiomeGenerator gen = (BiomeGenerator) world.getGenerator();
- //gen.setBiome(new Vector3(pt.getBlockX(), 0, pt.getBlockZ()), ((SpoutBiomeType) biome).getSpoutBiome());
- }
- }
-
- /**
- * Regenerate an area.
- *
- * @param region
- * @param editSession
- * @return
- */
- @Override
- public boolean regenerate(Region region, EditSession editSession) {
- /*BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)];
-
- for (Vector2D chunk : region.getChunks()) {
- Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
-
- // First save all the blocks inside
- for (int x = 0; x < 16; ++x) {
- for (int y = 0; y < (getMaxY() + 1); ++y) {
- for (int z = 0; z < 16; ++z) {
- Vector pt = min.add(x, y, z);
- int index = y * 16 * 16 + z * 16 + x;
- history[index] = editSession.getBlock(pt);
- }
- }
- }
-
- try {
- world.regenerateChunk(chunk.getBlockX(), chunk.getBlockZ());
- } catch (Throwable t) {
- t.printStackTrace();
- }
-
- // Then restore
- for (int x = 0; x < 16; ++x) {
- for (int y = 0; y < (getMaxY() + 1); ++y) {
- for (int z = 0; z < 16; ++z) {
- Vector pt = min.add(x, y, z);
- int index = y * 16 * 16 + z * 16 + x;
-
- // We have to restore the block if it was outside
- if (!region.contains(pt)) {
- editSession.smartSetBlock(pt, history[index]);
- } else { // Otherwise fool with history
- editSession.rememberChange(pt, history[index],
- editSession.rawGetBlock(pt));
- }
- }
- }
- }
- }
-
- return true;*/
- return false;
- }
-
- /**
- * Attempts to accurately copy a BaseBlock's extra data to the world.
- *
- * @param pt
- * @param block
- * @return
- */
- @Override
- public boolean copyToWorld(Vector pt, BaseBlock block) {
- /*if (block instanceof SignBlock) {
- // Signs
- setSignText(pt, ((SignBlock) block).getText());
- return true;
- }
-
- if (block instanceof FurnaceBlock) {
- // Furnaces
- Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (bukkitBlock == null) return false;
- BlockState state = bukkitBlock.getState();
- if (!(state instanceof Furnace)) return false;
- Furnace bukkit = (Furnace) state;
- FurnaceBlock we = (FurnaceBlock) block;
- bukkit.setBurnTime(we.getBurnTime());
- bukkit.setCookTime(we.getCookTime());
- return setContainerBlockContents(pt, ((ContainerBlock) block).getItems());
- }
-
- if (block instanceof ContainerBlock) {
- // Chests/dispenser
- return setContainerBlockContents(pt, ((ContainerBlock) block).getItems());
- }
-
- if (block instanceof MobSpawnerBlock) {
- // Mob spawners
- Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (bukkitBlock == null) return false;
- BlockState state = bukkitBlock.getState();
- if (!(state instanceof CreatureSpawner)) return false;
- CreatureSpawner bukkit = (CreatureSpawner) state;
- MobSpawnerBlock we = (MobSpawnerBlock) block;
- bukkit.setCreatureTypeId(we.getMobType());
- bukkit.setDelay(we.getDelay());
- return true;
- }
-
- if (block instanceof NoteBlock) {
- // Note block
- Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (bukkitBlock == null) return false;
- BlockState state = bukkitBlock.getState();
- if (!(state instanceof org.bukkit.block.NoteBlock)) return false;
- org.bukkit.block.NoteBlock bukkit = (org.bukkit.block.NoteBlock) state;
- NoteBlock we = (NoteBlock) block;
- bukkit.setRawNote(we.getNote());
- return true;
- }*/
-
- return false;
- }
-
- /**
- * Attempts to read a BaseBlock's extra data from the world.
- *
- * @param pt
- * @param block
- * @return
- */
- @Override
- public boolean copyFromWorld(Vector pt, BaseBlock block) {
- /*if (block instanceof SignBlock) {
- // Signs
- ((SignBlock) block).setText(getSignText(pt));
- return true;
- }
-
- if (block instanceof FurnaceBlock) {
- // Furnaces
- Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (bukkitBlock == null) return false;
- BlockState state = bukkitBlock.getState();
- if (!(state instanceof Furnace)) return false;
- Furnace bukkit = (Furnace) state;
- FurnaceBlock we = (FurnaceBlock) block;
- we.setBurnTime(bukkit.getBurnTime());
- we.setCookTime(bukkit.getCookTime());
- ((ContainerBlock) block).setItems(getContainerBlockContents(pt));
- return true;
- }
-
- if (block instanceof ContainerBlock) {
- // Chests/dispenser
- ((ContainerBlock) block).setItems(getContainerBlockContents(pt));
- return true;
- }
-
- if (block instanceof MobSpawnerBlock) {
- // Mob spawners
- Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (bukkitBlock == null) return false;
- BlockState state = bukkitBlock.getState();
- if (!(state instanceof CreatureSpawner)) return false;
- CreatureSpawner bukkit = (CreatureSpawner) state;
- MobSpawnerBlock we = (MobSpawnerBlock) block;
- we.setMobType(bukkit.getCreatureTypeId());
- we.setDelay((short) bukkit.getDelay());
- return true;
- }
-
- if (block instanceof NoteBlock) {
- // Note block
- Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (bukkitBlock == null) return false;
- BlockState state = bukkitBlock.getState();
- if (!(state instanceof org.bukkit.block.NoteBlock)) return false;
- org.bukkit.block.NoteBlock bukkit = (org.bukkit.block.NoteBlock) state;
- NoteBlock we = (NoteBlock) block;
- we.setNote(bukkit.getRawNote());
- }*/
-
- return false;
- }
-
- /**
- * Clear a chest's contents.
- *
- * @param pt
- */
- @Override
- public boolean clearContainerBlockContents(Vector pt) {
- /* Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (block == null) {
- return false;
- }
- BlockState state = block.getState();
- if (!(state instanceof org.bukkit.block.ContainerBlock)) {
- return false;
- }
-
- org.bukkit.block.ContainerBlock chest = (org.bukkit.block.ContainerBlock) state;
- Inventory inven = chest.getInventory();
- inven.clear();
- return true;*/
- return false;
- }
-
- @Override
- public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pt)
- throws MaxChangedBlocksException {
- TreeObject tree = new SmallTreeObject(); //TODO: properly check for tree type
- if (!tree.canPlaceObject(world, pt.getBlockX(), pt.getBlockY(), pt.getBlockZ())) {
- return false;
- }
- tree.placeObject(world, pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- return true;
- }
-
- /**
- * Drop an item.
- *
- * @param pt
- * @param item
- */
- @Override
- public void dropItem(Vector pt, BaseItemStack item) {
- Material mat = VanillaMaterials.getMaterial((short) item.getType());
- if (mat.hasSubMaterials()) {
- mat = mat.getSubMaterial(item.getData());
- }
- ItemStack spoutItem = new ItemStack(mat, item.getData(), item.getAmount());
- world.createEntity(SpoutUtil.toPoint(world, pt), Item.class).get(Item.class).setItemStack(spoutItem);
- }
-
- /**
- * Kill mobs in an area.
- *
- * @param origin The center of the area to kill mobs in.
- * @param radius Maximum distance to kill mobs at; radius < 0 means kill all mobs
- * @param flags various flags that determine what to kill
- * @return
- */
- @Override
- public int killMobs(Vector origin, double radius, int flags) {
- /*boolean killPets = (flags & KillFlags.PETS) != 0;
- boolean killNPCs = (flags & KillFlags.NPCS) != 0;
- boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;*/
-
- int num = 0;
- /*double radiusSq = radius * radius;
-
- Point bukkitOrigin = SpoutUtil.toPoint(world, origin);
-
-
- for (LivingEntity ent : world.getLivingEntities()) {
- if (ent instanceof HumanEntity) {
- continue;
- }
-
- if (!killAnimals && ent instanceof Animals) {
- continue;
- }
-
- if (!killPets && ent instanceof Tameable && ((Tameable) ent).isTamed()) {
- continue; // tamed wolf
- }
-
- try {
- // Temporary solution until org.bukkit.entity.NPC is widely deployed.
- if (!killNPCs && Class.forName("org.bukkit.entity.NPC").isAssignableFrom(ent.getClass())) {
- continue;
- }
- } catch (ClassNotFoundException e) {}
-
- if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
- ent.remove();
- ++num;
- }
- }*/
-
- return num;
- }
-
- /**
- * Remove entities in an area.
- *
- * @param origin
- * @param radius
- * @return
- */
- @Override
- public int removeEntities(EntityType type, Vector origin, int radius) {
- int num = 0;
- double radiusSq = radius * radius;
-
- for (Entity ent : world.getAll()) {
- if (radius != -1
- && origin.distanceSq(SpoutUtil.toVector(ent.getTransform().getPosition())) > radiusSq) {
- continue;
- }
-
- if (type == EntityType.ARROWS) {
- if (ent.has(Arrow.class)) {
- ent.remove();
- ++num;
- }
- } else if (type == EntityType.BOATS) {
- if (ent.has(Boat.class)) {
- ent.remove();
- ++num;
- }
- } else if (type == EntityType.ITEMS) {
- if (ent.has(Item.class)) {
- ent.remove();
- ++num;
- }
- } else if (type == EntityType.MINECARTS) {
- if (ent.has(Minecart.class)) {
- ent.remove();
- ++num;
- }
- } else if (type == EntityType.PAINTINGS) {
- if (ent.has(Painting.class)) {
- ent.remove();
- ++num;
- }
- } else if (type == EntityType.TNT) {
- if (ent.has(Tnt.class)) {
- ent.remove();
- ++num;
- }
- } else if (type == EntityType.XP_ORBS) {
- if (ent.has(XPOrb.class)) {
- ent.remove();
- ++num;
- }
- }
- }
-
- return num;
- }
-
- /**
- * Set a sign's text.
- *
- * @param pt
- * @param text
- * @return
- */
- /*private boolean setSignText(Vector pt, String[] text) {
- Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (block == null) return false;
- BlockState state = block.getState();
- if (state == null || !(state instanceof Sign)) return false;
- Sign sign = (Sign) state;
- sign.setLine(0, text[0]);
- sign.setLine(1, text[1]);
- sign.setLine(2, text[2]);
- sign.setLine(3, text[3]);
- sign.update();
- return true;
- }*/
-
- /**
- * Get a sign's text.
- *
- * @param pt
- * @return
- */
- /*private String[] getSignText(Vector pt) {
- Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (block == null) return new String[] { "", "", "", "" };
- BlockState state = block.getState();
- if (state == null || !(state instanceof Sign)) return new String[] { "", "", "", "" };
- Sign sign = (Sign) state;
- String line0 = sign.getLine(0);
- String line1 = sign.getLine(1);
- String line2 = sign.getLine(2);
- String line3 = sign.getLine(3);
- return new String[] {
- line0 != null ? line0 : "",
- line1 != null ? line1 : "",
- line2 != null ? line2 : "",
- line3 != null ? line3 : "",
- };
- }*/
-
- /**
- * Get a container block's contents.
- *
- * @param pt
- * @return
- */
- /*private BaseItemStack[] getContainerBlockContents(Vector pt) {
- Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (block == null) {
- return new BaseItemStack[0];
- }
- BlockState state = block.getState();
- if (!(state instanceof org.bukkit.block.ContainerBlock)) {
- return new BaseItemStack[0];
- }
-
- org.bukkit.block.ContainerBlock container = (org.bukkit.block.ContainerBlock) state;
- Inventory inven = container.getInventory();
- int size = inven.getContents().length
- BaseItemStack[] contents = new BaseItemStack[size];
-
- for (int i = 0; i < size; ++i) {
- ItemStack bukkitStack = inven.getItem(i);
- if (bukkitStack.getMaterial() != MaterialData.air) {
- contents[i] = new BaseItemStack(
- bukkitStack.getMaterial().getRawId(),
- bukkitStack.getAmount(),
- bukkitStack.getDamage());
- try {
- for (Map.Entry entry : bukkitStack.getEnchantments().entrySet()) {
- contents[i].getEnchantments().put(entry.getKey().getId(), entry.getValue());
- }
- } catch (Throwable ignore) {}
- }
- }
-
- return contents;
- }*/
-
- /**
- * Set a container block's contents.
- *
- * @param pt
- * @param contents
- * @return
- */
- /*private boolean setContainerBlockContents(Vector pt, BaseItemStack[] contents) {
- Block block = world.getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
- if (block == null) {
- return false;
- }
- BlockState state = block.getState();
- if (!(state instanceof org.bukkit.block.ContainerBlock)) {
- return false;
- }
-
- org.bukkit.block.ContainerBlock chest = (org.bukkit.block.ContainerBlock) state;
- Inventory inven = chest.getInventory();
- int size = inven.getSize();
-
- for (int i = 0; i < size; ++i) {
- if (i >= contents.length) {
- break;
- }
-
- if (contents[i] != null) {
- ItemStack toAdd = new ItemStack(contents[i].getType(),
- contents[i].getAmount(),
- (byte) contents[i].getDamage());
- try {
- for (Map.Entry entry : contents[i].getEnchantments().entrySet()) {
- toAdd.addEnchantment(Enchantment.getById(entry.getKey()), entry.getValue());
- }
- } catch (Throwable ignore) {}
- inven.setItem(i, toAdd);
- } else {
- inven.setItem(i, null);
- }
- }
-
- return true;
- }*/
-
- /**
- * Returns whether a block has a valid ID.
- *
- * @param type
- * @return
- */
- @Override
- public boolean isValidBlockType(int type) {
- return VanillaMaterials.getMaterial((short)type) instanceof BlockMaterial;
- }
-
- @Override
- public void checkLoadedChunk(Vector pt) {
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof SpoutWorld)) {
- return false;
- }
-
- return ((SpoutWorld) other).world.equals(world);
- }
-
- @Override
- public int hashCode() {
- return world.hashCode();
- }
-
- @Override
- public int getMaxY() {
- return world.getHeight() - 1;
- }
-
- @Override
- public void fixAfterFastMode(Iterable chunks) {
- /*for (BlockVector2D chunkPos : chunks) {
- world.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ());
- }*/
- }
-
- /*private static final Map effects = new HashMap();
- static {
- for (Effect effect : Effect.values()) {
- effects.put(effect.getId(), effect);
- }
- }*/
-
- @Override
- public boolean playEffect(Vector position, int type, int data) {
- /*final Effect effect = effects.get(type);
- if (effect == null) {
- return false;
- }
-
- world.playEffect(SpoutUtil.toLocation(world, position), effect, data);
-
- return true;
- */
- return false;
- }
-
- @Override
- public SpoutEntity[] getEntities(Region region) {
- List entities = new ArrayList();
- for (Vector pt : region.getChunkCubes()) {
- Chunk chunk = world.getChunkFromBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), LoadOption.LOAD_GEN);
- if (chunk == null) {
- continue;
- }
- for (Entity ent : chunk.getEntities()) {
- if (region.contains(SpoutUtil.toVector(ent.getTransform().getPosition()))) {
- Collection> revisedComponents = Collections2.transform(ent.values(), new Function>() {
- @Override
- public Class extends Component> apply(@Nullable Component component) {
- return component == null ? null : component.getClass();
- }
- });
- entities.add(new SpoutEntity(SpoutUtil.toLocation(ent), ent.getId(), revisedComponents, ent.getData().getBaseMap())); // TODO:; Fix entity adding
- }
- }
- }
- return entities.toArray(new SpoutEntity[entities.size()]);
- }
-
- @Override
- public int killEntities(LocalEntity... entities) {
- int amount = 0;
- for (LocalEntity weEnt : entities) {
- SpoutEntity entity = (SpoutEntity) weEnt;
- Entity spoutEntity = world.getEntity(entity.getEntityId());
- if (spoutEntity != null) {
- spoutEntity.remove();
- ++amount;
- }
- }
- return amount;
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.sk89q.worldedit.BiomeType;
+import com.sk89q.worldedit.BlockVector2D;
+import com.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.EntityType;
+import com.sk89q.worldedit.LocalEntity;
+import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.MaxChangedBlocksException;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.Vector2D;
+import com.sk89q.worldedit.blocks.BaseBlock;
+import com.sk89q.worldedit.blocks.BaseItemStack;
+import com.sk89q.worldedit.regions.Region;
+
+import com.sk89q.worldedit.util.TreeGenerator;
+import org.spout.api.component.Component;
+import org.spout.api.entity.Entity;
+import org.spout.api.generator.biome.BiomeGenerator;
+import org.spout.api.geo.LoadOption;
+import org.spout.api.geo.World;
+import org.spout.api.geo.cuboid.Chunk;
+import org.spout.api.inventory.ItemStack;
+import org.spout.api.material.BlockMaterial;
+import org.spout.api.material.Material;
+import org.spout.api.math.Vector3;
+import org.spout.vanilla.component.substance.Item;
+import org.spout.vanilla.component.substance.Painting;
+import org.spout.vanilla.component.substance.XPOrb;
+import org.spout.vanilla.component.substance.object.Tnt;
+import org.spout.vanilla.component.substance.object.projectile.Arrow;
+import org.spout.vanilla.component.substance.object.vehicle.Boat;
+import org.spout.vanilla.component.substance.object.vehicle.Minecart;
+import org.spout.vanilla.material.VanillaMaterial;
+import org.spout.vanilla.material.VanillaMaterials;
+import org.spout.vanilla.world.generator.normal.object.tree.TreeObject;
+import org.spout.vanilla.world.generator.normal.object.tree.SmallTreeObject;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class SpoutWorld extends LocalWorld {
+ private World world;
+
+ /**
+ * Construct the object.
+ * @param world
+ */
+ public SpoutWorld(World world) {
+ this.world = world;
+ }
+
+ /**
+ * Get the world handle.
+ *
+ * @return
+ */
+ public World getWorld() {
+ return world;
+ }
+
+ /**
+ * Get the name of the world
+ *
+ * @return
+ */
+ @Override
+ public String getName() {
+ return world.getName();
+ }
+
+ /**
+ * Set block type.
+ *
+ * @param pt
+ * @param type
+ * @return
+ */
+ @Override
+ public boolean setBlockType(Vector pt, int type) {
+ Material mat = VanillaMaterials.getMaterial((short) type);
+ if (mat != null && mat instanceof BlockMaterial) {
+ final int x = pt.getBlockX();
+ final int y = pt.getBlockY();
+ final int z = pt.getBlockZ();
+ return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) 0, WorldEditPlugin.getInstance());
+ }
+ return false;
+ }
+
+ /**
+ * Set block type.
+ *
+ * @param pt
+ * @param type
+ * @return
+ */
+ @Override
+ public boolean setBlockTypeFast(Vector pt, int type) {
+ return setBlockType(pt, type);
+ }
+
+ /**
+ * set block type & data
+ * @param pt
+ * @param type
+ * @param data
+ * @return
+ */
+ @Override
+ public boolean setTypeIdAndData(Vector pt, int type, int data) {
+ Material mat = VanillaMaterials.getMaterial((short) type, (short) data);
+ if (mat != null && mat instanceof BlockMaterial) {
+ final int x = pt.getBlockX();
+ final int y = pt.getBlockY();
+ final int z = pt.getBlockZ();
+ return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) data, WorldEditPlugin.getInstance());
+ }
+ return false;
+ }
+
+ /**
+ * set block type & data
+ * Everything is threaded, so no need for fastmode here.
+ * @param pt
+ * @param type
+ * @param data
+ * @return
+ */
+ @Override
+ public boolean setTypeIdAndDataFast(Vector pt, int type, int data) {
+ return setTypeIdAndData(pt, type, data);
+ }
+
+ /**
+ * Get block type.
+ *
+ * @param pt
+ * @return
+ */
+ @Override
+ public int getBlockType(Vector pt) {
+ final int x = pt.getBlockX();
+ final int y = pt.getBlockY();
+ final int z = pt.getBlockZ();
+ Material mat = world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).getBlockMaterial(x, y, z);
+ return mat instanceof VanillaMaterial ? ((VanillaMaterial) mat).getMinecraftId() : 0;
+ }
+
+ /**
+ * Set block data.
+ *
+ * @param pt
+ * @param data
+ */
+ @Override
+ public void setBlockData(Vector pt, int data) {
+ final int x = pt.getBlockX();
+ final int y = pt.getBlockY();
+ final int z = pt.getBlockZ();
+ world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockData(x, y, z, (short) data, WorldEditPlugin.getInstance());
+ }
+
+ /**
+ * Set block data.
+ *
+ * @param pt
+ * @param data
+ */
+ @Override
+ public void setBlockDataFast(Vector pt, int data) {
+ setBlockData(pt, data);
+ }
+
+ /**
+ * Get block data.
+ *
+ * @param pt
+ * @return
+ */
+ @Override
+ public int getBlockData(Vector pt) {
+ final int x = pt.getBlockX();
+ final int y = pt.getBlockY();
+ final int z = pt.getBlockZ();
+ return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).getBlockData(x, y, z);
+ }
+
+ /**
+ * Get block light level.
+ *
+ * @param pt
+ * @return
+ */
+ @Override
+ public int getBlockLightLevel(Vector pt) {
+ final int x = pt.getBlockX();
+ final int y = pt.getBlockY();
+ final int z = pt.getBlockZ();
+ return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).getBlockLight(x, y, z);
+ }
+
+ /**
+ * Get biome type
+ *
+ * @param pt
+ * @return
+ */
+ public BiomeType getBiome(Vector2D pt) {
+ if (world.getGenerator() instanceof BiomeGenerator) {
+ BiomeGenerator gen = (BiomeGenerator) world.getGenerator();
+ return new SpoutBiomeType(gen.getBiome(pt.getBlockX(), pt.getBlockZ(), world.getSeed()));
+ }
+ return BiomeType.UNKNOWN;
+ }
+
+ public void setBiome(Vector2D pt, BiomeType biome) {
+ if (biome instanceof SpoutBiomeType &&
+ world.getGenerator() instanceof BiomeGenerator) {
+ throw new UnsupportedOperationException("Biome changing is not yet supported in Spout");
+ //BiomeGenerator gen = (BiomeGenerator) world.getGenerator();
+ //gen.setBiome(new Vector3(pt.getBlockX(), 0, pt.getBlockZ()), ((SpoutBiomeType) biome).getSpoutBiome());
+ }
+ }
+
+ /**
+ * Regenerate an area.
+ *
+ * @param region
+ * @param editSession
+ * @return
+ */
+ @Override
+ public boolean regenerate(Region region, EditSession editSession) {
+ /*BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)];
+
+ for (Vector2D chunk : region.getChunks()) {
+ Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
+
+ // First save all the blocks inside
+ for (int x = 0; x < 16; ++x) {
+ for (int y = 0; y < (getMaxY() + 1); ++y) {
+ for (int z = 0; z < 16; ++z) {
+ Vector pt = min.add(x, y, z);
+ int index = y * 16 * 16 + z * 16 + x;
+ history[index] = editSession.getBlock(pt);
+ }
+ }
+ }
+
+ try {
+ world.regenerateChunk(chunk.getBlockX(), chunk.getBlockZ());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ // Then restore
+ for (int x = 0; x < 16; ++x) {
+ for (int y = 0; y < (getMaxY() + 1); ++y) {
+ for (int z = 0; z < 16; ++z) {
+ Vector pt = min.add(x, y, z);
+ int index = y * 16 * 16 + z * 16 + x;
+
+ // We have to restore the block if it was outside
+ if (!region.contains(pt)) {
+ editSession.smartSetBlock(pt, history[index]);
+ } else { // Otherwise fool with history
+ editSession.rememberChange(pt, history[index],
+ editSession.rawGetBlock(pt));
+ }
+ }
+ }
+ }
+ }
+
+ return true;*/
+ return false;
+ }
+
+ /**
+ * Attempts to accurately copy a BaseBlock's extra data to the world.
+ *
+ * @param pt
+ * @param block
+ * @return
+ */
+ @Override
+ public boolean copyToWorld(Vector pt, BaseBlock block) {
+ /*if (block instanceof SignBlock) {
+ // Signs
+ setSignText(pt, ((SignBlock) block).getText());
+ return true;
+ }
+
+ if (block instanceof FurnaceBlock) {
+ // Furnaces
+ Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (bukkitBlock == null) return false;
+ BlockState state = bukkitBlock.getState();
+ if (!(state instanceof Furnace)) return false;
+ Furnace bukkit = (Furnace) state;
+ FurnaceBlock we = (FurnaceBlock) block;
+ bukkit.setBurnTime(we.getBurnTime());
+ bukkit.setCookTime(we.getCookTime());
+ return setContainerBlockContents(pt, ((ContainerBlock) block).getItems());
+ }
+
+ if (block instanceof ContainerBlock) {
+ // Chests/dispenser
+ return setContainerBlockContents(pt, ((ContainerBlock) block).getItems());
+ }
+
+ if (block instanceof MobSpawnerBlock) {
+ // Mob spawners
+ Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (bukkitBlock == null) return false;
+ BlockState state = bukkitBlock.getState();
+ if (!(state instanceof CreatureSpawner)) return false;
+ CreatureSpawner bukkit = (CreatureSpawner) state;
+ MobSpawnerBlock we = (MobSpawnerBlock) block;
+ bukkit.setCreatureTypeId(we.getMobType());
+ bukkit.setDelay(we.getDelay());
+ return true;
+ }
+
+ if (block instanceof NoteBlock) {
+ // Note block
+ Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (bukkitBlock == null) return false;
+ BlockState state = bukkitBlock.getState();
+ if (!(state instanceof org.bukkit.block.NoteBlock)) return false;
+ org.bukkit.block.NoteBlock bukkit = (org.bukkit.block.NoteBlock) state;
+ NoteBlock we = (NoteBlock) block;
+ bukkit.setRawNote(we.getNote());
+ return true;
+ }*/
+
+ return false;
+ }
+
+ /**
+ * Attempts to read a BaseBlock's extra data from the world.
+ *
+ * @param pt
+ * @param block
+ * @return
+ */
+ @Override
+ public boolean copyFromWorld(Vector pt, BaseBlock block) {
+ /*if (block instanceof SignBlock) {
+ // Signs
+ ((SignBlock) block).setText(getSignText(pt));
+ return true;
+ }
+
+ if (block instanceof FurnaceBlock) {
+ // Furnaces
+ Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (bukkitBlock == null) return false;
+ BlockState state = bukkitBlock.getState();
+ if (!(state instanceof Furnace)) return false;
+ Furnace bukkit = (Furnace) state;
+ FurnaceBlock we = (FurnaceBlock) block;
+ we.setBurnTime(bukkit.getBurnTime());
+ we.setCookTime(bukkit.getCookTime());
+ ((ContainerBlock) block).setItems(getContainerBlockContents(pt));
+ return true;
+ }
+
+ if (block instanceof ContainerBlock) {
+ // Chests/dispenser
+ ((ContainerBlock) block).setItems(getContainerBlockContents(pt));
+ return true;
+ }
+
+ if (block instanceof MobSpawnerBlock) {
+ // Mob spawners
+ Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (bukkitBlock == null) return false;
+ BlockState state = bukkitBlock.getState();
+ if (!(state instanceof CreatureSpawner)) return false;
+ CreatureSpawner bukkit = (CreatureSpawner) state;
+ MobSpawnerBlock we = (MobSpawnerBlock) block;
+ we.setMobType(bukkit.getCreatureTypeId());
+ we.setDelay((short) bukkit.getDelay());
+ return true;
+ }
+
+ if (block instanceof NoteBlock) {
+ // Note block
+ Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (bukkitBlock == null) return false;
+ BlockState state = bukkitBlock.getState();
+ if (!(state instanceof org.bukkit.block.NoteBlock)) return false;
+ org.bukkit.block.NoteBlock bukkit = (org.bukkit.block.NoteBlock) state;
+ NoteBlock we = (NoteBlock) block;
+ we.setNote(bukkit.getRawNote());
+ }*/
+
+ return false;
+ }
+
+ /**
+ * Clear a chest's contents.
+ *
+ * @param pt
+ */
+ @Override
+ public boolean clearContainerBlockContents(Vector pt) {
+ /* Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (block == null) {
+ return false;
+ }
+ BlockState state = block.getState();
+ if (!(state instanceof org.bukkit.block.ContainerBlock)) {
+ return false;
+ }
+
+ org.bukkit.block.ContainerBlock chest = (org.bukkit.block.ContainerBlock) state;
+ Inventory inven = chest.getInventory();
+ inven.clear();
+ return true;*/
+ return false;
+ }
+
+ @Override
+ public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pt)
+ throws MaxChangedBlocksException {
+ TreeObject tree = new SmallTreeObject(); //TODO: properly check for tree type
+ if (!tree.canPlaceObject(world, pt.getBlockX(), pt.getBlockY(), pt.getBlockZ())) {
+ return false;
+ }
+ tree.placeObject(world, pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ return true;
+ }
+
+ /**
+ * Drop an item.
+ *
+ * @param pt
+ * @param item
+ */
+ @Override
+ public void dropItem(Vector pt, BaseItemStack item) {
+ Material mat = VanillaMaterials.getMaterial((short) item.getType());
+ if (mat.hasSubMaterials()) {
+ mat = mat.getSubMaterial(item.getData());
+ }
+ ItemStack spoutItem = new ItemStack(mat, item.getData(), item.getAmount());
+ world.createEntity(SpoutUtil.toPoint(world, pt), Item.class).get(Item.class).setItemStack(spoutItem);
+ }
+
+ /**
+ * Kill mobs in an area.
+ *
+ * @param origin The center of the area to kill mobs in.
+ * @param radius Maximum distance to kill mobs at; radius < 0 means kill all mobs
+ * @param flags various flags that determine what to kill
+ * @return
+ */
+ @Override
+ public int killMobs(Vector origin, double radius, int flags) {
+ /*boolean killPets = (flags & KillFlags.PETS) != 0;
+ boolean killNPCs = (flags & KillFlags.NPCS) != 0;
+ boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;*/
+
+ int num = 0;
+ /*double radiusSq = radius * radius;
+
+ Point bukkitOrigin = SpoutUtil.toPoint(world, origin);
+
+
+ for (LivingEntity ent : world.getLivingEntities()) {
+ if (ent instanceof HumanEntity) {
+ continue;
+ }
+
+ if (!killAnimals && ent instanceof Animals) {
+ continue;
+ }
+
+ if (!killPets && ent instanceof Tameable && ((Tameable) ent).isTamed()) {
+ continue; // tamed wolf
+ }
+
+ try {
+ // Temporary solution until org.bukkit.entity.NPC is widely deployed.
+ if (!killNPCs && Class.forName("org.bukkit.entity.NPC").isAssignableFrom(ent.getClass())) {
+ continue;
+ }
+ } catch (ClassNotFoundException e) {}
+
+ if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
+ ent.remove();
+ ++num;
+ }
+ }*/
+
+ return num;
+ }
+
+ /**
+ * Remove entities in an area.
+ *
+ * @param origin
+ * @param radius
+ * @return
+ */
+ @Override
+ public int removeEntities(EntityType type, Vector origin, int radius) {
+ int num = 0;
+ double radiusSq = radius * radius;
+
+ for (Entity ent : world.getAll()) {
+ if (radius != -1
+ && origin.distanceSq(SpoutUtil.toVector(ent.getTransform().getPosition())) > radiusSq) {
+ continue;
+ }
+
+ if (type == EntityType.ARROWS) {
+ if (ent.has(Arrow.class)) {
+ ent.remove();
+ ++num;
+ }
+ } else if (type == EntityType.BOATS) {
+ if (ent.has(Boat.class)) {
+ ent.remove();
+ ++num;
+ }
+ } else if (type == EntityType.ITEMS) {
+ if (ent.has(Item.class)) {
+ ent.remove();
+ ++num;
+ }
+ } else if (type == EntityType.MINECARTS) {
+ if (ent.has(Minecart.class)) {
+ ent.remove();
+ ++num;
+ }
+ } else if (type == EntityType.PAINTINGS) {
+ if (ent.has(Painting.class)) {
+ ent.remove();
+ ++num;
+ }
+ } else if (type == EntityType.TNT) {
+ if (ent.has(Tnt.class)) {
+ ent.remove();
+ ++num;
+ }
+ } else if (type == EntityType.XP_ORBS) {
+ if (ent.has(XPOrb.class)) {
+ ent.remove();
+ ++num;
+ }
+ }
+ }
+
+ return num;
+ }
+
+ /**
+ * Set a sign's text.
+ *
+ * @param pt
+ * @param text
+ * @return
+ */
+ /*private boolean setSignText(Vector pt, String[] text) {
+ Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (block == null) return false;
+ BlockState state = block.getState();
+ if (state == null || !(state instanceof Sign)) return false;
+ Sign sign = (Sign) state;
+ sign.setLine(0, text[0]);
+ sign.setLine(1, text[1]);
+ sign.setLine(2, text[2]);
+ sign.setLine(3, text[3]);
+ sign.update();
+ return true;
+ }*/
+
+ /**
+ * Get a sign's text.
+ *
+ * @param pt
+ * @return
+ */
+ /*private String[] getSignText(Vector pt) {
+ Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (block == null) return new String[] { "", "", "", "" };
+ BlockState state = block.getState();
+ if (state == null || !(state instanceof Sign)) return new String[] { "", "", "", "" };
+ Sign sign = (Sign) state;
+ String line0 = sign.getLine(0);
+ String line1 = sign.getLine(1);
+ String line2 = sign.getLine(2);
+ String line3 = sign.getLine(3);
+ return new String[] {
+ line0 != null ? line0 : "",
+ line1 != null ? line1 : "",
+ line2 != null ? line2 : "",
+ line3 != null ? line3 : "",
+ };
+ }*/
+
+ /**
+ * Get a container block's contents.
+ *
+ * @param pt
+ * @return
+ */
+ /*private BaseItemStack[] getContainerBlockContents(Vector pt) {
+ Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (block == null) {
+ return new BaseItemStack[0];
+ }
+ BlockState state = block.getState();
+ if (!(state instanceof org.bukkit.block.ContainerBlock)) {
+ return new BaseItemStack[0];
+ }
+
+ org.bukkit.block.ContainerBlock container = (org.bukkit.block.ContainerBlock) state;
+ Inventory inven = container.getInventory();
+ int size = inven.getContents().length
+ BaseItemStack[] contents = new BaseItemStack[size];
+
+ for (int i = 0; i < size; ++i) {
+ ItemStack bukkitStack = inven.getItem(i);
+ if (bukkitStack.getMaterial() != MaterialData.air) {
+ contents[i] = new BaseItemStack(
+ bukkitStack.getMaterial().getRawId(),
+ bukkitStack.getAmount(),
+ bukkitStack.getDamage());
+ try {
+ for (Map.Entry entry : bukkitStack.getEnchantments().entrySet()) {
+ contents[i].getEnchantments().put(entry.getKey().getId(), entry.getValue());
+ }
+ } catch (Throwable ignore) {}
+ }
+ }
+
+ return contents;
+ }*/
+
+ /**
+ * Set a container block's contents.
+ *
+ * @param pt
+ * @param contents
+ * @return
+ */
+ /*private boolean setContainerBlockContents(Vector pt, BaseItemStack[] contents) {
+ Block block = world.getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
+ if (block == null) {
+ return false;
+ }
+ BlockState state = block.getState();
+ if (!(state instanceof org.bukkit.block.ContainerBlock)) {
+ return false;
+ }
+
+ org.bukkit.block.ContainerBlock chest = (org.bukkit.block.ContainerBlock) state;
+ Inventory inven = chest.getInventory();
+ int size = inven.getSize();
+
+ for (int i = 0; i < size; ++i) {
+ if (i >= contents.length) {
+ break;
+ }
+
+ if (contents[i] != null) {
+ ItemStack toAdd = new ItemStack(contents[i].getType(),
+ contents[i].getAmount(),
+ (byte) contents[i].getDamage());
+ try {
+ for (Map.Entry entry : contents[i].getEnchantments().entrySet()) {
+ toAdd.addEnchantment(Enchantment.getById(entry.getKey()), entry.getValue());
+ }
+ } catch (Throwable ignore) {}
+ inven.setItem(i, toAdd);
+ } else {
+ inven.setItem(i, null);
+ }
+ }
+
+ return true;
+ }*/
+
+ /**
+ * Returns whether a block has a valid ID.
+ *
+ * @param type
+ * @return
+ */
+ @Override
+ public boolean isValidBlockType(int type) {
+ return VanillaMaterials.getMaterial((short)type) instanceof BlockMaterial;
+ }
+
+ @Override
+ public void checkLoadedChunk(Vector pt) {
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof SpoutWorld)) {
+ return false;
+ }
+
+ return ((SpoutWorld) other).world.equals(world);
+ }
+
+ @Override
+ public int hashCode() {
+ return world.hashCode();
+ }
+
+ @Override
+ public int getMaxY() {
+ return world.getHeight() - 1;
+ }
+
+ @Override
+ public void fixAfterFastMode(Iterable chunks) {
+ /*for (BlockVector2D chunkPos : chunks) {
+ world.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ());
+ }*/
+ }
+
+ /*private static final Map effects = new HashMap();
+ static {
+ for (Effect effect : Effect.values()) {
+ effects.put(effect.getId(), effect);
+ }
+ }*/
+
+ @Override
+ public boolean playEffect(Vector position, int type, int data) {
+ /*final Effect effect = effects.get(type);
+ if (effect == null) {
+ return false;
+ }
+
+ world.playEffect(SpoutUtil.toLocation(world, position), effect, data);
+
+ return true;
+ */
+ return false;
+ }
+
+ @Override
+ public SpoutEntity[] getEntities(Region region) {
+ List entities = new ArrayList();
+ for (Vector pt : region.getChunkCubes()) {
+ Chunk chunk = world.getChunkFromBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), LoadOption.LOAD_GEN);
+ if (chunk == null) {
+ continue;
+ }
+ for (Entity ent : chunk.getEntities()) {
+ if (region.contains(SpoutUtil.toVector(ent.getTransform().getPosition()))) {
+ Collection> revisedComponents = Collections2.transform(ent.values(), new Function>() {
+ @Override
+ public Class extends Component> apply(@Nullable Component component) {
+ return component == null ? null : component.getClass();
+ }
+ });
+ entities.add(new SpoutEntity(SpoutUtil.toLocation(ent), ent.getId(), revisedComponents, ent.getData().getBaseMap())); // TODO:; Fix entity adding
+ }
+ }
+ }
+ return entities.toArray(new SpoutEntity[entities.size()]);
+ }
+
+ @Override
+ public int killEntities(LocalEntity... entities) {
+ int amount = 0;
+ for (LocalEntity weEnt : entities) {
+ SpoutEntity entity = (SpoutEntity) weEnt;
+ Entity spoutEntity = world.getEntity(entity.getEntityId());
+ if (spoutEntity != null) {
+ spoutEntity.remove();
+ ++amount;
+ }
+ }
+ return amount;
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java b/src/spout/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java
rename to src/spout/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditCUIMessage.java b/src/spout/java/com/sk89q/worldedit/spout/WorldEditCUIMessage.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/WorldEditCUIMessage.java
rename to src/spout/java/com/sk89q/worldedit/spout/WorldEditCUIMessage.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditCUIMessageHandler.java b/src/spout/java/com/sk89q/worldedit/spout/WorldEditCUIMessageHandler.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/spout/WorldEditCUIMessageHandler.java
rename to src/spout/java/com/sk89q/worldedit/spout/WorldEditCUIMessageHandler.java
diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java b/src/spout/java/com/sk89q/worldedit/spout/WorldEditListener.java
similarity index 97%
rename from src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java
rename to src/spout/java/com/sk89q/worldedit/spout/WorldEditListener.java
index 8b78c5b0f..59f7b7151 100644
--- a/src/main/java/com/sk89q/worldedit/spout/WorldEditListener.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/WorldEditListener.java
@@ -1,176 +1,176 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.worldedit.LocalPlayer;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.WorldVector;
-import org.spout.api.Spout;
-import org.spout.api.chat.ChatArguments;
-import org.spout.api.chat.ChatSection;
-import org.spout.api.event.EventHandler;
-import org.spout.api.event.Listener;
-import org.spout.api.event.Order;
-import org.spout.api.event.player.PlayerInteractEvent;
-import org.spout.api.event.player.PlayerInteractEvent.Action;
-import org.spout.api.event.player.PlayerLeaveEvent;
-import org.spout.api.event.server.PreCommandEvent;
-import org.spout.api.event.world.WorldLoadEvent;
-import org.spout.api.generator.biome.BiomeGenerator;
-import org.spout.api.geo.discrete.Point;
-import org.spout.api.scheduler.TaskPriority;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Handles all events thrown in relation to a Player
- */
-public class WorldEditListener implements Listener {
- /**
- * Plugin.
- */
- private WorldEditPlugin plugin;
-
- private boolean ignoreLeftClickAir = false;
-
- /**
- * Construct the object;
- *
- * @param plugin
- */
- public WorldEditListener(WorldEditPlugin plugin) {
- this.plugin = plugin;
- }
-
- /**
- * Called when a player leaves a server
- *
- * @param event Relevant event details
- */
- @EventHandler
- public void onPlayerQuit(PlayerLeaveEvent event) {
- plugin.getWorldEdit().markExpire(plugin.wrapPlayer(event.getPlayer()));
- }
-
- /**
- * Called when a player attempts to use a command
- *
- * @param event Relevant event details
- */
- @EventHandler(order = Order.EARLY)
- public void onPlayerCommandPreprocess(PreCommandEvent event) {
-
- if (event.getCommand().startsWith("nowe:")) {
- event.setCommand(event.getCommand().substring(5));
- return;
- }
-
- List args = event.getArguments().toSections(ChatSection.SplitType.WORD);
- if (args.size() > 0) {
- String[] split = new String[args.size() + 1];
- split[0] = "/" + event.getCommand();
- for (int i = 0; i < args.size(); ++i) {
- split[i + 1] = args.get(i).getPlainString();
- }
-
- String[] newSplit = plugin.getWorldEdit().commandDetection(split);
- if (!Arrays.equals(split, newSplit)) {
- event.setCommand(newSplit[0]);
- ChatArguments newArgs = new ChatArguments();
- for (int i = 1; i < newSplit.length; ++i) {
- newArgs.append(newSplit[i]);
- }
- event.setArguments(newArgs);
- }
- }
- }
-
- /**
- * Called when a player interacts
- *
- * @param event Relevant event details
- */
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent event) {
-
- final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
- final LocalWorld world = player.getWorld();
- final WorldEdit we = plugin.getWorldEdit();
-
- PlayerInteractEvent.Action action = event.getAction();
- if (action == Action.LEFT_CLICK) {
- if (event.isAir() && ignoreLeftClickAir) {
- return;
- }
-
- if (!event.isAir()) {
- final Point clickedBlock = event.getInteractedPoint();
- final WorldVector pos = new WorldVector(world, clickedBlock.getBlockX(),
- clickedBlock.getBlockY(), clickedBlock.getBlockZ());
-
-
- if (we.handleBlockLeftClick(player, pos)) {
- event.setCancelled(true);
- }
- }
-
- if (we.handleArmSwing(player)) {
- event.setCancelled(true);
- }
-
- if (!event.isAir() && !ignoreLeftClickAir) {
- final int taskId = Spout.getEngine().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
- public void run() {
- ignoreLeftClickAir = false;
- }
- }, 100, TaskPriority.NORMAL);
-
- if (taskId != -1) {
- ignoreLeftClickAir = true;
- }
- }
- } else if (action == Action.RIGHT_CLICK) {
- if (!event.isAir()) {
- final Point clickedBlock = event.getInteractedPoint();
- final WorldVector pos = new WorldVector(world, clickedBlock.getBlockX(),
- clickedBlock.getBlockY(), clickedBlock.getBlockZ());
-
- if (we.handleBlockRightClick(player, pos)) {
- event.setCancelled(true);
- }
- }
-
- if (we.handleRightClick(player)) {
- event.setCancelled(true);
- }
- }
- }
-
- @EventHandler
- public void onWorldLoad(WorldLoadEvent event) {
- if (event.getWorld().getGenerator() instanceof BiomeGenerator) {
- plugin.getServerInterface().getBiomes().registerBiomeTypes((BiomeGenerator) event.getWorld().getGenerator());
- }
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.worldedit.LocalPlayer;
+import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.WorldVector;
+import org.spout.api.Spout;
+import org.spout.api.chat.ChatArguments;
+import org.spout.api.chat.ChatSection;
+import org.spout.api.event.EventHandler;
+import org.spout.api.event.Listener;
+import org.spout.api.event.Order;
+import org.spout.api.event.player.PlayerInteractEvent;
+import org.spout.api.event.player.PlayerInteractEvent.Action;
+import org.spout.api.event.player.PlayerLeaveEvent;
+import org.spout.api.event.server.PreCommandEvent;
+import org.spout.api.event.world.WorldLoadEvent;
+import org.spout.api.generator.biome.BiomeGenerator;
+import org.spout.api.geo.discrete.Point;
+import org.spout.api.scheduler.TaskPriority;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Handles all events thrown in relation to a Player
+ */
+public class WorldEditListener implements Listener {
+ /**
+ * Plugin.
+ */
+ private WorldEditPlugin plugin;
+
+ private boolean ignoreLeftClickAir = false;
+
+ /**
+ * Construct the object;
+ *
+ * @param plugin
+ */
+ public WorldEditListener(WorldEditPlugin plugin) {
+ this.plugin = plugin;
+ }
+
+ /**
+ * Called when a player leaves a server
+ *
+ * @param event Relevant event details
+ */
+ @EventHandler
+ public void onPlayerQuit(PlayerLeaveEvent event) {
+ plugin.getWorldEdit().markExpire(plugin.wrapPlayer(event.getPlayer()));
+ }
+
+ /**
+ * Called when a player attempts to use a command
+ *
+ * @param event Relevant event details
+ */
+ @EventHandler(order = Order.EARLY)
+ public void onPlayerCommandPreprocess(PreCommandEvent event) {
+
+ if (event.getCommand().startsWith("nowe:")) {
+ event.setCommand(event.getCommand().substring(5));
+ return;
+ }
+
+ List args = event.getArguments().toSections(ChatSection.SplitType.WORD);
+ if (args.size() > 0) {
+ String[] split = new String[args.size() + 1];
+ split[0] = "/" + event.getCommand();
+ for (int i = 0; i < args.size(); ++i) {
+ split[i + 1] = args.get(i).getPlainString();
+ }
+
+ String[] newSplit = plugin.getWorldEdit().commandDetection(split);
+ if (!Arrays.equals(split, newSplit)) {
+ event.setCommand(newSplit[0]);
+ ChatArguments newArgs = new ChatArguments();
+ for (int i = 1; i < newSplit.length; ++i) {
+ newArgs.append(newSplit[i]);
+ }
+ event.setArguments(newArgs);
+ }
+ }
+ }
+
+ /**
+ * Called when a player interacts
+ *
+ * @param event Relevant event details
+ */
+ @EventHandler
+ public void onPlayerInteract(PlayerInteractEvent event) {
+
+ final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
+ final LocalWorld world = player.getWorld();
+ final WorldEdit we = plugin.getWorldEdit();
+
+ PlayerInteractEvent.Action action = event.getAction();
+ if (action == Action.LEFT_CLICK) {
+ if (event.isAir() && ignoreLeftClickAir) {
+ return;
+ }
+
+ if (!event.isAir()) {
+ final Point clickedBlock = event.getInteractedPoint();
+ final WorldVector pos = new WorldVector(world, clickedBlock.getBlockX(),
+ clickedBlock.getBlockY(), clickedBlock.getBlockZ());
+
+
+ if (we.handleBlockLeftClick(player, pos)) {
+ event.setCancelled(true);
+ }
+ }
+
+ if (we.handleArmSwing(player)) {
+ event.setCancelled(true);
+ }
+
+ if (!event.isAir() && !ignoreLeftClickAir) {
+ final int taskId = Spout.getEngine().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
+ public void run() {
+ ignoreLeftClickAir = false;
+ }
+ }, 100, TaskPriority.NORMAL);
+
+ if (taskId != -1) {
+ ignoreLeftClickAir = true;
+ }
+ }
+ } else if (action == Action.RIGHT_CLICK) {
+ if (!event.isAir()) {
+ final Point clickedBlock = event.getInteractedPoint();
+ final WorldVector pos = new WorldVector(world, clickedBlock.getBlockX(),
+ clickedBlock.getBlockY(), clickedBlock.getBlockZ());
+
+ if (we.handleBlockRightClick(player, pos)) {
+ event.setCancelled(true);
+ }
+ }
+
+ if (we.handleRightClick(player)) {
+ event.setCancelled(true);
+ }
+ }
+ }
+
+ @EventHandler
+ public void onWorldLoad(WorldLoadEvent event) {
+ if (event.getWorld().getGenerator() instanceof BiomeGenerator) {
+ plugin.getServerInterface().getBiomes().registerBiomeTypes((BiomeGenerator) event.getWorld().getGenerator());
+ }
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java b/src/spout/java/com/sk89q/worldedit/spout/WorldEditPlugin.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java
rename to src/spout/java/com/sk89q/worldedit/spout/WorldEditPlugin.java
index c9dbaff34..773ef0f8e 100644
--- a/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/WorldEditPlugin.java
@@ -1,359 +1,359 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout;
-
-import com.sk89q.util.yaml.YAMLProcessor;
-import com.sk89q.worldedit.*;
-import com.sk89q.worldedit.bags.BlockBag;
-import com.sk89q.worldedit.regions.CuboidRegion;
-import com.sk89q.worldedit.regions.Polygonal2DRegion;
-import com.sk89q.worldedit.regions.Region;
-import com.sk89q.worldedit.regions.RegionSelector;
-import com.sk89q.worldedit.spout.selections.CuboidSelection;
-import com.sk89q.worldedit.spout.selections.Polygonal2DSelection;
-import com.sk89q.worldedit.spout.selections.Selection;
-import com.sk89q.worldedit.util.YAMLConfiguration;
-import org.spout.api.Server;
-import org.spout.api.command.CommandSource;
-import org.spout.api.geo.World;
-import org.spout.api.entity.Player;
-import org.spout.api.plugin.CommonPlugin;
-import org.spout.api.protocol.Protocol;
-import org.spout.api.scheduler.TaskPriority;
-
-import java.io.*;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-
-/**
- * Plugin for Spout.
- *
- * @author sk89q
- */
-public class WorldEditPlugin extends CommonPlugin {
- /**
- * The server interface that all server-related API goes through.
- */
- private SpoutServerInterface server;
- /**
- * Main WorldEdit instance.
- */
- private WorldEdit controller;
-
- /**
- * Holds the configuration for WorldEdit.
- */
- private YAMLConfiguration config;
-
- private static WorldEditPlugin instance;
- {
- instance = this;
- }
-
- /**
- * Called on plugin enable.
- */
- public void onEnable() {
- final String pluginYmlVersion = getDescription().getVersion();
- final String manifestVersion = WorldEdit.getVersion();
-
- getLogger().info("WorldEdit " + pluginYmlVersion + " enabled.");
- if (!manifestVersion.equalsIgnoreCase(pluginYmlVersion)) {
- WorldEdit.setVersion(manifestVersion + " (" + pluginYmlVersion + ")");
- }
-
- // Make the data folders that WorldEdit uses
- getDataFolder().mkdirs();
-
- // Create the default configuration file
- createDefaultConfiguration("config.yml");
-
- // Set up configuration and such, including the permissions
- // resolver
- config = new SpoutConfiguration(new YAMLProcessor(new File(getDataFolder(), "config.yml"), true), this);
-
- // Load the configuration
- loadConfiguration();
-
- // Setup interfaces
- server = new SpoutServerInterface(this, getEngine());
- controller = new WorldEdit(server, config);
-
- // Now we can register events!
- registerEvents();
-
- for (Protocol proto : Protocol.getProtocols()) {
- proto.registerPacket(WorldEditCUICodec.class, new WorldEditCUIMessageHandler(this));
- }
-
- getEngine().getScheduler().scheduleAsyncRepeatingTask(this,
- new SessionTimer(controller, getServer()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST);
- }
-
- public Server getServer() {
- if (!(getEngine() instanceof Server)) {
- throw new IllegalStateException("WorldEdit must be running on a server for this operation!");
- }
-
- return (Server) getEngine();
- }
-
- /**
- * Called on plugin disable.
- */
- public void onDisable() {
- controller.clearSessions();
- config.unload();
- getEngine().getScheduler().cancelTasks(this);
- }
-
- /**
- * Loads and reloads all configuration.
- */
- protected void loadConfiguration() {
- config.unload();
- config.load();
- }
-
- /**
- * Register the events used by WorldEdit.
- */
- protected void registerEvents() {
- getEngine().getEventManager().registerEvents(new WorldEditListener(this), this);
- }
-
- /**
- * Create a default configuration file from the .jar.
- *
- * @param name
- */
- protected void createDefaultConfiguration(String name) {
- File actual = new File(getDataFolder(), name);
- if (!actual.exists()) {
- InputStream input =
- null;
- try {
- JarFile file = new JarFile(getFile());
- ZipEntry copy = file.getEntry("defaults/" + name);
- if (copy == null) throw new FileNotFoundException();
- input = file.getInputStream(copy);
- } catch (IOException e) {
- getLogger().severe("Unable to read default configuration: " + name);
- }
- if (input != null) {
- FileOutputStream output = null;
-
- try {
- output = new FileOutputStream(actual);
- byte[] buf = new byte[8192];
- int length = 0;
- while ((length = input.read(buf)) > 0) {
- output.write(buf, 0, length);
- }
-
- getLogger().info("Default configuration file written: " + name);
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- input.close();
- } catch (IOException ignore) {}
-
- try {
- if (output != null) {
- output.close();
- }
- } catch (IOException ignore) {}
- }
- }
- }
- }
-
- /**
- * Gets the session for the player.
- *
- * @param player
- * @return
- */
- public LocalSession getSession(Player player) {
- return controller.getSession(wrapPlayer(player));
- }
-
- /**
- * Gets the session for the player.
- *
- * @param player
- * @return
- */
- public EditSession createEditSession(Player player) {
- LocalPlayer wePlayer = wrapPlayer(player);
- LocalSession session = controller.getSession(wePlayer);
- BlockBag blockBag = session.getBlockBag(wePlayer);
-
- EditSession editSession =
- new EditSession(wePlayer.getWorld(), session.getBlockChangeLimit(), blockBag);
- editSession.enableQueue();
-
- return editSession;
- }
-
- /**
- * Remember an edit session.
- *
- * @param player
- * @param editSession
- */
- public void remember(Player player, EditSession editSession) {
- LocalPlayer wePlayer = wrapPlayer(player);
- LocalSession session = controller.getSession(wePlayer);
-
- session.remember(editSession);
- editSession.flushQueue();
-
- controller.flushBlockBag(wePlayer, editSession);
- }
-
- /**
- * Wrap an operation into an EditSession.
- *
- * @param player
- * @param op
- * @throws Throwable
- */
- public void perform(Player player, WorldEditOperation op)
- throws Throwable {
- LocalPlayer wePlayer = wrapPlayer(player);
- LocalSession session = controller.getSession(wePlayer);
-
- EditSession editSession = createEditSession(player);
- try {
- op.run(session, wePlayer, editSession);
- } finally {
- remember(player, editSession);
- }
- }
-
- /**
- * Returns the configuration used by WorldEdit.
- *
- * @return
- */
- public YAMLConfiguration getLocalConfiguration() {
- return config;
- }
-
- /**
- * Used to wrap a Bukkit Player as a LocalPlayer.
- *
- * @param player
- * @return
- */
- public SpoutPlayer wrapPlayer(Player player) {
- return new SpoutPlayer(this, this.server, player);
- }
-
- public LocalPlayer wrapCommandSender(CommandSource sender) {
- if (sender instanceof Player) {
- return wrapPlayer((Player) sender);
- }
-
- return new SpoutCommandSender(this, this.server, sender);
- }
-
- /**
- * Get the server interface.
- *
- * @return
- */
- public SpoutServerInterface getServerInterface() {
- return server;
- }
-
- /**
- * Get WorldEdit.
- *
- * @return
- */
- public WorldEdit getWorldEdit() {
- return controller;
- }
-
- /**
- * Gets the region selection for the player.
- *
- * @param player
- * @return the selection or null if there was none
- */
- public Selection getSelection(Player player) {
- if (player == null) {
- throw new IllegalArgumentException("Null player not allowed");
- }
- if (!player.isOnline()) {
- throw new IllegalArgumentException("Offline player not allowed");
- }
-
- LocalSession session = controller.getSession(wrapPlayer(player));
- RegionSelector selector = session.getRegionSelector(SpoutUtil.getLocalWorld(player.getWorld()));
-
- try {
- Region region = selector.getRegion();
- World world = ((SpoutWorld) session.getSelectionWorld()).getWorld();
-
- if (region instanceof CuboidRegion) {
- return new CuboidSelection(world, selector, (CuboidRegion) region);
- } else if (region instanceof Polygonal2DRegion) {
- return new Polygonal2DSelection(world, selector, (Polygonal2DRegion) region);
- } else {
- return null;
- }
- } catch (IncompleteRegionException e) {
- return null;
- }
- }
-
- /**
- * Sets the region selection for a player.
- *
- * @param player
- * @param selection
- */
- public void setSelection(Player player, Selection selection) {
- if (player == null) {
- throw new IllegalArgumentException("Null player not allowed");
- }
- if (!player.isOnline()) {
- throw new IllegalArgumentException("Offline player not allowed");
- }
- if (selection == null) {
- throw new IllegalArgumentException("Null selection not allowed");
- }
-
- LocalSession session = controller.getSession(wrapPlayer(player));
- RegionSelector sel = selection.getRegionSelector();
- session.setRegionSelector(SpoutUtil.getLocalWorld(player.getWorld()), sel);
- session.dispatchCUISelection(wrapPlayer(player));
- }
-
- static WorldEditPlugin getInstance() {
- return instance;
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout;
+
+import com.sk89q.util.yaml.YAMLProcessor;
+import com.sk89q.worldedit.*;
+import com.sk89q.worldedit.bags.BlockBag;
+import com.sk89q.worldedit.regions.CuboidRegion;
+import com.sk89q.worldedit.regions.Polygonal2DRegion;
+import com.sk89q.worldedit.regions.Region;
+import com.sk89q.worldedit.regions.RegionSelector;
+import com.sk89q.worldedit.spout.selections.CuboidSelection;
+import com.sk89q.worldedit.spout.selections.Polygonal2DSelection;
+import com.sk89q.worldedit.spout.selections.Selection;
+import com.sk89q.worldedit.util.YAMLConfiguration;
+import org.spout.api.Server;
+import org.spout.api.command.CommandSource;
+import org.spout.api.geo.World;
+import org.spout.api.entity.Player;
+import org.spout.api.plugin.CommonPlugin;
+import org.spout.api.protocol.Protocol;
+import org.spout.api.scheduler.TaskPriority;
+
+import java.io.*;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+/**
+ * Plugin for Spout.
+ *
+ * @author sk89q
+ */
+public class WorldEditPlugin extends CommonPlugin {
+ /**
+ * The server interface that all server-related API goes through.
+ */
+ private SpoutServerInterface server;
+ /**
+ * Main WorldEdit instance.
+ */
+ private WorldEdit controller;
+
+ /**
+ * Holds the configuration for WorldEdit.
+ */
+ private YAMLConfiguration config;
+
+ private static WorldEditPlugin instance;
+ {
+ instance = this;
+ }
+
+ /**
+ * Called on plugin enable.
+ */
+ public void onEnable() {
+ final String pluginYmlVersion = getDescription().getVersion();
+ final String manifestVersion = WorldEdit.getVersion();
+
+ getLogger().info("WorldEdit " + pluginYmlVersion + " enabled.");
+ if (!manifestVersion.equalsIgnoreCase(pluginYmlVersion)) {
+ WorldEdit.setVersion(manifestVersion + " (" + pluginYmlVersion + ")");
+ }
+
+ // Make the data folders that WorldEdit uses
+ getDataFolder().mkdirs();
+
+ // Create the default configuration file
+ createDefaultConfiguration("config.yml");
+
+ // Set up configuration and such, including the permissions
+ // resolver
+ config = new SpoutConfiguration(new YAMLProcessor(new File(getDataFolder(), "config.yml"), true), this);
+
+ // Load the configuration
+ loadConfiguration();
+
+ // Setup interfaces
+ server = new SpoutServerInterface(this, getEngine());
+ controller = new WorldEdit(server, config);
+
+ // Now we can register events!
+ registerEvents();
+
+ for (Protocol proto : Protocol.getProtocols()) {
+ proto.registerPacket(WorldEditCUICodec.class, new WorldEditCUIMessageHandler(this));
+ }
+
+ getEngine().getScheduler().scheduleAsyncRepeatingTask(this,
+ new SessionTimer(controller, getServer()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST);
+ }
+
+ public Server getServer() {
+ if (!(getEngine() instanceof Server)) {
+ throw new IllegalStateException("WorldEdit must be running on a server for this operation!");
+ }
+
+ return (Server) getEngine();
+ }
+
+ /**
+ * Called on plugin disable.
+ */
+ public void onDisable() {
+ controller.clearSessions();
+ config.unload();
+ getEngine().getScheduler().cancelTasks(this);
+ }
+
+ /**
+ * Loads and reloads all configuration.
+ */
+ protected void loadConfiguration() {
+ config.unload();
+ config.load();
+ }
+
+ /**
+ * Register the events used by WorldEdit.
+ */
+ protected void registerEvents() {
+ getEngine().getEventManager().registerEvents(new WorldEditListener(this), this);
+ }
+
+ /**
+ * Create a default configuration file from the .jar.
+ *
+ * @param name
+ */
+ protected void createDefaultConfiguration(String name) {
+ File actual = new File(getDataFolder(), name);
+ if (!actual.exists()) {
+ InputStream input =
+ null;
+ try {
+ JarFile file = new JarFile(getFile());
+ ZipEntry copy = file.getEntry("defaults/" + name);
+ if (copy == null) throw new FileNotFoundException();
+ input = file.getInputStream(copy);
+ } catch (IOException e) {
+ getLogger().severe("Unable to read default configuration: " + name);
+ }
+ if (input != null) {
+ FileOutputStream output = null;
+
+ try {
+ output = new FileOutputStream(actual);
+ byte[] buf = new byte[8192];
+ int length = 0;
+ while ((length = input.read(buf)) > 0) {
+ output.write(buf, 0, length);
+ }
+
+ getLogger().info("Default configuration file written: " + name);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ input.close();
+ } catch (IOException ignore) {}
+
+ try {
+ if (output != null) {
+ output.close();
+ }
+ } catch (IOException ignore) {}
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets the session for the player.
+ *
+ * @param player
+ * @return
+ */
+ public LocalSession getSession(Player player) {
+ return controller.getSession(wrapPlayer(player));
+ }
+
+ /**
+ * Gets the session for the player.
+ *
+ * @param player
+ * @return
+ */
+ public EditSession createEditSession(Player player) {
+ LocalPlayer wePlayer = wrapPlayer(player);
+ LocalSession session = controller.getSession(wePlayer);
+ BlockBag blockBag = session.getBlockBag(wePlayer);
+
+ EditSession editSession =
+ new EditSession(wePlayer.getWorld(), session.getBlockChangeLimit(), blockBag);
+ editSession.enableQueue();
+
+ return editSession;
+ }
+
+ /**
+ * Remember an edit session.
+ *
+ * @param player
+ * @param editSession
+ */
+ public void remember(Player player, EditSession editSession) {
+ LocalPlayer wePlayer = wrapPlayer(player);
+ LocalSession session = controller.getSession(wePlayer);
+
+ session.remember(editSession);
+ editSession.flushQueue();
+
+ controller.flushBlockBag(wePlayer, editSession);
+ }
+
+ /**
+ * Wrap an operation into an EditSession.
+ *
+ * @param player
+ * @param op
+ * @throws Throwable
+ */
+ public void perform(Player player, WorldEditOperation op)
+ throws Throwable {
+ LocalPlayer wePlayer = wrapPlayer(player);
+ LocalSession session = controller.getSession(wePlayer);
+
+ EditSession editSession = createEditSession(player);
+ try {
+ op.run(session, wePlayer, editSession);
+ } finally {
+ remember(player, editSession);
+ }
+ }
+
+ /**
+ * Returns the configuration used by WorldEdit.
+ *
+ * @return
+ */
+ public YAMLConfiguration getLocalConfiguration() {
+ return config;
+ }
+
+ /**
+ * Used to wrap a Bukkit Player as a LocalPlayer.
+ *
+ * @param player
+ * @return
+ */
+ public SpoutPlayer wrapPlayer(Player player) {
+ return new SpoutPlayer(this, this.server, player);
+ }
+
+ public LocalPlayer wrapCommandSender(CommandSource sender) {
+ if (sender instanceof Player) {
+ return wrapPlayer((Player) sender);
+ }
+
+ return new SpoutCommandSender(this, this.server, sender);
+ }
+
+ /**
+ * Get the server interface.
+ *
+ * @return
+ */
+ public SpoutServerInterface getServerInterface() {
+ return server;
+ }
+
+ /**
+ * Get WorldEdit.
+ *
+ * @return
+ */
+ public WorldEdit getWorldEdit() {
+ return controller;
+ }
+
+ /**
+ * Gets the region selection for the player.
+ *
+ * @param player
+ * @return the selection or null if there was none
+ */
+ public Selection getSelection(Player player) {
+ if (player == null) {
+ throw new IllegalArgumentException("Null player not allowed");
+ }
+ if (!player.isOnline()) {
+ throw new IllegalArgumentException("Offline player not allowed");
+ }
+
+ LocalSession session = controller.getSession(wrapPlayer(player));
+ RegionSelector selector = session.getRegionSelector(SpoutUtil.getLocalWorld(player.getWorld()));
+
+ try {
+ Region region = selector.getRegion();
+ World world = ((SpoutWorld) session.getSelectionWorld()).getWorld();
+
+ if (region instanceof CuboidRegion) {
+ return new CuboidSelection(world, selector, (CuboidRegion) region);
+ } else if (region instanceof Polygonal2DRegion) {
+ return new Polygonal2DSelection(world, selector, (Polygonal2DRegion) region);
+ } else {
+ return null;
+ }
+ } catch (IncompleteRegionException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Sets the region selection for a player.
+ *
+ * @param player
+ * @param selection
+ */
+ public void setSelection(Player player, Selection selection) {
+ if (player == null) {
+ throw new IllegalArgumentException("Null player not allowed");
+ }
+ if (!player.isOnline()) {
+ throw new IllegalArgumentException("Offline player not allowed");
+ }
+ if (selection == null) {
+ throw new IllegalArgumentException("Null selection not allowed");
+ }
+
+ LocalSession session = controller.getSession(wrapPlayer(player));
+ RegionSelector sel = selection.getRegionSelector();
+ session.setRegionSelector(SpoutUtil.getLocalWorld(player.getWorld()), sel);
+ session.dispatchCUISelection(wrapPlayer(player));
+ }
+
+ static WorldEditPlugin getInstance() {
+ return instance;
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/selections/CuboidSelection.java b/src/spout/java/com/sk89q/worldedit/spout/selections/CuboidSelection.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/spout/selections/CuboidSelection.java
rename to src/spout/java/com/sk89q/worldedit/spout/selections/CuboidSelection.java
index 88010978c..299210bc3 100644
--- a/src/main/java/com/sk89q/worldedit/spout/selections/CuboidSelection.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/selections/CuboidSelection.java
@@ -1,71 +1,71 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout.selections;
-
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.spout.SpoutUtil;
-import com.sk89q.worldedit.regions.CuboidRegion;
-import com.sk89q.worldedit.regions.CuboidRegionSelector;
-import com.sk89q.worldedit.regions.RegionSelector;
-import org.spout.api.geo.World;
-import org.spout.api.geo.discrete.Point;
-
-public class CuboidSelection extends RegionSelection {
-
- protected CuboidRegion cuboid;
-
- public CuboidSelection(World world, Point pt1, Point pt2) {
- this(world, SpoutUtil.toVector(pt1), SpoutUtil.toVector(pt2));
- }
-
- public CuboidSelection(World world, Vector pt1, Vector pt2) {
- super(world);
-
- // Validate input
- if (pt1 == null) {
- throw new IllegalArgumentException("Null point 1 not permitted");
- }
-
- if (pt2 == null) {
- throw new IllegalArgumentException("Null point 2 not permitted");
- }
-
- // Create new selector
- CuboidRegionSelector sel = new CuboidRegionSelector(SpoutUtil.getLocalWorld(world));
-
- // set up selector
- sel.selectPrimary(pt1);
- sel.selectSecondary(pt2);
-
- // set up CuboidSelection
- cuboid = sel.getIncompleteRegion();
-
- // set up RegionSelection
- setRegionSelector(sel);
- setRegion(cuboid);
- }
-
- public CuboidSelection(World world, RegionSelector sel, CuboidRegion region) {
- super(world, sel, region);
- this.cuboid = region;
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout.selections;
+
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.spout.SpoutUtil;
+import com.sk89q.worldedit.regions.CuboidRegion;
+import com.sk89q.worldedit.regions.CuboidRegionSelector;
+import com.sk89q.worldedit.regions.RegionSelector;
+import org.spout.api.geo.World;
+import org.spout.api.geo.discrete.Point;
+
+public class CuboidSelection extends RegionSelection {
+
+ protected CuboidRegion cuboid;
+
+ public CuboidSelection(World world, Point pt1, Point pt2) {
+ this(world, SpoutUtil.toVector(pt1), SpoutUtil.toVector(pt2));
+ }
+
+ public CuboidSelection(World world, Vector pt1, Vector pt2) {
+ super(world);
+
+ // Validate input
+ if (pt1 == null) {
+ throw new IllegalArgumentException("Null point 1 not permitted");
+ }
+
+ if (pt2 == null) {
+ throw new IllegalArgumentException("Null point 2 not permitted");
+ }
+
+ // Create new selector
+ CuboidRegionSelector sel = new CuboidRegionSelector(SpoutUtil.getLocalWorld(world));
+
+ // set up selector
+ sel.selectPrimary(pt1);
+ sel.selectSecondary(pt2);
+
+ // set up CuboidSelection
+ cuboid = sel.getIncompleteRegion();
+
+ // set up RegionSelection
+ setRegionSelector(sel);
+ setRegion(cuboid);
+ }
+
+ public CuboidSelection(World world, RegionSelector sel, CuboidRegion region) {
+ super(world, sel, region);
+ this.cuboid = region;
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/selections/Polygonal2DSelection.java b/src/spout/java/com/sk89q/worldedit/spout/selections/Polygonal2DSelection.java
similarity index 97%
rename from src/main/java/com/sk89q/worldedit/spout/selections/Polygonal2DSelection.java
rename to src/spout/java/com/sk89q/worldedit/spout/selections/Polygonal2DSelection.java
index ac441c75b..9ebd8a0f9 100644
--- a/src/main/java/com/sk89q/worldedit/spout/selections/Polygonal2DSelection.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/selections/Polygonal2DSelection.java
@@ -1,66 +1,66 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout.selections;
-
-import com.sk89q.worldedit.BlockVector2D;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.regions.Polygonal2DRegion;
-import com.sk89q.worldedit.regions.Polygonal2DRegionSelector;
-import com.sk89q.worldedit.regions.RegionSelector;
-import com.sk89q.worldedit.spout.SpoutUtil;
-import org.spout.api.geo.World;
-
-import java.util.Collections;
-import java.util.List;
-
-public class Polygonal2DSelection extends RegionSelection {
-
- protected Polygonal2DRegion poly2d;
-
- public Polygonal2DSelection(World world, RegionSelector sel, Polygonal2DRegion region) {
- super(world, sel, region);
- this.poly2d = region;
- }
-
- public Polygonal2DSelection(World world, List points, int minY, int maxY) {
- super(world);
- LocalWorld lWorld = SpoutUtil.getLocalWorld(world);
-
- // Validate input
- minY = Math.min(Math.max(0, minY), world.getHeight());
- maxY = Math.min(Math.max(0, maxY), world.getHeight());
-
- // Create and set up new selector
- Polygonal2DRegionSelector sel = new Polygonal2DRegionSelector(lWorld, points, minY, maxY);
-
- // set up CuboidSelection
- poly2d = sel.getIncompleteRegion();
-
- // set up RegionSelection
- setRegionSelector(sel);
- setRegion(poly2d);
- }
-
- public List getNativePoints() {
- return Collections.unmodifiableList(poly2d.getPoints());
- }
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout.selections;
+
+import com.sk89q.worldedit.BlockVector2D;
+import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.regions.Polygonal2DRegion;
+import com.sk89q.worldedit.regions.Polygonal2DRegionSelector;
+import com.sk89q.worldedit.regions.RegionSelector;
+import com.sk89q.worldedit.spout.SpoutUtil;
+import org.spout.api.geo.World;
+
+import java.util.Collections;
+import java.util.List;
+
+public class Polygonal2DSelection extends RegionSelection {
+
+ protected Polygonal2DRegion poly2d;
+
+ public Polygonal2DSelection(World world, RegionSelector sel, Polygonal2DRegion region) {
+ super(world, sel, region);
+ this.poly2d = region;
+ }
+
+ public Polygonal2DSelection(World world, List points, int minY, int maxY) {
+ super(world);
+ LocalWorld lWorld = SpoutUtil.getLocalWorld(world);
+
+ // Validate input
+ minY = Math.min(Math.max(0, minY), world.getHeight());
+ maxY = Math.min(Math.max(0, maxY), world.getHeight());
+
+ // Create and set up new selector
+ Polygonal2DRegionSelector sel = new Polygonal2DRegionSelector(lWorld, points, minY, maxY);
+
+ // set up CuboidSelection
+ poly2d = sel.getIncompleteRegion();
+
+ // set up RegionSelection
+ setRegionSelector(sel);
+ setRegion(poly2d);
+ }
+
+ public List getNativePoints() {
+ return Collections.unmodifiableList(poly2d.getPoints());
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/selections/RegionSelection.java b/src/spout/java/com/sk89q/worldedit/spout/selections/RegionSelection.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/spout/selections/RegionSelection.java
rename to src/spout/java/com/sk89q/worldedit/spout/selections/RegionSelection.java
index 015be8e6a..8b49063f2 100644
--- a/src/main/java/com/sk89q/worldedit/spout/selections/RegionSelection.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/selections/RegionSelection.java
@@ -1,107 +1,107 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout.selections;
-
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.regions.Region;
-import com.sk89q.worldedit.regions.RegionSelector;
-import com.sk89q.worldedit.spout.SpoutUtil;
-import org.spout.api.geo.World;
-import org.spout.api.geo.discrete.Point;
-
-public abstract class RegionSelection implements Selection {
-
- private World world;
- private RegionSelector selector;
- private Region region;
-
- public RegionSelection(World world) {
- this.world = world;
- }
-
- public RegionSelection(World world, RegionSelector selector, Region region) {
- this.world = world;
- this.region = region;
- this.selector = selector;
- }
-
- protected Region getRegion() {
- return region;
- }
-
- protected void setRegion(Region region) {
- this.region = region;
- }
-
- public RegionSelector getRegionSelector() {
- return selector;
- }
-
- protected void setRegionSelector(RegionSelector selector) {
- this.selector = selector;
- }
-
- public Point getMinimumPoint() {
- return SpoutUtil.toPoint(world, region.getMinimumPoint());
- }
-
- public Vector getNativeMinimumPoint() {
- return region.getMinimumPoint();
- }
-
- public Point getMaximumPoint() {
- return SpoutUtil.toPoint(world, region.getMaximumPoint());
- }
-
- public Vector getNativeMaximumPoint() {
- return region.getMaximumPoint();
- }
-
- public World getWorld() {
- return world;
- }
-
- public int getArea() {
- return region.getArea();
- }
-
- public int getWidth() {
- return region.getWidth();
- }
-
- public int getHeight() {
- return region.getHeight();
- }
-
- public int getLength() {
- return region.getLength();
- }
-
- public boolean contains(Point pt) {
- if (!pt.getWorld().equals(world)) {
- return false;
- }
-
- return region.contains(SpoutUtil.toVector(pt));
- }
-
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout.selections;
+
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.regions.Region;
+import com.sk89q.worldedit.regions.RegionSelector;
+import com.sk89q.worldedit.spout.SpoutUtil;
+import org.spout.api.geo.World;
+import org.spout.api.geo.discrete.Point;
+
+public abstract class RegionSelection implements Selection {
+
+ private World world;
+ private RegionSelector selector;
+ private Region region;
+
+ public RegionSelection(World world) {
+ this.world = world;
+ }
+
+ public RegionSelection(World world, RegionSelector selector, Region region) {
+ this.world = world;
+ this.region = region;
+ this.selector = selector;
+ }
+
+ protected Region getRegion() {
+ return region;
+ }
+
+ protected void setRegion(Region region) {
+ this.region = region;
+ }
+
+ public RegionSelector getRegionSelector() {
+ return selector;
+ }
+
+ protected void setRegionSelector(RegionSelector selector) {
+ this.selector = selector;
+ }
+
+ public Point getMinimumPoint() {
+ return SpoutUtil.toPoint(world, region.getMinimumPoint());
+ }
+
+ public Vector getNativeMinimumPoint() {
+ return region.getMinimumPoint();
+ }
+
+ public Point getMaximumPoint() {
+ return SpoutUtil.toPoint(world, region.getMaximumPoint());
+ }
+
+ public Vector getNativeMaximumPoint() {
+ return region.getMaximumPoint();
+ }
+
+ public World getWorld() {
+ return world;
+ }
+
+ public int getArea() {
+ return region.getArea();
+ }
+
+ public int getWidth() {
+ return region.getWidth();
+ }
+
+ public int getHeight() {
+ return region.getHeight();
+ }
+
+ public int getLength() {
+ return region.getLength();
+ }
+
+ public boolean contains(Point pt) {
+ if (!pt.getWorld().equals(world)) {
+ return false;
+ }
+
+ return region.contains(SpoutUtil.toVector(pt));
+ }
+
+}
diff --git a/src/main/java/com/sk89q/worldedit/spout/selections/Selection.java b/src/spout/java/com/sk89q/worldedit/spout/selections/Selection.java
similarity index 95%
rename from src/main/java/com/sk89q/worldedit/spout/selections/Selection.java
rename to src/spout/java/com/sk89q/worldedit/spout/selections/Selection.java
index 561f5b8f7..5f83c5712 100644
--- a/src/main/java/com/sk89q/worldedit/spout/selections/Selection.java
+++ b/src/spout/java/com/sk89q/worldedit/spout/selections/Selection.java
@@ -1,107 +1,107 @@
-/*
- * WorldEdit
- * Copyright (C) 2012 sk89q and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-// $Id$
-
-
-package com.sk89q.worldedit.spout.selections;
-
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.regions.RegionSelector;
-import org.spout.api.geo.World;
-import org.spout.api.geo.discrete.Point;
-
-public interface Selection {
- /**
- * Get the lower point of a region.
- *
- * @return min. point
- */
- public Point getMinimumPoint();
-
- /**
- * Get the lower point of a region.
- *
- * @return min. point
- */
- public Vector getNativeMinimumPoint();
-
- /**
- * Get the upper point of a region.
- *
- * @return max. point
- */
- public Point getMaximumPoint();
-
- /**
- * Get the upper point of a region.
- *
- * @return max. point
- */
- public Vector getNativeMaximumPoint();
-
- /**
- * Get the region selector. This is for internal use.
- *
- * @return
- */
- public RegionSelector getRegionSelector();
-
- /**
- * Get the world.
- *
- * @return
- */
- public World getWorld();
-
- /**
- * Get the number of blocks in the region.
- *
- * @return number of blocks
- */
- public int getArea();
-
- /**
- * Get X-size.
- *
- * @return width
- */
- public int getWidth();
-
- /**
- * Get Y-size.
- *
- * @return height
- */
- public int getHeight();
-
- /**
- * Get Z-size.
- *
- * @return length
- */
- public int getLength();
-
- /**
- * Returns true based on whether the region contains the point,
- *
- * @param pt
- * @return
- */
- public boolean contains(Point pt);
-}
+/*
+ * WorldEdit
+ * Copyright (C) 2012 sk89q and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// $Id$
+
+
+package com.sk89q.worldedit.spout.selections;
+
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.regions.RegionSelector;
+import org.spout.api.geo.World;
+import org.spout.api.geo.discrete.Point;
+
+public interface Selection {
+ /**
+ * Get the lower point of a region.
+ *
+ * @return min. point
+ */
+ public Point getMinimumPoint();
+
+ /**
+ * Get the lower point of a region.
+ *
+ * @return min. point
+ */
+ public Vector getNativeMinimumPoint();
+
+ /**
+ * Get the upper point of a region.
+ *
+ * @return max. point
+ */
+ public Point getMaximumPoint();
+
+ /**
+ * Get the upper point of a region.
+ *
+ * @return max. point
+ */
+ public Vector getNativeMaximumPoint();
+
+ /**
+ * Get the region selector. This is for internal use.
+ *
+ * @return
+ */
+ public RegionSelector getRegionSelector();
+
+ /**
+ * Get the world.
+ *
+ * @return
+ */
+ public World getWorld();
+
+ /**
+ * Get the number of blocks in the region.
+ *
+ * @return number of blocks
+ */
+ public int getArea();
+
+ /**
+ * Get X-size.
+ *
+ * @return width
+ */
+ public int getWidth();
+
+ /**
+ * Get Y-size.
+ *
+ * @return height
+ */
+ public int getHeight();
+
+ /**
+ * Get Z-size.
+ *
+ * @return length
+ */
+ public int getLength();
+
+ /**
+ * Returns true based on whether the region contains the point,
+ *
+ * @param pt
+ * @return
+ */
+ public boolean contains(Point pt);
+}