Simplify config comments, messages, add permpack.

fawe.permpack.basic
This commit is contained in:
Jesse Boyd 2017-03-31 13:12:23 +11:00
parent c474917ec2
commit df15ba6cd7
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
8 changed files with 217 additions and 103 deletions

View File

@ -105,7 +105,7 @@ public class ChunkListener implements Listener {
badChunks.add(MathMan.pairInt(cx, cz));
if (rateLimit <= 0) {
rateLimit = 120;
Fawe.debug("[Tick Limiter] Detected and cancelled physics lag source at " + block.getLocation());
Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled physics lag source at " + block.getLocation());
}
}
return;
@ -132,7 +132,7 @@ public class ChunkListener implements Listener {
if (count.y == Settings.IMP.TICK_LIMITER.FALLING) {
count.x = Settings.IMP.TICK_LIMITER.PHYSICS;
badChunks.add(MathMan.pairInt(cx, cz));
Fawe.debug("[Tick Limiter] Detected and cancelled falling block lag source at " + block.getLocation());
Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled falling block lag source at " + block.getLocation());
}
event.setCancelled(true);
return;
@ -157,7 +157,7 @@ public class ChunkListener implements Listener {
badChunks.add(MathMan.pairInt(cx, cz));
if (rateLimit <= 0) {
rateLimit = 120;
Fawe.debug("[Tick Limiter] Detected and cancelled item lag source at " + loc);
Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
}
}
event.setCancelled(true);

View File

@ -8,16 +8,9 @@ load: STARTUP
database: false
#softdepend: [WorldGuard, PlotSquared, MCore, Factions, GriefPrevention, Residence, Towny, PlotMe, PreciousStones]
commands:
wea:
description: (FAWE) Bypass WorldEdit processing and area restrictions
aliases: [weanywhere,worldeditanywhere,/wea,/weanywhere,/worldeditanywhere]
usage: "Vault is required for the toggle. Optionally, you can set the permission fawe.bypass"
fawe:
description: (FAWE) Reload the plugin
aliases: [/fawe,/fawereload]
select:
description: (FAWE) Select your current WorldEdit Region.
aliases: [/select,wer,/wer,worldeditregion,/worldeditregion,/region]
fcancel:
description: (FAWE) Cancel your edit
aliases: [fawecancel,/fcancel,/cancel,/fawecancel]
@ -30,3 +23,137 @@ permissions:
default: op
fawe.reload:
default: false
fawe.permpack.basic:
default: op
children:
fawe.worldeditregion: true
fawe.cancel: true
worldedit.biome.info: true
worldedit.biome.set: true
worldedit.biome.list: true
worldedit.chunkinfo: true
worldedit.listchunks: true
worldedit.clipboard.cut: true
worldedit.clipboard.paste: true
worldedit.schematic.formats: true
worldedit.clipboard.load: true
worldedit.schematic.load: true
worldedit.schematic.list: true
worldedit.clipboard.save: true
worldedit.schematic.save: true
worldedit.clipboard.clear: true
worldedit.clipboard.load: true
worldedit.clipboard.save: true
worldedit.clipboard.copy: true
worldedit.clipboard.lazycopy: true
worldedit.clipboard.place: true
worldedit.clipboard.download: true
worldedit.clipboard.flip: true
worldedit.clipboard.rotate: true
worldedit.help: true
worldedit.global-mask: true
worldedit.global-trasnform: true
worldedit.generation.cylinder: true
worldedit.generation.sphere: true
worldedit.generation.forest: true
worldedit.generation.pumpkins: true
worldedit.generation.pyramid: true
worldedit.generation.shape: true
worldedit.biome.set: true
worldedit.history.undo: true
worldedit.history.redo: true
worldedit.history.rollback: true
worldedit.navigation.unstuck: true
worldedit.navigation.ascend: true
worldedit.navigation.descend: true
worldedit.navigation.ceiling: true
worldedit.navigation.thru.command: true
worldedit.navigation.jumpto.command: true
worldedit.navigation.up: true
worldedit.region.hollow: true
worldedit.region.line: true
worldedit.region.curve: true
worldedit.region.overlay: true
worldedit.region.center: true
worldedit.region.naturalize: true
worldedit.region.walls: true
worldedit.region.faces: true
worldedit.region.smooth: true
worldedit.region.move: true
worldedit.region.forest: true
worldedit.region.replace: true
worldedit.region.stack: true
worldedit.region.set: true
worldedit.selection.pos: true
worldedit.selection.chunk: true
worldedit.selection.hpos: true
worldedit.wand: true
worldedit.wand.toggle: true
worldedit.selection.contract: true
worldedit.selection.outset: true
worldedit.selection.inset: true
worldedit.analysis.distr: true
worldedit.analysis.count: true
worldedit.selection.size: true
worldedit.selection.expand: true
worldedit.selection.shift: true
worldedit.snapshots.list: true
worldedit.superpickaxe: true
worldedit.superpickaxe.area: true
worldedit.superpickaxe.recursive: true
worldedit.brush.blendball: true
worldedit.brush.erode: true
worldedit.brush.pull: true
worldedit.brush.circle: true
worldedit.brush.recursive: true
worldedit.brush.line: true
worldedit.brush.spline: true
worldedit.brush.surfacespline: true
worldedit.brush.shatter: true
worldedit.brush.stencil: true
worldedit.brush.height: true
worldedit.brush.layer: true
worldedit.brush.populateschematic: true
worldedit.brush.scatter: true
worldedit.brush.splatter: true
worldedit.brush.scattercommand: true
worldedit.brush.copy: true
worldedit.brush.command: true
worldedit.brush.apply: true
worldedit.brush.sphere: true
worldedit.brush.cylinder: true
worldedit.brush.clipboard: true
worldedit.brush.smooth: true
worldedit.brush.ex: true
worldedit.brush.gravity: true
worldedit.brush.options.range: true
worldedit.brush.options.material: true
worldedit.brush.options.size: true
worldedit.brush.options.mask: true
worldedit.brush.options.smask: true
worldedit.brush.options.transform: true
worldedit.brush.options.scroll: true
worldedit.brush.options.visualize: true
worldedit.tool.deltree: true
worldedit.tool.farwand: true
worldedit.tool.lrbuild: true
worldedit.tool.info: true
worldedit.tool.tree: true
worldedit.tool.replacer: true
worldedit.tool.data-cycler: true
worldedit.tool.flood-fill: true
worldedit.tool.inspect: true
worldedit.fill.recursive: true
worldedit.drain: true
worldedit.fixlava: true
worldedit.fixwater: true
worldedit.removeabove: true
worldedit.removebelow: true
worldedit.removenear: true
worldedit.replacenear: true
worldedit.snow: true
worldedit.thaw: true
worldedit.green: true
worldedit.extinguish: true
worldedit.calc: true
worldedit.fill: true

View File

@ -2,8 +2,6 @@ package com.boydti.fawe;
import com.boydti.fawe.command.Cancel;
import com.boydti.fawe.command.Reload;
import com.boydti.fawe.command.Wea;
import com.boydti.fawe.command.WorldEditRegion;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Commands;
import com.boydti.fawe.config.Settings;
@ -267,7 +265,9 @@ public class Fawe {
WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
WEManager.IMP.managers.add(new PlotSquaredFeature());
Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
} catch (Throwable e) {}
} catch (Throwable e) {
e.printStackTrace();
}
Fawe.this.worldedit = WorldEdit.getInstance();
}
}, 0);
@ -331,8 +331,6 @@ public class Fawe {
}
private void setupCommands() {
this.IMP.setupCommand("wea", new Wea());
this.IMP.setupCommand("select", new WorldEditRegion());
this.IMP.setupCommand("fawe", new Reload());
this.IMP.setupCommand("fcancel", new Cancel());
}

