This commit is contained in:
Jesse Boyd 2016-08-29 14:29:36 +10:00
parent f2d54e6e97
commit 36a1e9f744
5 changed files with 93 additions and 70 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ gradle.log
/bukkit19/build /bukkit19/build
/bukkit18/build /bukkit18/build
build build
mvn/com/boydti/fawe-api/unknown/fawe-api-unknown.jar

View File

@ -30,10 +30,21 @@ public class Commands {
} }
public static Command translate(final Command command) { public static Command translate(final Command command) {
if (cmdConfig == null) { if (cmdConfig == null || command instanceof TranslatedCommand) {
System.out.println("NO TRANSLATION FOR " + command.aliases()[0]);
return command; return command;
} }
return new TranslatedCommand(command);
}
public static class TranslatedCommand implements Command {
private final String[] aliases;
private final String usage;
private final String desc;
private final String help;
private final Command command;
public TranslatedCommand(Command command) {
String id = command.aliases()[0]; String id = command.aliases()[0];
ConfigurationSection commands = cmdConfig.getConfigurationSection(id); ConfigurationSection commands = cmdConfig.getConfigurationSection(id);
boolean set = false; boolean set = false;
@ -46,7 +57,6 @@ public class Commands {
options.put("usage", command.usage()); options.put("usage", command.usage());
options.put("desc", command.desc()); options.put("desc", command.desc());
options.put("help", command.help()); options.put("help", command.help());
for (Map.Entry<String, Object> entry : options.entrySet()) { for (Map.Entry<String, Object> entry : options.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
if (!commands.contains(key)) { if (!commands.contains(key)) {
@ -61,12 +71,13 @@ public class Commands {
e.printStackTrace(); e.printStackTrace();
} }
} }
final String[] aliases = commands.getStringList("aliases").toArray(new String[0]); this.aliases = commands.getStringList("aliases").toArray(new String[0]);
final String usage = commands.getString("usage"); this.usage = commands.getString("usage");
final String desc = commands.getString("desc"); this.desc = commands.getString("desc");
final String help = commands.getString("help"); this.help = commands.getString("help");
this.command = command;
}
return new Command() {
@Override @Override
public Class<? extends Annotation> annotationType() { public Class<? extends Annotation> annotationType() {
return command.annotationType(); return command.annotationType();
@ -111,6 +122,5 @@ public class Commands {
public boolean anyFlags() { public boolean anyFlags() {
return command.anyFlags(); return command.anyFlags();
} }
};
} }
} }

View File

@ -150,6 +150,15 @@ public abstract class FawePlayer<T> {
return FaweAPI.getWorld(getLocation().world); return FaweAPI.getWorld(getLocation().world);
} }
public FaweQueue getMaskedFaweQueue(boolean autoQueue) {
FaweQueue queue = SetQueue.IMP.getNewQueue(getLocation().world, true, autoQueue);
RegionWrapper[] allowedRegions = getCurrentRegions();
if (allowedRegions.length == 1 && allowedRegions[0].isGlobal()) {
return queue;
}
return new MaskedFaweQueue(queue, allowedRegions);
}
/** /**
* Load all the undo EditSession's from disk for a world <br> * Load all the undo EditSession's from disk for a world <br>
* - Usually already called when necessary * - Usually already called when necessary

View File

@ -711,6 +711,9 @@ public class EditSession implements Extent {
@Override @Override
public BaseBlock getBlock(final Vector position) { public BaseBlock getBlock(final Vector position) {
if (position.y > 255 || position.y < 0) {
return nullBlock;
}
return getLazyBlock((int) position.x, (int) position.y, (int) position.z); return getLazyBlock((int) position.x, (int) position.y, (int) position.z);
} }

View File

@ -1,6 +1,6 @@
#org.gradle.java.home=C:/PROGRA~2/Java/jdk1.7.0_79 #org.gradle.java.home=C:/PROGRA~2/Java/jdk1.7.0_79
#org.gradle.java.home=C:/PROGRA~1/Java/jdk1.8.0_51 #org.gradle.java.home=C:/PROGRA~1/Java/jdk1.8.0_51
org.gradle.daemon=false org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.configureondemand=true org.gradle.configureondemand=true
org.gradle.parallel=true org.gradle.parallel=true