mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 13:45:36 +01:00
Workaround for WorldEdit's sign bug
This commit is contained in:
parent
2012d56900
commit
aa06bc19d2
@ -2,6 +2,7 @@ package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.util.FaweQueue;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -93,6 +94,12 @@ public class FastWorldEditExtent extends FaweExtent {
|
||||
final int y = location.getBlockY();
|
||||
final int z = location.getBlockZ();
|
||||
switch (id) {
|
||||
case 63:
|
||||
case 68:
|
||||
if (block.hasNbtData() && !MainUtil.isValidSign(block.getNbtData())) {
|
||||
queue.setBlock(x, y, z, id, FaweCache.hasData(id) ? (byte) block.getData() : 0);
|
||||
return true;
|
||||
}
|
||||
case 54:
|
||||
case 130:
|
||||
case 142:
|
||||
@ -106,9 +113,7 @@ public class FastWorldEditExtent extends FaweExtent {
|
||||
case 138:
|
||||
case 176:
|
||||
case 177:
|
||||
case 63:
|
||||
case 119:
|
||||
case 68:
|
||||
case 323:
|
||||
case 117:
|
||||
case 116:
|
||||
|
@ -5,6 +5,7 @@ import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.util.FaweQueue;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
@ -108,7 +109,13 @@ public class ProcessedWEExtent extends FaweExtent {
|
||||
@Override
|
||||
public boolean setBlock(final Vector location, final BaseBlock block) throws WorldEditException {
|
||||
final short id = (short) block.getType();
|
||||
boolean nbt = true;
|
||||
switch (id) {
|
||||
case 63:
|
||||
case 68:
|
||||
if (block.hasNbtData() && !MainUtil.isValidSign(block.getNbtData())) {
|
||||
nbt = false;
|
||||
}
|
||||
case 54:
|
||||
case 130:
|
||||
case 142:
|
||||
@ -122,9 +129,7 @@ public class ProcessedWEExtent extends FaweExtent {
|
||||
case 138:
|
||||
case 176:
|
||||
case 177:
|
||||
case 63:
|
||||
case 119:
|
||||
case 68:
|
||||
case 323:
|
||||
case 117:
|
||||
case 116:
|
||||
@ -158,7 +163,7 @@ public class ProcessedWEExtent extends FaweExtent {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (block.hasNbtData()) {
|
||||
if (block.hasNbtData() && nbt) {
|
||||
final Vector loc = new Vector(location.x, location.y, location.z);
|
||||
queue.addTask(x >> 4, z >> 4, new Runnable() {
|
||||
@Override
|
||||
|
@ -8,6 +8,7 @@ import com.sk89q.jnbt.EndTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class MainUtil {
|
||||
@ -53,12 +54,13 @@ public class MainUtil {
|
||||
if (tag instanceof EndTag) {
|
||||
return false;
|
||||
}
|
||||
if (tag instanceof ListTag) {
|
||||
if (((ListTag) tag).getType() == EndTag.class) {
|
||||
else if (tag instanceof ListTag) {
|
||||
ListTag lt = (ListTag) tag;
|
||||
if ((lt).getType() == EndTag.class) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (tag instanceof CompoundTag) {
|
||||
else if (tag instanceof CompoundTag) {
|
||||
for (Entry<String, Tag> entry : ((CompoundTag) tag).getValue().entrySet()) {
|
||||
if (!isValidTag(entry.getValue())) {
|
||||
return false;
|
||||
@ -67,4 +69,9 @@ public class MainUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isValidSign(CompoundTag tag) {
|
||||
Map<String, Tag> values = tag.getValue();
|
||||
return values.size() > 4 && values.containsKey("Text1");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user