View File

@ -1,35 +0,0 @@
package com.boydti.fawe.command;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweCommand;
import com.boydti.fawe.object.FawePlayer;
public class Wea extends FaweCommand {
public Wea() {
super("fawe.admin");
}
@Override
public boolean execute(final FawePlayer player, final String... args) {
if (player == null) {
return false;
}
if (this.toggle(player)) {
BBC.WORLDEDIT_BYPASSED.send(player);
} else {
BBC.WORLDEDIT_RESTRICTED.send(player);
}
return true;
}
private boolean toggle(final FawePlayer player) {
if (player.hasPermission("fawe.bypass")) {
player.setPermission("fawe.bypass", false);
return false;
} else {
player.setPermission("fawe.bypass", true);
return true;
}
}
}

View File

@ -1,28 +0,0 @@
package com.boydti.fawe.command;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweCommand;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RegionWrapper;
public class WorldEditRegion extends FaweCommand {
public WorldEditRegion() {
super("fawe.worldeditregion");
}
@Override
public boolean execute(final FawePlayer player, final String... args) {
if (player == null) {
return false;
}
final RegionWrapper region = player.getLargestRegion();
if (region == null) {
BBC.NO_REGION.send(player);
return false;
}
player.setSelection(region);
BBC.SET_REGION.send(player);
return true;
}
}

