Typo fixes and command clarifications/cleanup.

Also re-disable the gradle daemon. It doesn't always play nice with
ForgeGradle and hogs ram.
This commit is contained in:
wizjany 2019-07-03 13:01:59 -04:00
parent 625cbe5e3d
commit a2b3aabbbf
9 changed files with 45 additions and 24 deletions

View File

@ -1,4 +1,4 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. # Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process. # This is required to provide enough memory for the Minecraft decompilation process.
#org.gradle.jvmargs=-Xmx3G #org.gradle.jvmargs=-Xmx3G
#org.gradle.daemon=false org.gradle.daemon=false

View File

@ -194,6 +194,7 @@ Other Permissions
``worldedit.override.data-cycler``,"Allows cycling non-whitelisted blocks with the data cycler tool." ``worldedit.override.data-cycler``,"Allows cycling non-whitelisted blocks with the data cycler tool."
``worldedit.setnbt``,"Allows setting `extra data <https://minecraft.gamepedia.com/Block_entity>`_ on blocks (such as signs, chests, etc)." ``worldedit.setnbt``,"Allows setting `extra data <https://minecraft.gamepedia.com/Block_entity>`_ on blocks (such as signs, chests, etc)."
``worldedit.report.pastebin``,"Allows uploading report files to pastebin automatically for the ``/worldedit report`` :doc:`command <commands>`." ``worldedit.report.pastebin``,"Allows uploading report files to pastebin automatically for the ``/worldedit report`` :doc:`command <commands>`."
``worldedit.scripting.execute.<filename>``,"Allows using the CraftScript with the given filename."
""".trim()) """.trim())
} }

View File

