This commit is contained in:
Jesse Boyd 2017-09-18 14:45:44 +10:00
parent 917d3f332d
commit 27d9baa7bc
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 49 additions and 28 deletions

View File

@ -1,7 +1,9 @@
package com.boydti.fawe.bukkit.wrapper; package com.boydti.fawe.bukkit.wrapper;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.bukkit.wrapper.state.AsyncSign;
import com.boydti.fawe.object.FaweQueue; import com.boydti.fawe.object.FaweQueue;
import com.sk89q.worldedit.blocks.BlockID;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.bukkit.Chunk; import org.bukkit.Chunk;
@ -168,6 +170,12 @@ public class AsyncBlock implements Block {
@Override @Override
public BlockState getState() { public BlockState getState() {
int combined = queue.getCombinedId4Data(x, y, z, 0);
switch (FaweCache.getId(combined)) {
case BlockID.SIGN_POST:
case BlockID.WALL_SIGN:
return new AsyncSign(this, combined);
}
return new AsyncBlockState(this); return new AsyncBlockState(this);
} }

View File

@ -21,8 +21,11 @@ public class AsyncBlockState implements BlockState {
private final AsyncBlock block; private final AsyncBlock block;
public AsyncBlockState(AsyncBlock block) { public AsyncBlockState(AsyncBlock block) {
this(block, block.queue.getCombinedId4Data(block.x, block.y, block.z, 0));
}
public AsyncBlockState(AsyncBlock block, int combined) {
this.block = block; this.block = block;
int combined = block.queue.getCombinedId4Data(block.x, block.y, block.z, 0);
this.id = (short) (combined >> 4); this.id = (short) (combined >> 4);
this.data = (byte) (combined & 0xF); this.data = (byte) (combined & 0xF);
if (FaweCache.hasNBT(id)) { if (FaweCache.hasNBT(id)) {

View File

@ -10,8 +10,8 @@ import java.util.Map;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
public class AsyncSign extends AsyncBlockState implements Sign { public class AsyncSign extends AsyncBlockState implements Sign {
public AsyncSign(AsyncBlock block) { public AsyncSign(AsyncBlock block, int combined) {
super(block); super(block, combined);
} }
@Override @Override

View File

@ -110,6 +110,10 @@ public class DefaultMaskParser extends FaweParser<Mask> {
} }
} }
if (mask == null) { if (mask == null) {
if (command.startsWith("[")) {
int end = command.lastIndexOf(']');
mask = parseFromInput(command.substring(1, end == -1 ? command.length() : end), context);
} else {
try { try {
context.setPreferringWildcard(true); context.setPreferringWildcard(true);
context.setRestricted(false); context.setRestricted(false);
@ -125,6 +129,7 @@ public class DefaultMaskParser extends FaweParser<Mask> {
} }
} }
} }
}
} else { } else {
List<String> args = entry.getValue(); List<String> args = entry.getValue();
if (!args.isEmpty()) { if (!args.isEmpty()) {

View File

@ -84,6 +84,10 @@ public class HashTagPatternParser extends FaweParser<Pattern> {
} }
} }
if (pattern == null) { if (pattern == null) {
if (command.startsWith("[")) {
int end = command.lastIndexOf(']');
pattern = parseFromInput(command.substring(1, end == -1 ? command.length() : end), context);
} else {
int percentIndex = command.indexOf('%'); int percentIndex = command.indexOf('%');
if (percentIndex != -1) { // Legacy percent pattern if (percentIndex != -1) { // Legacy percent pattern
chance = Expression.compile(command.substring(0, percentIndex)).evaluate(); chance = Expression.compile(command.substring(0, percentIndex)).evaluate();
@ -101,6 +105,7 @@ public class HashTagPatternParser extends FaweParser<Pattern> {
} }
} }
} }
}
} else { } else {
List<String> args = entry.getValue(); List<String> args = entry.getValue();
if (!args.isEmpty()) { if (!args.isEmpty()) {