Permalink
Browse files

Merge master into feature/sponge-1.9.4

  • Loading branch information...
Minecrell committed Jun 19, 2016
2 parents cbb3637 + f689d53 commit 87efcdc125c2db0685142657edfc0b984c8449c1
@@ -27,7 +27,6 @@
import com.sk89q.worldedit.WorldVector;
import com.sk89q.worldedit.internal.LocalWorldAdapter;
import com.sk89q.worldedit.world.World;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler;
@@ -45,7 +44,6 @@
public class WorldEditListener implements Listener {
private WorldEditPlugin plugin;
private boolean ignoreLeftClickAir = false;
/**
* Called when a player plays an animation, such as an arm swing
@@ -143,22 +141,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
event.setCancelled(true);
}
if (!ignoreLeftClickAir) {
final int taskId = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
ignoreLeftClickAir = false;
}
}, 2);
if (taskId != -1) {
ignoreLeftClickAir = true;
}
}
} else if (action == Action.LEFT_CLICK_AIR) {
if (ignoreLeftClickAir) {
return;
}
if (we.handleArmSwing(player)) {
event.setCancelled(true);
@@ -64,7 +64,7 @@ public SignBlock(int type, int data, String[] text) {
if (text[i].isEmpty()) {
text[i] = EMPTY;
} else {
text[i] = "{\"text\":\"" + GsonUtil.stringValue(text[i]) + "\"}";
text[i] = "{\"text\":" + GsonUtil.stringValue(text[i]) + "}";
}
}
this.text = text;
@@ -227,6 +227,27 @@
public static final int JUNGLE_DOOR = 195;
public static final int ACACIA_DOOR = 196;
public static final int DARK_OAK_DOOR = 197;
public static final int END_ROD = 198;
public static final int CHORUS_PLANT = 199;
public static final int CHORUS_FLOWER = 200;
public static final int PURPUR_BLOCK = 201;
public static final int PURPUR_PILLAR = 202;
public static final int PURPUR_STAIRS = 203;
public static final int PURPUR_DOUBLE_SLAB = 204;
public static final int PURPUR_SLAB = 205;
public static final int END_BRICKS = 206;
public static final int BEETROOTS = 207;
public static final int GRASS_PATH = 208;
public static final int END_GATEWAY = 209;
public static final int REPEATING_COMMAND_BLOCK = 210;
public static final int CHAIN_COMMAND_BLOCK = 211;
public static final int FROSTED_ICE = 212;
public static final int MAGMA_BLOCK = 213;
public static final int NETHER_WART_BLOCK = 214;
public static final int RED_NETHER_BRICK = 215;
public static final int BONE_BLOCK = 216;
public static final int STRUCTURE_VOID = 217;
public static final int STRUCTURE_BLOCK = 255;
private BlockID() {
}
@@ -236,7 +236,28 @@
BIRCH_DOOR(BlockID.BIRCH_DOOR, "Birch Door", "birchdoor"),
JUNGLE_DOOR(BlockID.JUNGLE_DOOR, "Jungle Door", "jungledoor"),
ACACIA_DOOR(BlockID.ACACIA_DOOR, "Acacia Door", "acaciadoor"),
DARK_OAK_DOOR(BlockID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor");
DARK_OAK_DOOR(BlockID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"),
END_ROD(BlockID.END_ROD, "End Rod", "endrod", "endtorch"),
CHORUS_PLANT(BlockID.CHORUS_PLANT, "Chorus Plant", "chorusplant", "chorusstem"),
CHORUS_FLOWER(BlockID.CHORUS_FLOWER, "Chorus Flower", "chorusflower"),
PURPUR_BLOCK(BlockID.PURPUR_BLOCK, "Purpur Block", "purpurblock", "blockpurpur"),
PURPUR_PILLAR(BlockID.PURPUR_PILLAR, "Purpur Pillar", "purpurpillar"),
PURPUR_STAIRS(BlockID.PURPUR_STAIRS, "Purpur Stairs", "purpurstairs"),
PURPUR_DOUBLE_SLAB(BlockID.PURPUR_DOUBLE_SLAB, "Purpur Double Slab", "purpurdoubleslab", "doubleslabpurpur", "doublepurpurslab"),
PURPUR_SLAB(BlockID.PURPUR_SLAB, "Purpur Slab", "purpurslab", "slabpurpur"),
END_BRICKS(BlockID.END_BRICKS, "End Bricks", "endbricks"),
BEETROOTS(BlockID.BEETROOTS, "Beetroots", "beetroots", "beetroot_plant"),
GRASS_PATH(BlockID.GRASS_PATH, "Grass Path", "grasspath", "dirtpath"),
END_GATEWAY(BlockID.END_GATEWAY, "End Gateway", "endgateway"),
REPEATING_COMMAND_BLOCK(BlockID.REPEATING_COMMAND_BLOCK, "Repeating Command Block", "repeatingcommandblock", "commandblockrepeating"),
CHAIN_COMMAND_BLOCK(BlockID.CHAIN_COMMAND_BLOCK, "Chain Command Block", "chaincommandblock", "commandblockchain"),
FROSTED_ICE(BlockID.FROSTED_ICE, "Frosted Ice", "frostedice", "frostwalkerice"),
MAGMA_BLOCK(BlockID.MAGMA_BLOCK, "Magma Block", "magmablock", "magma"),
NETHER_WART_BLOCK(BlockID.NETHER_WART_BLOCK, "Nether Wart Block", "netherwartblock"),
RED_NETHER_BRICK(BlockID.RED_NETHER_BRICK, "Red Nether Brick", "rednetherbrick", "netherbrickred"),
BONE_BLOCK(BlockID.BONE_BLOCK, "Bone Block", "boneblock", "blockbone", "fossil", "fossilblock", "blockfossil"),
STRUCTURE_VOID(BlockID.STRUCTURE_VOID, "Structure Void", "structurevoid", "structureair"),
STRUCTURE_BLOCK(BlockID.STRUCTURE_BLOCK, "Structure Block", "structureblock");
/**
* Stores a map of the IDs for fast access.
@@ -186,12 +186,29 @@
public static final int MUTTON = 423;
public static final int COOKED_MUTTON = 424;
public static final int BANNER = 425;
// Nothing at 456
public static final int END_CRYSTAL = 426;
public static final int SPRUCE_DOOR = 427;
public static final int BIRCH_DOOR = 428;
public static final int JUNGLE_DOOR = 429;
public static final int ACACIA_DOOR = 430;
public static final int DARK_OAK_DOOR = 431;
public static final int CHORUS_FRUIT = 432;
public static final int CHORUS_FRUIT_POPPED = 433;
public static final int BEETROOT = 434;
public static final int BEETROOT_SEEDS = 435;
public static final int BEETROOT_SOUP = 436;
public static final int DRAGON_BREATH = 437;
public static final int SPLASH_POTION = 438;
public static final int SPECTRAL_ARROW = 439;
public static final int TIPPED_ARROW = 440;
public static final int LINGERING_POTION = 441;
public static final int SHIELD = 442;
public static final int ELYTRA = 443;
public static final int SPRUCE_BOAT = 444;
public static final int BIRCH_BOAT = 445;
public static final int JUNGLE_BOAT = 446;
public static final int ACACIA_BOAT = 447;
public static final int DARK_OAK_BOAT = 448;
@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
@@ -208,6 +208,28 @@
PACKED_ICE(BlockID.PACKED_ICE, "Packed Ice", "packedice", "hardice"),
DOUBLE_PLANT(BlockID.DOUBLE_PLANT, "Large Flowers", "largeflowers", "doubleflowers"),
DARK_OAK_DOOR(BlockID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"),
END_ROD(BlockID.END_ROD, "End Rod", "endrod", "endtorch"),
CHORUS_PLANT(BlockID.CHORUS_PLANT, "Chorus Plant", "chorusplant", "chorusstem"),
CHORUS_FLOWER(BlockID.CHORUS_FLOWER, "Chorus Flower", "chorusflower"),
PURPUR_BLOCK(BlockID.PURPUR_BLOCK, "Purpur Block", "purpurblock", "blockpurpur"),
PURPUR_PILLAR(BlockID.PURPUR_PILLAR, "Purpur Pillar", "purpurpillar"),
PURPUR_STAIRS(BlockID.PURPUR_STAIRS, "Purpur Stairs", "purpurstairs"),
PURPUR_DOUBLE_SLAB(BlockID.PURPUR_DOUBLE_SLAB, "Purpur Double Slab", "purpurdoubleslab", "doubleslabpurpur", "doublepurpurslab"),
PURPUR_SLAB(BlockID.PURPUR_SLAB, "Purpur Slab", "purpurslab", "slabpurpur"),
END_BRICKS(BlockID.END_BRICKS, "End Bricks", "endbricks"),
BEETROOTS(BlockID.BEETROOTS, "Beetroots", "beetroots", "beetroot_plant"),
GRASS_PATH(BlockID.GRASS_PATH, "Grass Path", "grasspath", "dirtpath"),
END_GATEWAY(BlockID.END_GATEWAY, "End Gateway", "endgateway"),
REPEATING_COMMAND_BLOCK(BlockID.REPEATING_COMMAND_BLOCK, "Repeating Command Block", "repeatingcommandblock", "commandblockrepeating"),
CHAIN_COMMAND_BLOCK(BlockID.CHAIN_COMMAND_BLOCK, "Chain Command Block", "chaincommandblock", "commandblockchain"),
FROSTED_ICE(BlockID.FROSTED_ICE, "Frosted Ice", "frostedice", "frostwalkerice"),
MAGMA_BLOCK(BlockID.MAGMA_BLOCK, "Magma Block", "magmablock", "magma"),
NETHER_WART_BLOCK(BlockID.NETHER_WART_BLOCK, "Nether Wart Block", "netherwartblock"),
RED_NETHER_BRICK(BlockID.RED_NETHER_BRICK, "Red Nether Brick", "rednetherbrick", "netherbrickred"),
BONE_BLOCK(BlockID.BONE_BLOCK, "Bone Block", "boneblock", "blockbone", "fossil", "fossilblock", "blockfossil"),
STRUCTURE_VOID(BlockID.STRUCTURE_VOID, "Structure Void", "structurevoid", "structureair"),
STRUCTURE_BLOCK(BlockID.STRUCTURE_BLOCK, "Structure Block", "structureblock"),
// Items
IRON_SHOVEL(ItemID.IRON_SHOVEL, "Iron shovel", "ironshovel"),
@@ -372,12 +394,30 @@
MUTTON(ItemID.MUTTON, "Mutton", "mutton", "rawmutton"),
COOKED_MUTTON(ItemID.COOKED_MUTTON, "Cooked Mutton", "cookedmutton"),
BANNER(ItemID.BANNER, "Banner", "banner"),
// Nothing at 456
SPRUCE_DOOR(ItemID.SPRUCE_DOOR, "Spruce Door", "sprucedoor"),
BIRCH_DOOR(ItemID.BIRCH_DOOR, "Birch Door", "birchdoor"),
JUNGLE_DOOR(ItemID.JUNGLE_DOOR, "Jungle Door", "jungledoor"),
ACACIA_DOOR(ItemID.ACACIA_DOOR, "Acacia Door", "acaciadoor"),
DARK_OAK_DOOR(ItemID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"),
END_CRYSTAL(ItemID.END_CRYSTAL, "End Crystal", "endcrystal"),
SPRUCE_DOOR_ITEM(ItemID.SPRUCE_DOOR, "Spruce Door", "sprucedoor"),
BIRCH_DOOR_ITEM(ItemID.BIRCH_DOOR, "Birch Door", "birchdoor"),
JUNGLE_DOOR_ITEM(ItemID.JUNGLE_DOOR, "Jungle Door", "jungledoor"),
ACACIA_DOOR_ITEM(ItemID.ACACIA_DOOR, "Acacia Door", "acaciadoor"),
DARK_OAK_DOOR_ITEM(ItemID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"),
CHORUS_FRUIT(ItemID.CHORUS_FRUIT, "Chorus Fruit", "chorusfruit"),
CHORUS_FRUIT_POPPED(ItemID.CHORUS_FRUIT_POPPED, "Popped Chorus Fruit", "poppedchorusfruit", "chorusfruitpopped", "cookedchorusfruit"),
BEETROOT(ItemID.BEETROOT, "Beetroot", "beetroot"),
BEETROOT_SEEDS(ItemID.BEETROOT_SEEDS, "Beetroot Seeds", "beetrootseeds"),
BEETROOT_SOUP(ItemID.BEETROOT_SOUP, "Beetroot Soup", "beetrootsoup"),
DRAGON_BREATH(ItemID.DRAGON_BREATH, "Dragon Breath", "dragonbreath"),
SPLASH_POTION(ItemID.SPLASH_POTION, "Splash Potion", "splashpotion", "potionsplash"),
SPECTRAL_ARROW(ItemID.SPECTRAL_ARROW, "Spectral Arrow", "spectralarrow", "glowingarrow"),
TIPPED_ARROW(ItemID.TIPPED_ARROW, "Tipped Arrow", "tippedarrow", "potionarrow"),
LINGERING_POTION(ItemID.LINGERING_POTION, "Lingering Potion", "lingeringpotion", "potionlingering"),
SHIELD(ItemID.SHIELD, "Shield", "shield"),
ELYTRA(ItemID.ELYTRA, "Elytra", "elytra", "wings"),
SPRUCE_BOAT(ItemID.SPRUCE_BOAT, "Spruce Boat", "spruceboat", "boatspruce"),
BIRCH_BOAT(ItemID.BIRCH_BOAT, "Birch Boat", "birchboat", "boatbirch"),
JUNGLE_BOAT(ItemID.JUNGLE_BOAT, "Jungle Boat", "jungleboat", "boatjungle"),
ACACIA_BOAT(ItemID.ACACIA_BOAT, "Acacia Boat", "acaciaboat", "boatacacia"),
DARK_OAK_BOAT(ItemID.DARK_OAK_BOAT, "Dark Oak Boat", "darkoakboat", "boatdarkoak"),
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"),
@@ -55,12 +55,37 @@ private static BaseBlock getBlockInHand(Actor actor) throws InputParseException
}
@Override
public BaseBlock parseFromInput(String input, ParserContext context) throws InputParseException {
// TODO: Rewrite this entire method to use BaseBlocks and ignore BlockType, as well as to properly handle mod:name IDs
public BaseBlock parseFromInput(String input, ParserContext context)
throws InputParseException {
// TODO: Rewrite this entire method to use BaseBlocks and ignore
// BlockType, as well as to properly handle mod:name IDs
BlockType blockType;
String originalInput = input;
input = input.replace("_", " ");
input = input.replace(";", "|");
Exception suppressed = null;
try {
BaseBlock modified = parseLogic(input, context);
if (modified != null) {
return modified;
}
} catch (Exception e) {
suppressed = e;
}
try {
return parseLogic(originalInput, context);
} catch (Exception e) {
if (suppressed != null) {
e.addSuppressed(suppressed);
}
throw e;
}
}
private BaseBlock parseLogic(String input, ParserContext context)
throws InputParseException, NoMatchException,
DisallowedUsageException {
BlockType blockType;
String[] blockAndExtraData = input.split("\\|");
String[] blockLocator = blockAndExtraData[0].split(":", 3);
String[] typeAndData;
@@ -118,12 +143,12 @@ public BaseBlock parseFromInput(String input, ParserContext context) throws Inpu
blockType = BlockType.lookup(testId);
if (blockType == null) {
int t = worldEdit.getServer().resolveItem(testId);
if (t > 0) {
if (t >= 0) {
blockType = BlockType.fromID(t); // Could be null
blockId = t;
} else if (blockLocator.length == 2) { // Block IDs in MC 1.7 and above use mod:name
t = worldEdit.getServer().resolveItem(blockAndExtraData[0]);
if (t > 0) {
if (t >= 0) {
blockType = BlockType.fromID(t); // Could be null
blockId = t;
typeAndData = new String[] { blockAndExtraData[0] };
@@ -69,7 +69,7 @@ public int resolveItem(String name) {
int index = name.indexOf(':');
if (index != -1 && index != 0 && index != name.length() - 1) {
if (index != 0 && index != name.length() - 1) {
Block block = Block.getBlockFromName(name);
if (block != null) {
return Block.getIdFromBlock(block);
@@ -87,7 +87,7 @@ public int resolveItem(String name) {
}
if (item.getUnlocalizedName().equalsIgnoreCase(name)) return Item.getIdFromItem(item);
}
return 0;
return -1;
}
@Override

0 comments on commit 87efcdc

Please sign in to comment.