mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 04:23:54 +00:00
Merge remote-tracking branch 'origin/master' into feature/sponge-new
This commit is contained in:
@ -22,6 +22,7 @@ package com.sk89q.worldedit.blocks;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.util.gson.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -33,6 +34,8 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
||||
|
||||
private String[] text;
|
||||
|
||||
private static String EMPTY = "{\"text\":\"\"}";
|
||||
|
||||
/**
|
||||
* Construct the sign without text.
|
||||
*
|
||||
@ -41,7 +44,7 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
||||
*/
|
||||
public SignBlock(int type, int data) {
|
||||
super(type, data);
|
||||
this.text = new String[] { "", "", "", "" };
|
||||
this.text = new String[] { EMPTY, EMPTY, EMPTY, EMPTY };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,7 +57,15 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
||||
public SignBlock(int type, int data, String[] text) {
|
||||
super(type, data);
|
||||
if (text == null) {
|
||||
this.text = new String[] { "", "", "", "" };
|
||||
this.text = new String[] { EMPTY, EMPTY, EMPTY, EMPTY };
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < text.length; i++) {
|
||||
if (text[i].isEmpty()) {
|
||||
text[i] = EMPTY;
|
||||
} else {
|
||||
text[i] = "{\"text\":\"" + GsonUtil.stringValue(text[i]) + "\"}";
|
||||
}
|
||||
}
|
||||
this.text = text;
|
||||
}
|
||||
@ -110,7 +121,7 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
||||
|
||||
Tag t;
|
||||
|
||||
text = new String[] { "", "", "", "" };
|
||||
text = new String[] { EMPTY, EMPTY, EMPTY, EMPTY };
|
||||
|
||||
t = values.get("id");
|
||||
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Sign")) {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@ import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
import com.sk89q.worldedit.world.registry.LegacyBlockRegistry;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
@ -35,6 +36,8 @@ import java.util.Set;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@Ignore("Old BlockData class needs to be updated manually. Current block definitions are in blocks.json, " +
|
||||
"which is automatically generated and generally accurate.")
|
||||
public class BlockTransformExtentTest {
|
||||
|
||||
private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90);
|
||||
|
Reference in New Issue
Block a user