mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-02-17 21:11:26 +01:00
Various minor
remove debug Angle mask overlay option (end with o) 3rd party command registration fixes message tweaks
This commit is contained in:
parent
7c49c34c86
commit
1d02901e39
@ -35,7 +35,7 @@ public enum BBC {
|
|||||||
WORLDEDIT_VOLUME("&7You cannot select a volume of %current%. The maximum volume you can modify is %max%.", "Info"),
|
WORLDEDIT_VOLUME("&7You cannot select a volume of %current%. The maximum volume you can modify is %max%.", "Info"),
|
||||||
WORLDEDIT_ITERATIONS("&7You cannot iterate %current% times. The maximum number of iterations allowed is %max%.", "Info"),
|
WORLDEDIT_ITERATIONS("&7You cannot iterate %current% times. The maximum number of iterations allowed is %max%.", "Info"),
|
||||||
WORLDEDIT_UNSAFE("&7Access to that command has been blocked", "Info"),
|
WORLDEDIT_UNSAFE("&7Access to that command has been blocked", "Info"),
|
||||||
WORLDEDIT_DANGEROUS_WORLDEDIT("&cFAWE processed unsafe WorldEdit at %s0 by %s1", "Info"),
|
WORLDEDIT_DANGEROUS_WORLDEDIT("&cProcessed unsafe WorldEdit at %s0 by %s1", "Info"),
|
||||||
WORLDEDIT_BYPASS("&7&oTo bypass your restrictions use &c/wea", "Info"),
|
WORLDEDIT_BYPASS("&7&oTo bypass your restrictions use &c/wea", "Info"),
|
||||||
WORLDEDIT_EXTEND("&cYour WorldEdit may have extended outside your allowed region.", "Error"),
|
WORLDEDIT_EXTEND("&cYour WorldEdit may have extended outside your allowed region.", "Error"),
|
||||||
WORLDEDIT_TOGGLE_TIPS_ON("&7Disabled WorldEdit tips.", "Info"),
|
WORLDEDIT_TOGGLE_TIPS_ON("&7Disabled WorldEdit tips.", "Info"),
|
||||||
@ -115,7 +115,7 @@ public enum BBC {
|
|||||||
BRUSH_EXTINGUISHER("Extinguisher equipped (%s0).", "WorldEdit.Brush"),
|
BRUSH_EXTINGUISHER("Extinguisher equipped (%s0).", "WorldEdit.Brush"),
|
||||||
BRUSH_GRAVITY("Gravity brush equipped (%s0)", "WorldEdit.Brush"),
|
BRUSH_GRAVITY("Gravity brush equipped (%s0)", "WorldEdit.Brush"),
|
||||||
BRUSH_HEIGHT("Height brush equipped (%s0)", "WorldEdit.Brush"),
|
BRUSH_HEIGHT("Height brush equipped (%s0)", "WorldEdit.Brush"),
|
||||||
BRUSH_TRY_OTHER("&cFAWE adds other, more suitable brushes e.g.\n&8 - &7//br height [radius=5] [#clipboard|file=null] [rotation=0] [yscale=1.00]", "WorldEdit.Brush"),
|
BRUSH_TRY_OTHER("&cThere are other more suitable brushes e.g.\n&8 - &7//br height [radius=5] [#clipboard|file=null] [rotation=0] [yscale=1.00]", "WorldEdit.Brush"),
|
||||||
BRUSH_COPY("Copy brush equipped (%s0). Left click the base of an object to copy, right click to paste. Increase the brush radius if necessary.", "WorldEdit.Brush"),
|
BRUSH_COPY("Copy brush equipped (%s0). Left click the base of an object to copy, right click to paste. Increase the brush radius if necessary.", "WorldEdit.Brush"),
|
||||||
BRUSH_COMMAND("Command brush equipped (%s0)", "WorldEdit.Brush"),
|
BRUSH_COMMAND("Command brush equipped (%s0)", "WorldEdit.Brush"),
|
||||||
BRUSH_HEIGHT_INVALID("Invalid height map file (%s0)", "WorldEdit.Brush"),
|
BRUSH_HEIGHT_INVALID("Invalid height map file (%s0)", "WorldEdit.Brush"),
|
||||||
@ -226,7 +226,7 @@ public enum BBC {
|
|||||||
NOT_PLAYER("&cYou must be a player to perform this action!", "Error"),
|
NOT_PLAYER("&cYou must be a player to perform this action!", "Error"),
|
||||||
PLAYER_NOT_FOUND("&cPlayer not found:&7 %s0", "Error"),
|
PLAYER_NOT_FOUND("&cPlayer not found:&7 %s0", "Error"),
|
||||||
OOM(
|
OOM(
|
||||||
"&8[&cCritical&8] &cDetected low memory i.e. < 1%. FAWE will take the following actions:\n&8 - &7Terminate WE block placement\n&8 - &7Clear WE history\n&8 - &7Unload non essential chunks\n&8 - &7Kill entities\n&8 - &7Garbage collect\n&cIgnore this if trying to crash server.\n&7Note: Low memory is likely (but not necessarily) caused by WE",
|
"&8[&cCritical&8] &cDetected low memory i.e. < 1%. We will take the following actions:\n&8 - &7Terminate WE block placement\n&8 - &7Clear WE history\n&8 - &7Unload non essential chunks\n&8 - &7Kill entities\n&8 - &7Garbage collect\n&cIgnore this if trying to crash server.\n&7Note: Low memory is likely (but not necessarily) caused by WE",
|
||||||
"Error"),
|
"Error"),
|
||||||
|
|
||||||
WORLDEDIT_SOME_FAILS("&c%s0 blocks weren't placed because they were outside your allowed region.", "Error"),
|
WORLDEDIT_SOME_FAILS("&c%s0 blocks weren't placed because they were outside your allowed region.", "Error"),
|
||||||
|
@ -56,7 +56,6 @@ public class MCAChunk extends FaweChunk<Void> {
|
|||||||
private boolean deleted;
|
private boolean deleted;
|
||||||
|
|
||||||
public byte[] toBytes(byte[] buffer) throws IOException {
|
public byte[] toBytes(byte[] buffer) throws IOException {
|
||||||
checkNotNull(buffer);
|
|
||||||
if (buffer == null) {
|
if (buffer == null) {
|
||||||
buffer = new byte[8192];
|
buffer = new byte[8192];
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,17 @@ public class AngleMask extends SolidBlockMask {
|
|||||||
private final double max;
|
private final double max;
|
||||||
private final double min;
|
private final double min;
|
||||||
private final Extent extent;
|
private final Extent extent;
|
||||||
|
private final boolean overlay;
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector mutable = new MutableBlockVector();
|
||||||
private int maxY;
|
private int maxY;
|
||||||
|
|
||||||
public AngleMask(Extent extent, double min, double max) {
|
public AngleMask(Extent extent, double min, double max, boolean overlay) {
|
||||||
super(extent);
|
super(extent);
|
||||||
this.extent = extent;
|
this.extent = extent;
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
this.maxY = extent.getMaximumPoint().getBlockY();
|
this.maxY = extent.getMaximumPoint().getBlockY();
|
||||||
|
this.overlay = overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,7 +39,7 @@ public class AngleMask extends SolidBlockMask {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
block = extent.getLazyBlock(x, y + 1, z);
|
block = extent.getLazyBlock(x, y + 1, z);
|
||||||
if (test(block.getId(), block.getData())) {
|
if (overlay && test(block.getId(), block.getData())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
double slope;
|
double slope;
|
||||||
|
@ -55,8 +55,6 @@ public class Updater {
|
|||||||
Fawe.debug("Updated FAWE to " + versionString);
|
Fawe.debug("Updated FAWE to " + versionString);
|
||||||
MainUtil.sendAdmin("&7Restart to update FAWE with these changes: &c/fawe changelog &7or&c " + "http://boydti.com/fawe/cl?" + Integer.toHexString(currentVersion.hash));
|
MainUtil.sendAdmin("&7Restart to update FAWE with these changes: &c/fawe changelog &7or&c " + "http://boydti.com/fawe/cl?" + Integer.toHexString(currentVersion.hash));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
System.out.println("Not newer");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable ignore) {}
|
} catch (Throwable ignore) {}
|
||||||
|
@ -295,6 +295,13 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
double y1,y2;
|
double y1,y2;
|
||||||
|
boolean override;
|
||||||
|
if (split[1].endsWith("o")) {
|
||||||
|
override = true;
|
||||||
|
split[1] = split[1].substring(0, split[1].length() - 1);
|
||||||
|
} else {
|
||||||
|
override = false;
|
||||||
|
}
|
||||||
if (split[0].endsWith("d")) {
|
if (split[0].endsWith("d")) {
|
||||||
double y1d = Expression.compile(split[0].substring(0, split[0].length() - 1)).evaluate();
|
double y1d = Expression.compile(split[0].substring(0, split[0].length() - 1)).evaluate();
|
||||||
double y2d = Expression.compile(split[1].substring(0, split[1].length() - 1)).evaluate();
|
double y2d = Expression.compile(split[1].substring(0, split[1].length() - 1)).evaluate();
|
||||||
@ -304,7 +311,7 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
|||||||
y1 = (Expression.compile(split[0]).evaluate());
|
y1 = (Expression.compile(split[0]).evaluate());
|
||||||
y2 = (Expression.compile(split[1]).evaluate());
|
y2 = (Expression.compile(split[1]).evaluate());
|
||||||
}
|
}
|
||||||
return new AngleMask(extent, y1, y2);
|
return new AngleMask(extent, y1, y2, override);
|
||||||
} catch (NumberFormatException | ExpressionException e) {
|
} catch (NumberFormatException | ExpressionException e) {
|
||||||
throw new SuggestInputParseException(input, "/<min-angle>:<max-angle>");
|
throw new SuggestInputParseException(input, "/<min-angle>:<max-angle>");
|
||||||
}
|
}
|
||||||
|
@ -150,13 +150,6 @@ public final class CommandManager {
|
|||||||
dynamicHandler.setFormatter(new LogFormat());
|
dynamicHandler.setFormatter(new LogFormat());
|
||||||
|
|
||||||
this.methodMap = new ConcurrentHashMap<>();
|
this.methodMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
// TaskManager.IMP.task(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,9 +159,6 @@ public final class CommandManager {
|
|||||||
*/
|
*/
|
||||||
public void registerCommands(Object clazz) {
|
public void registerCommands(Object clazz) {
|
||||||
registerCommands(clazz, new String[0]);
|
registerCommands(clazz, new String[0]);
|
||||||
if (dispatcher != null) {
|
|
||||||
setupDispatcher();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,9 +168,26 @@ public final class CommandManager {
|
|||||||
* @param aliases The aliases to give the command
|
* @param aliases The aliases to give the command
|
||||||
*/
|
*/
|
||||||
public void registerCommands(Object clazz, String... aliases) {
|
public void registerCommands(Object clazz, String... aliases) {
|
||||||
methodMap.put(clazz, aliases);
|
if (platform != null) {
|
||||||
if (dispatcher != null) {
|
ParametricBuilder builder = new ParametricBuilder();
|
||||||
setupDispatcher();
|
builder.setAuthorizer(new ActorAuthorizer());
|
||||||
|
builder.setDefaultCompleter(new UserCommandCompleter(platformManager));
|
||||||
|
builder.addBinding(new WorldEditBinding(worldEdit));
|
||||||
|
|
||||||
|
builder.addBinding(new PatternBinding(worldEdit), com.sk89q.worldedit.function.pattern.Pattern.class);
|
||||||
|
builder.addBinding(new MaskBinding(worldEdit), com.sk89q.worldedit.function.mask.Mask.class);
|
||||||
|
|
||||||
|
DispatcherNode graph = new CommandGraph().builder(builder).commands();
|
||||||
|
if (aliases.length == 0) {
|
||||||
|
graph = graph.registerMethods(clazz);
|
||||||
|
} else {
|
||||||
|
graph = graph.group(aliases).registerMethods(clazz).parent();
|
||||||
|
}
|
||||||
|
Dispatcher dispatcher = graph.graph().getDispatcher();
|
||||||
|
platform.registerCommands(dispatcher);
|
||||||
|
} else {
|
||||||
|
System.out.println("Put in method map " + clazz);
|
||||||
|
methodMap.put(clazz, aliases);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +195,7 @@ public final class CommandManager {
|
|||||||
* Initialize the dispatcher
|
* Initialize the dispatcher
|
||||||
*/
|
*/
|
||||||
public void setupDispatcher() {
|
public void setupDispatcher() {
|
||||||
|
System.out.println("Setup dispatcher!");
|
||||||
ParametricBuilder builder = new ParametricBuilder();
|
ParametricBuilder builder = new ParametricBuilder();
|
||||||
builder.setAuthorizer(new ActorAuthorizer());
|
builder.setAuthorizer(new ActorAuthorizer());
|
||||||
builder.setDefaultCompleter(new UserCommandCompleter(platformManager));
|
builder.setDefaultCompleter(new UserCommandCompleter(platformManager));
|
||||||
@ -204,12 +212,13 @@ public final class CommandManager {
|
|||||||
// add command
|
// add command
|
||||||
String[] aliases = entry.getValue();
|
String[] aliases = entry.getValue();
|
||||||
if (aliases.length == 0) {
|
if (aliases.length == 0) {
|
||||||
|
System.out.println("Add class " + entry.getKey());
|
||||||
graph = graph.registerMethods(entry.getKey());
|
graph = graph.registerMethods(entry.getKey());
|
||||||
} else {
|
} else {
|
||||||
graph = graph.group(aliases).registerMethods(entry.getKey()).parent();
|
graph = graph.group(aliases).registerMethods(entry.getKey()).parent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
methodMap.clear();
|
||||||
|
|
||||||
dispatcher = graph
|
dispatcher = graph
|
||||||
.group("/anvil", "anvil")
|
.group("/anvil", "anvil")
|
||||||
|
Loading…
Reference in New Issue
Block a user