@ -666,9 +666,9 @@ public final class WorldEdit {
try { try {
engine = new RhinoCraftScriptEngine(); engine = new RhinoCraftScriptEngine();
} catch (NoClassDefFoundError e) { } catch (NoClassDefFoundError ignored) {
player.printError("Failed to find an installed script engine."); player.printError("Failed to find an installed script engine.");
player.printError("Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation"); player.printError("Please see https://worldedit.readthedocs.io/en/latest/usage/other/craftscripts/");
return; return;
} }

View File

@ -150,7 +150,7 @@ public class BrushCommands {
public void clipboardBrush(Player player, LocalSession session, public void clipboardBrush(Player player, LocalSession session,
@Switch(name = 'a', desc = "Don't paste air from the clipboard") @Switch(name = 'a', desc = "Don't paste air from the clipboard")
boolean ignoreAir, boolean ignoreAir,
@Switch(name = 'o', desc = "Paste using clipboard origin, instead of being centered at the target location") @Switch(name = 'o', desc = "Paste starting at the target location, instead of centering on it")
boolean usingOrigin, boolean usingOrigin,
@Switch(name = 'e', desc = "Paste entities if available") @Switch(name = 'e', desc = "Paste entities if available")
boolean pasteEntities, boolean pasteEntities,

View File

@ -92,8 +92,7 @@ public class ClipboardCommands {
@Command( @Command(
name = "/cut", name = "/cut",
desc = "Cut the selection to the clipboard", desc = "Cut the selection to the clipboard"
descFooter = "WARNING: Cutting and pasting entities cannot be undone!"
) )
@CommandPermissions("worldedit.clipboard.cut") @CommandPermissions("worldedit.clipboard.cut")
@Logging(REGION) @Logging(REGION)
@ -105,7 +104,7 @@ public class ClipboardCommands {
boolean copyEntities, boolean copyEntities,
@Switch(name = 'b', desc = "Also copy biomes, source biomes are unaffected") @Switch(name = 'b', desc = "Also copy biomes, source biomes are unaffected")
boolean copyBiomes, boolean copyBiomes,
@ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "") @ArgFlag(name = 'm', desc = "Set the exclude mask, non-matching blocks become air", def = "")
Mask mask) throws WorldEditException { Mask mask) throws WorldEditException {
BlockArrayClipboard clipboard = new BlockArrayClipboard(region); BlockArrayClipboard clipboard = new BlockArrayClipboard(region);

View File

@ -28,12 +28,19 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.CommandPermissions; import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException; import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException;
import com.sk89q.worldedit.world.snapshot.Snapshot; import com.sk89q.worldedit.world.snapshot.Snapshot;
import com.sk89q.worldedit.world.storage.MissingWorldException; import com.sk89q.worldedit.world.storage.MissingWorldException;
import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg; import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -61,8 +68,8 @@ public class SnapshotCommands {
) )
@CommandPermissions("worldedit.snapshots.list") @CommandPermissions("worldedit.snapshots.list")
public void list(Player player, public void list(Player player,
@Arg(desc = "# of snapshots to list", def = "5") @ArgFlag(name = 'p', desc = "Page of results to return", def = "1")
int num) throws WorldEditException { int page) throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -75,15 +82,7 @@ public class SnapshotCommands {
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName()); List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
if (!snapshots.isEmpty()) { if (!snapshots.isEmpty()) {
player.print(new SnapshotListBox(player.getWorld().getName(), snapshots).create(page));
num = Math.min(40, Math.max(5, num));
player.print("Snapshots for world: '" + player.getWorld().getName() + "'");
for (byte i = 0; i < Math.min(num, snapshots.size()); i++) {
player.print((i + 1) + ". " + snapshots.get(i).getName());
}
player.print("Use /snap use [snapshot] or /snap use latest.");
} else { } else {
player.printError("No snapshots are available. See console for details."); player.printError("No snapshots are available. See console for details.");
@ -243,4 +242,26 @@ public class SnapshotCommands {
} }
} }
private static class SnapshotListBox extends PaginationBox {
private final List<Snapshot> snapshots;
SnapshotListBox(String world, List<Snapshot> snapshots) {
super("Snapshots for: " + world, "/snap list -p %page%");
this.snapshots = snapshots;
}
@Override
public Component getComponent(int number) {
final Snapshot snapshot = snapshots.get(number);
return TextComponent.of(number + 1 + ". ", TextColor.GOLD)
.append(TextComponent.of(snapshot.getName(), TextColor.LIGHT_PURPLE)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to use")))
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/snap use " + snapshot.getName())));
}
@Override
public int getComponentsSize() {
return snapshots.size();
}
}
} }

View File

@ -199,9 +199,9 @@ public class ToolCommands {
) )
@CommandPermissions("worldedit.tool.lrbuild") @CommandPermissions("worldedit.tool.lrbuild")
public void longrangebuildtool(Player player, LocalSession session, public void longrangebuildtool(Player player, LocalSession session,
@Arg(desc = "Block to set on left-click") @Arg(desc = "Pattern to set on left-click")
Pattern primary, Pattern primary,
@Arg(desc = "Block to set on right-click") @Arg(desc = "Pattern to set on right-click")
Pattern secondary) throws WorldEditException { Pattern secondary) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);

View File

@ -43,7 +43,7 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
@Override @Override
public Stream<String> getSuggestions(String input) { public Stream<String> getSuggestions(String input) {
if (input.isEmpty()) { if (input.isEmpty()) {
return Stream.of("#clipoard"); return Stream.of("#clipboard");
} }
String[] offsetParts = input.split("@", 2); String[] offsetParts = input.split("@", 2);
String firstLower = offsetParts[0].toLowerCase(Locale.ROOT); String firstLower = offsetParts[0].toLowerCase(Locale.ROOT);

View File

@ -27,13 +27,13 @@ import java.util.regex.Pattern;
public class YYMMDDHHIISSParser implements SnapshotDateParser { public class YYMMDDHHIISSParser implements SnapshotDateParser {
protected Pattern patt = private Pattern datePattern =
Pattern.compile("([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)[^0-9]?" Pattern.compile("([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)[^0-9]?"
+ "([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)"); + "([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)(\\..*)?");
@Override @Override
public Calendar detectDate(File file) { public Calendar detectDate(File file) {
Matcher matcher = patt.matcher(file.getName()); Matcher matcher = datePattern.matcher(file.getName());
if (matcher.matches()) { if (matcher.matches()) {
int year = Integer.parseInt(matcher.group(1)); int year = Integer.parseInt(matcher.group(1));
int month = Integer.parseInt(matcher.group(2)); int month = Integer.parseInt(matcher.group(2));