View File

@ -214,42 +214,50 @@ public class Settings extends Config {
@Comment("This relates to how FAWE places chunks")
public static class QUEUE {
@Comment({
"This should equal the number of processors you have",
" - Set this to 1 if you need reliable `/timings`"
})
public int PARALLEL_THREADS = Math.max(1, Runtime.getRuntime().availableProcessors());
@Create
public static PROGRESS PROGRESS;
@Comment({
"If you are changing more than this many chunks",
"it can start start placing before all the changes are calculated"
"When doing edits that effect more than this many chunks:",
" - FAWE will start placing before all calculations are finished",
" - A larger value will use slightly less CPU time",
" - A smaller value will reduce memory usage",
" - A value too small may break some operations (deform?)"
})
public int TARGET_SIZE = 64;
@Comment({
"This should equal the number of processors you have"
})
public int PARALLEL_THREADS = Math.max(1, Runtime.getRuntime().availableProcessors());
@Comment({
"The time in milliseconds that the global queue can be idle before it is forced to start",
"on edits which are still in the processing stage."
"Force FAWE to start placing chunks regardless of whether an edit is finished processing",
" - A larger value will use slightly less CPU time",
" - A smaller value will reduce memory usage",
" - A value too small may break some operations (deform?)"
})
public int MAX_WAIT_MS = 1000;
@Comment({
"Increase or decrease queue intensity (ms):",
"Increase or decrease queue intensity (ms) [-50,50]:",
" 0 = balance of performance / stability",
" -10 = Allocate 10ms less for chunk placement",
"Too high will can cause lag spikes",
"Too low will reduce load and result in slower changes",
"Too high will can cause lag spikes (you might be okay with this)",
"Too low will result in slow edits",
})
public int EXTRA_TIME_MS = 0;
@Comment({
"Loading the right amount of chunks beforehand can speed up operations",
" - Low values will result in FAWE waiting on requests to the main thread",
" - Higher values will use memory and is slower if the operation ends early",
" - Low values may result in FAWE waiting on requests to the main thread",
" - Higher values use more memory and isn't noticeably faster",
})
public int PRELOAD_CHUNKS = 32;
@Comment({
"Discard edits which have been idle for a certain amount of time (ms) (e.g. a plugin creates",
"an EditSession but never does anything with it)."
"Discard edits which have been idle for a certain amount of time (ms)",
" - E.g. A plugin creates an EditSession but never does anything with it",
" - This only applies to plugins improperly using WorldEdit's legacy API"
})
public static int DISCARD_AFTER_MS = 60000;
@ -267,7 +275,11 @@ public class Settings extends Config {
}
}
@Comment("Experimental options, use at your own risk")
@Comment({
"Experimental options, use at your own risk",
" - Apparently that wasn't enough, need an all caps warning?",
" - DO NOT USE IF YOU ARE CLUELESS!"
})
public static class EXPERIMENTAL {
@Comment({
"Directly modify the region files.",
@ -293,10 +305,11 @@ public class Settings extends Config {
public static class EXTENT {
@Comment({
"Don't bug console when these plugins slow down WorldEdit operations"
"Don't bug console when these plugins slow down WorldEdit operations",
" - You'll see a message in console if you need to change this option"
})
public List<String> ALLOWED_PLUGINS = new ArrayList<>();
@Comment("Disable the messages completely")
@Comment("Should debug messages be sent when third party extents are used?")
public boolean DEBUG = true;
}
@ -312,11 +325,14 @@ public class Settings extends Config {
public int PHYSICS = 512;
@Comment("Max item spawns per interval (per chunk)")
public int ITEMS = 128;
}
public static class CLIPBOARD {
@Comment("Store the clipboard on disk instead of memory")
@Comment({
"Store the clipboard on disk instead of memory",
" - Will be slightly slower",
" - Uses 2 bytes per block",
})
public boolean USE_DISK = true;
@Comment({
"Compress the clipboard to reduce the size:",

View File

@ -399,7 +399,7 @@ public class MainUtil {
writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(filename)).append(CRLF);
writer.append("Content-Transfer-Encoding: binary").append(CRLF);
writer.append(CRLF).flush();
OutputStream nonClosable = new AbstractDelegateOutputStream(output) {
OutputStream nonClosable = new AbstractDelegateOutputStream(new BufferedOutputStream(output)) {
@Override
public void close() throws IOException { } // Don't close
};
@ -410,10 +410,12 @@ public class MainUtil {
writer.append("--" + boundary + "--").append(CRLF).flush();
}
int responseCode = ((HttpURLConnection) con).getResponseCode();
// java.util.Scanner scanner = new java.util.Scanner(con.getInputStream()).useDelimiter("\\A");
// String content = scanner.next().trim();
// scanner.close();
// Fawe.debug(content);
java.util.Scanner scanner = new java.util.Scanner(con.getInputStream()).useDelimiter("\\A");
String content = scanner.next().trim();
scanner.close();
if (content != null && !content.startsWith("<")) {
Fawe.debug(content);
}
if (responseCode == 200) {
return url;
}

View File

@ -26,6 +26,7 @@ import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.object.FaweLocation;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.visitor.Fast2DIterator;
import com.boydti.fawe.util.MathMan;
@ -470,6 +471,39 @@ public class RegionCommands {
}
}
@Command(
aliases = { "/wea", "wea", "worldeditanywhere", "/worldeditanywhere", "/weanywhere" },
desc = "Bypass region restrictions",
help = "Bypass region restrictions"
)
@CommandPermissions("fawe.admin")
public void wea(Player player) throws WorldEditException {
FawePlayer<Object> fp = FawePlayer.wrap(player);
if (fp.toggle("fawe.bypass")) {
BBC.WORLDEDIT_BYPASSED.send(fp);
} else {
BBC.WORLDEDIT_RESTRICTED.send(fp);
}
}
@Command(
aliases = { "/wer", "wer", "worldeditregion", "/worldeditregion", "select", "/select" },
desc = "Select your current allowed region",
help = "Select your current allowed region"
)
@CommandPermissions("fawe.worldeditregion")
public void wer(Player player) throws WorldEditException {
FawePlayer<Object> fp = FawePlayer.wrap(player);
final RegionWrapper region = fp.getLargestRegion();
if (region == null) {
BBC.NO_REGION.send(fp);
} else {
fp.setSelection(region);
BBC.SET_REGION.send(fp);
}
}
@Command(
aliases = { "/move" },
usage = "[count] [direction] [leave-id]",