3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 10:30:04 +01:00

Typo fixes and command clarifications/cleanup.

Also re-disable the gradle daemon. It doesn't always play nice with
ForgeGradle and hogs ram.
Dieser Commit ist enthalten in:
wizjany 2019-07-03 13:01:59 -04:00
Ursprung 625cbe5e3d
Commit a2b3aabbbf
9 geänderte Dateien mit 45 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
# 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.
#org.gradle.jvmargs=-Xmx3G
#org.gradle.daemon=false
org.gradle.daemon=false

Datei anzeigen

@ -194,6 +194,7 @@ Other Permissions
``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.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())
}

Datei anzeigen

@ -666,9 +666,9 @@ public final class WorldEdit {
try {
engine = new RhinoCraftScriptEngine();
} catch (NoClassDefFoundError e) {
} catch (NoClassDefFoundError ignored) {
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;
}

Datei anzeigen

@ -150,7 +150,7 @@ public class BrushCommands {
public void clipboardBrush(Player player, LocalSession session,
@Switch(name = 'a', desc = "Don't paste air from the clipboard")
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,
@Switch(name = 'e', desc = "Paste entities if available")
boolean pasteEntities,

Datei anzeigen

@ -92,8 +92,7 @@ public class ClipboardCommands {
@Command(
name = "/cut",
desc = "Cut the selection to the clipboard",
descFooter = "WARNING: Cutting and pasting entities cannot be undone!"
desc = "Cut the selection to the clipboard"
)
@CommandPermissions("worldedit.clipboard.cut")
@Logging(REGION)
@ -105,7 +104,7 @@ public class ClipboardCommands {
boolean copyEntities,
@Switch(name = 'b', desc = "Also copy biomes, source biomes are unaffected")
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 {
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);

Datei anzeigen

@ -28,12 +28,19 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
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.Snapshot;
import com.sk89q.worldedit.world.storage.MissingWorldException;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import java.io.File;
import java.io.IOException;
@ -61,8 +68,8 @@ public class SnapshotCommands {
)
@CommandPermissions("worldedit.snapshots.list")
public void list(Player player,
@Arg(desc = "# of snapshots to list", def = "5")
int num) throws WorldEditException {
@ArgFlag(name = 'p', desc = "Page of results to return", def = "1")
int page) throws WorldEditException {
LocalConfiguration config = we.getConfiguration();
@ -75,15 +82,7 @@ public class SnapshotCommands {
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
if (!snapshots.isEmpty()) {
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.");
player.print(new SnapshotListBox(player.getWorld().getName(), snapshots).create(page));
} else {
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();
}
}
}

Datei anzeigen

@ -199,9 +199,9 @@ public class ToolCommands {
)
@CommandPermissions("worldedit.tool.lrbuild")
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,
@Arg(desc = "Block to set on right-click")
@Arg(desc = "Pattern to set on right-click")
Pattern secondary) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);

Datei anzeigen

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

Datei anzeigen

@ -27,13 +27,13 @@ import java.util.regex.Pattern;
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]?"
+ "([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)");
+ "([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)(\\..*)?");
@Override
public Calendar detectDate(File file) {
Matcher matcher = patt.matcher(file.getName());
Matcher matcher = datePattern.matcher(file.getName());
if (matcher.matches()) {
int year = Integer.parseInt(matcher.group(1));
int month = Integer.parseInt(matcher.group(2));