mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-02-06 15:41:20 +01:00
Fixes #265
This commit is contained in:
parent
f2d54e6e97
commit
36a1e9f744
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,4 +21,5 @@ gradle.log
|
|||||||
/bukkit0/build
|
/bukkit0/build
|
||||||
/bukkit19/build
|
/bukkit19/build
|
||||||
/bukkit18/build
|
/bukkit18/build
|
||||||
build
|
build
|
||||||
|
mvn/com/boydti/fawe-api/unknown/fawe-api-unknown.jar
|
@ -30,87 +30,97 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
String id = command.aliases()[0];
|
public static class TranslatedCommand implements Command {
|
||||||
ConfigurationSection commands = cmdConfig.getConfigurationSection(id);
|
private final String[] aliases;
|
||||||
boolean set = false;
|
private final String usage;
|
||||||
if (commands == null) {
|
private final String desc;
|
||||||
set = (commands = cmdConfig.createSection(id)) != null;
|
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<String, Object> options = new HashMap<>();
|
||||||
|
options.put("aliases", new ArrayList<String>(Arrays.asList(command.aliases())));
|
||||||
|
options.put("usage", command.usage());
|
||||||
|
options.put("desc", command.desc());
|
||||||
|
options.put("help", command.help());
|
||||||
|
for (Map.Entry<String, Object> 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<String, Object> options = new HashMap<>();
|
@Override
|
||||||
options.put("aliases", new ArrayList<String>(Arrays.asList(command.aliases())));
|
public Class<? extends Annotation> annotationType() {
|
||||||
options.put("usage", command.usage());
|
return command.annotationType();
|
||||||
options.put("desc", command.desc());
|
|
||||||
options.put("help", command.help());
|
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : options.entrySet()) {
|
|
||||||
String key = entry.getKey();
|
|
||||||
if (!commands.contains(key)) {
|
|
||||||
commands.set(key, entry.getValue());
|
|
||||||
set = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (set) {
|
|
||||||
try {
|
@Override
|
||||||
cmdConfig.save(cmdFile);
|
public String[] aliases() {
|
||||||
} catch (IOException e) {
|
return aliases;
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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
|
||||||
@Override
|
public String usage() {
|
||||||
public Class<? extends Annotation> annotationType() {
|
return usage;
|
||||||
return command.annotationType();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] aliases() {
|
public String desc() {
|
||||||
return aliases;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String usage() {
|
public int min() {
|
||||||
return usage;
|
return command.min();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String desc() {
|
public int max() {
|
||||||
return desc;
|
return command.max();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int min() {
|
public String flags() {
|
||||||
return command.min();
|
return command.flags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int max() {
|
public String help() {
|
||||||
return command.max();
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String flags() {
|
public boolean anyFlags() {
|
||||||
return command.flags();
|
return command.anyFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String help() {
|
|
||||||
return help;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean anyFlags() {
|
|
||||||
return command.anyFlags();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user