diff --git a/.gitignore b/.gitignore index 45c3371a..448da87b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ gradle.log /bukkit0/build /bukkit19/build /bukkit18/build -build \ No newline at end of file +build +mvn/com/boydti/fawe-api/unknown/fawe-api-unknown.jar \ No newline at end of file diff --git a/core/src/main/java/com/boydti/fawe/config/Commands.java b/core/src/main/java/com/boydti/fawe/config/Commands.java index 1058da7d..0c98a0a8 100644 --- a/core/src/main/java/com/boydti/fawe/config/Commands.java +++ b/core/src/main/java/com/boydti/fawe/config/Commands.java @@ -30,87 +30,97 @@ public class Commands { } 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 new TranslatedCommand(command); + } - String id = command.aliases()[0]; - ConfigurationSection commands = cmdConfig.getConfigurationSection(id); - boolean set = false; - if (commands == null) { - set = (commands = cmdConfig.createSection(id)) != null; + 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]; + ConfigurationSection commands = cmdConfig.getConfigurationSection(id); + boolean set = false; + if (commands == null) { + set = (commands = cmdConfig.createSection(id)) != null; + } + + HashMap options = new HashMap<>(); + options.put("aliases", new ArrayList(Arrays.asList(command.aliases()))); + options.put("usage", command.usage()); + options.put("desc", command.desc()); + options.put("help", command.help()); + for (Map.Entry entry : options.entrySet()) { + String key = entry.getKey(); + if (!commands.contains(key)) { + commands.set(key, entry.getValue()); + set = true; + } + } + if (set) { + try { + cmdConfig.save(cmdFile); + } catch (IOException e) { + e.printStackTrace(); + } + } + this.aliases = commands.getStringList("aliases").toArray(new String[0]); + this.usage = commands.getString("usage"); + this.desc = commands.getString("desc"); + this.help = commands.getString("help"); + this.command = command; } - HashMap options = new HashMap<>(); - options.put("aliases", new ArrayList(Arrays.asList(command.aliases()))); - options.put("usage", command.usage()); - options.put("desc", command.desc()); - options.put("help", command.help()); - - for (Map.Entry entry : options.entrySet()) { - String key = entry.getKey(); - if (!commands.contains(key)) { - commands.set(key, entry.getValue()); - set = true; - } + @Override + public Class annotationType() { + return command.annotationType(); } - if (set) { - try { - cmdConfig.save(cmdFile); - } catch (IOException e) { - e.printStackTrace(); - } + + @Override + public String[] aliases() { + return aliases; } - final String[] aliases = commands.getStringList("aliases").toArray(new String[0]); - final String usage = commands.getString("usage"); - final String desc = commands.getString("desc"); - final String help = commands.getString("help"); - return new Command() { - @Override - public Class annotationType() { - return command.annotationType(); - } + @Override + public String usage() { + return usage; + } - @Override - public String[] aliases() { - return aliases; - } + @Override + public String desc() { + return desc; + } - @Override - public String usage() { - return usage; - } + @Override + public int min() { + return command.min(); + } - @Override - public String desc() { - return desc; - } + @Override + public int max() { + return command.max(); + } - @Override - public int min() { - return command.min(); - } + @Override + public String flags() { + return command.flags(); + } - @Override - public int max() { - return command.max(); - } + @Override + public String help() { + return help; + } - @Override - public String flags() { - return command.flags(); - } - - @Override - public String help() { - return help; - } - - @Override - public boolean anyFlags() { - return command.anyFlags(); - } - }; + @Override + public boolean anyFlags() { + return command.anyFlags(); + } } } diff --git a/core/src/main/java/com/boydti/fawe/object/FawePlayer.java b/core/src/main/java/com/boydti/fawe/object/FawePlayer.java index 95cf3494..b592dcc3 100644 --- a/core/src/main/java/com/boydti/fawe/object/FawePlayer.java +++ b/core/src/main/java/com/boydti/fawe/object/FawePlayer.java @@ -150,6 +150,15 @@ public abstract class FawePlayer { 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
* - Usually already called when necessary diff --git a/core/src/main/java/com/sk89q/worldedit/EditSession.java b/core/src/main/java/com/sk89q/worldedit/EditSession.java index 5bae2528..b77a27f5 100644 --- a/core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -711,6 +711,9 @@ public class EditSession implements Extent { @Override 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); } diff --git a/gradle.properties b/gradle.properties index 2f9e3b0f..68da8d19 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ #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.daemon=false +org.gradle.daemon=true org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.configureondemand=true org.gradle.parallel=true \ No newline at end of file