Merge remote-tracking branch 'origin/master' into feature/sponge-new

This commit is contained in:
Wyatt Childers
2016-05-18 19:49:16 -04:00
35 changed files with 11685 additions and 3515 deletions

View File

@ -23,6 +23,7 @@ import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.PlayerDirection;
import javax.annotation.Nullable;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@ -497,6 +498,11 @@ public enum BlockType {
static {
shouldPlaceFinal.add(BlockID.SIGN_POST);
shouldPlaceFinal.add(BlockID.WOODEN_DOOR);
shouldPlaceFinal.add(BlockID.ACACIA_DOOR);
shouldPlaceFinal.add(BlockID.BIRCH_DOOR);
shouldPlaceFinal.add(BlockID.JUNGLE_DOOR);
shouldPlaceFinal.add(BlockID.DARK_OAK_DOOR);
shouldPlaceFinal.add(BlockID.SPRUCE_DOOR);
shouldPlaceFinal.add(BlockID.WALL_SIGN);
shouldPlaceFinal.add(BlockID.IRON_DOOR);
shouldPlaceFinal.add(BlockID.CACTUS);
@ -920,6 +926,11 @@ public enum BlockType {
isRedstoneBlock.add(BlockID.STONE_BUTTON);
isRedstoneBlock.add(BlockID.REDSTONE_WIRE);
isRedstoneBlock.add(BlockID.WOODEN_DOOR);
isRedstoneBlock.add(BlockID.ACACIA_DOOR);
isRedstoneBlock.add(BlockID.BIRCH_DOOR);
isRedstoneBlock.add(BlockID.JUNGLE_DOOR);
isRedstoneBlock.add(BlockID.DARK_OAK_DOOR);
isRedstoneBlock.add(BlockID.SPRUCE_DOOR);
isRedstoneBlock.add(BlockID.IRON_DOOR);
isRedstoneBlock.add(BlockID.TNT);
isRedstoneBlock.add(BlockID.DISPENSER);
@ -1510,6 +1521,12 @@ public enum BlockType {
addIdentity(BlockID.PACKED_ICE);
addIdentities(BlockID.STAINED_GLASS_PANE, 16);
addIdentities(BlockID.DOUBLE_PLANT, 6);
addIdentities(BlockID.ACACIA_DOOR, 8); // rule 2
addIdentities(BlockID.BIRCH_DOOR, 8); // rule 2
addIdentities(BlockID.JUNGLE_DOOR, 8); // rule 2
addIdentities(BlockID.DARK_OAK_DOOR, 8); // rule 2
addIdentities(BlockID.SPRUCE_DOOR, 8); // rule 2
}
/**

View File

@ -263,7 +263,7 @@ public class SchematicCommands {
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir);
List<File> fileList = allFiles(dir);
if (fileList.isEmpty()) {
if (fileList == null || fileList.isEmpty()) {
actor.printError("No schematics found.");
return;
}

View File

@ -395,6 +395,10 @@ public class UtilityCommands {
// there might be a better way to do this but my brain is fried right now
if (args.argsLength() > 0) { // user inputted radius, override the default
radius = args.getInteger(0);
if (radius < -1) {
actor.printError("Use -1 to remove all mobs in loaded chunks");
return;
}
if (config.butcherMaxRadius != -1) { // clamp if there is a max
if (radius == -1) {
radius = config.butcherMaxRadius;

View File

@ -22,11 +22,22 @@ package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.blocks.*;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ClothColor;
import com.sk89q.worldedit.blocks.MobSpawnerBlock;
import com.sk89q.worldedit.blocks.NoteBlock;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.registry.BundledBlockData;
import com.sk89q.worldedit.world.registry.State;
import com.sk89q.worldedit.world.registry.StateValue;
import java.util.Map;
import java.util.Map.Entry;
/**
* Looks up information about a block.
@ -64,6 +75,28 @@ public class QueryTool implements BlockTool {
+ ClothColor.fromID(block.getData()).getName());
}
Map<String, ? extends State> states = BundledBlockData.getInstance().getStatesById(block.getId());
if (states == null || states.isEmpty()) return true;
StringBuilder builder = new StringBuilder();
builder.append("States: ");
boolean first = true;
for (Entry<String, ? extends State> e : states.entrySet()) {
String name = e.getKey();
State state = e.getValue();
if (!first) {
builder.append(", ");
}
first = false;
String valName = "";
for (Entry<String, ? extends StateValue> entry : state.valueMap().entrySet()) {
if (entry.getValue().isSet(block)) {
valName = entry.getKey();
}
}
builder.append("\u00A79").append(name).append(": \u00A7f").append(valName != null ? valName : "set");
}
player.printRaw(builder.toString());
return true;
}

View File

@ -154,6 +154,11 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
switch (type) {
case BlockID.WOODEN_DOOR:
case BlockID.ACACIA_DOOR:
case BlockID.BIRCH_DOOR:
case BlockID.JUNGLE_DOOR:
case BlockID.DARK_OAK_DOOR:
case BlockID.SPRUCE_DOOR:
case BlockID.IRON_DOOR:
if ((data & 0x8) == 0) {
// Deal with lower door halves being attached to the floor AND the upper half

View File

@ -0,0 +1,46 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.util;
import com.google.common.base.Joiner;
import com.sk89q.worldedit.WorldEdit;
public final class Java8Detector {
public static void notifyIfNot8() {
String[] ver = System.getProperty("java.version").split("\\.");
int major = Integer.parseInt(ver[1]);
if (major <= 7) {
// Implicitly java 7 because we compile against 7, so this won't
// even launch on 6.
WorldEdit.logger.warning(
"WorldEdit has detected you are using Java 7"
+ " (based on detected version "
+ Joiner.on('.').join(ver) + ").");
WorldEdit.logger.warning(
"WorldEdit will stop supporting Java less than version 8 in the future,"
+ " due to Java 7 being EOL since April 2015."
+ " Please update your server to Java 8.");
}
}
private Java8Detector() {
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.util.gson;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.sk89q.worldedit.Vector;
@ -41,4 +42,8 @@ public final class GsonUtil {
return gsonBuilder;
}
private static final Gson gson = new Gson();
public static String stringValue(String s) {
return gson.toJson(s);
}
}