3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

Merge remote-tracking branch 'upstream/feature/translatable-text' int…

Dieser Commit ist enthalten in:
Jesse Boyd 2019-11-21 13:50:28 +00:00
Ursprung 66744bfaa4
Commit 59b8465493
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
8 geänderte Dateien mit 39 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -53,5 +53,5 @@ dependencies {
// implementation("net.minecraftforge.gradle:ForgeGradle:3.0.143") // implementation("net.minecraftforge.gradle:ForgeGradle:3.0.143")
// implementation("net.fabricmc:fabric-loom:$loomVersion") // implementation("net.fabricmc:fabric-loom:$loomVersion")
// implementation("net.fabricmc:sponge-mixin:$mixinVersion") // implementation("net.fabricmc:sponge-mixin:$mixinVersion")
// implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0") implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0")
} }

Datei anzeigen

@ -827,28 +827,27 @@ public class SchematicCommands {
} }
if (files.isEmpty()) { if (files.isEmpty()) {
actor.printError(BBC.SCHEMATIC_NONE.s()); actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
return; return;
} }
for (File f : files) { for (File f : files) {
if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) { if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) {
actor.printError("Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + !MainUtil.isInSubDirectory(working, f) actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
+ ")");
continue; continue;
} }
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) { if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) {
BBC.NO_PERM.send(actor, "worldedit.schematic.delete.other"); BBC.NO_PERM.send(actor, "worldedit.schematic.delete.other");
continue; continue;
} }
if (!delete(f)) { if (!deleteFile(f)) {
actor.printError("Deletion of " + filename + " failed! Maybe it is read-only."); actor.printError(TranslatableComponent.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
continue; continue;
} }
BBC.FILE_DELETED.send(actor, filename); BBC.FILE_DELETED.send(actor, filename);
} }
} }
private boolean delete(File file) { private boolean deleteFile(File file) {
if (file.delete()) { if (file.delete()) {
new File(file.getParentFile(), "." + file.getName() + ".cached").delete(); new File(file.getParentFile(), "." + file.getName() + ".cached").delete();
return true; return true;

Datei anzeigen

@ -27,6 +27,7 @@ import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.command.tool.BlockDataCyler; import com.sk89q.worldedit.command.tool.BlockDataCyler;
import com.sk89q.worldedit.command.tool.BlockReplacer; import com.sk89q.worldedit.command.tool.BlockReplacer;
import com.sk89q.worldedit.command.tool.InvalidToolBindException; import com.sk89q.worldedit.command.tool.InvalidToolBindException;
@ -126,7 +127,7 @@ public class ToolCommands {
static void setToolNone(Player player, LocalSession session, boolean isBrush) static void setToolNone(Player player, LocalSession session, boolean isBrush)
throws InvalidToolBindException { throws InvalidToolBindException {
session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null); session.setTool(player, null);
player.printInfo(TranslatableComponent.of(isBrush ? "worldedit.brush.none.equip" : "worldedit.tool.none.equip")); player.printInfo(TranslatableComponent.of(isBrush ? "worldedit.brush.none.equip" : "worldedit.tool.none.equip"));
} }
private final WorldEdit we; private final WorldEdit we;
@ -142,9 +143,8 @@ public class ToolCommands {
) )
@CommandPermissions("worldedit.setwand") @CommandPermissions("worldedit.setwand")
public void selwand(Player player, LocalSession session) throws WorldEditException { public void selwand(Player player, LocalSession session) throws WorldEditException {
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType(); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(itemType, SelectionWand.INSTANCE); session.setTool(player, SelectionWand.INSTANCE);
player.printInfo(TranslatableComponent.of("worldedit.tool.selwand.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.selwand.equip", TextComponent.of(itemType.getName())));
} }
@ -156,7 +156,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.setwand") @CommandPermissions("worldedit.setwand")
public void navwand(Player player, LocalSession session) throws WorldEditException { public void navwand(Player player, LocalSession session) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, NavigationWand.INSTANCE); session.setTool(player, NavigationWand.INSTANCE);
player.printInfo(TranslatableComponent.of("worldedit.tool.navWand.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.navWand.equip", TextComponent.of(itemType.getName())));
} }
@ -168,7 +168,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.info") @CommandPermissions("worldedit.tool.info")
public void info(Player player, LocalSession session) throws WorldEditException { public void info(Player player, LocalSession session) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new QueryTool()); session.setTool(player, new QueryTool());
player.printInfo(TranslatableComponent.of("worldedit.tool.info.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.info.equip", TextComponent.of(itemType.getName())));
} }
@ -179,9 +179,9 @@ public class ToolCommands {
) )
@CommandPermissions("worldedit.tool.inspect") @CommandPermissions("worldedit.tool.inspect")
public void inspectBrush(Player player, LocalSession session) throws WorldEditException { public void inspectBrush(Player player, LocalSession session) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new InspectBrush()); session.setTool(player, new InspectBrush());
BBC.TOOL_INSPECT.send(player, itemStack.getType().getName()); player.printInfo(TranslatableComponent.of("worldedit.tool.inspect.equip", TextComponent.of(itemType.getName())));
} }
@Command( @Command(
@ -193,7 +193,7 @@ public class ToolCommands {
@Arg(desc = "Type of tree to generate", def = "tree") @Arg(desc = "Type of tree to generate", def = "tree")
TreeGenerator.TreeType type) throws WorldEditException { TreeGenerator.TreeType type) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new TreePlanter(type)); session.setTool(player, new TreePlanter(type));
player.printInfo(TranslatableComponent.of("worldedit.tool.tree.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.tree.equip", TextComponent.of(itemType.getName())));
} }
@ -207,7 +207,7 @@ public class ToolCommands {
@Arg(desc = "The pattern of blocks to place") @Arg(desc = "The pattern of blocks to place")
Pattern pattern) throws WorldEditException { Pattern pattern) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new BlockReplacer(pattern)); session.setTool(player, new BlockReplacer(pattern));
player.printInfo(TranslatableComponent.of("worldedit.tool.repl.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.repl.equip", TextComponent.of(itemType.getName())));
} }
@ -219,7 +219,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.data-cycler") @CommandPermissions("worldedit.tool.data-cycler")
public void cycler(Player player, LocalSession session) throws WorldEditException { public void cycler(Player player, LocalSession session) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new BlockDataCyler()); session.setTool(player, new BlockDataCyler());
player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.equip", TextComponent.of(itemType.getName())));
} }
@ -243,7 +243,7 @@ public class ToolCommands {
return; return;
} }
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new FloodFillTool(range, pattern)); session.setTool(player, new FloodFillTool(range, pattern));
player.printInfo(TranslatableComponent.of("worldedit.tool.floodfill.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.floodfill.equip", TextComponent.of(itemType.getName())));
} }
@ -255,7 +255,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.deltree") @CommandPermissions("worldedit.tool.deltree")
public void deltree(Player player, LocalSession session) throws WorldEditException { public void deltree(Player player, LocalSession session) throws WorldEditException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new FloatingTreeRemover()); session.setTool(player, new FloatingTreeRemover());
player.printInfo(TranslatableComponent.of("worldedit.tool.deltree.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.deltree.equip", TextComponent.of(itemType.getName())));
} }
@ -266,8 +266,7 @@ public class ToolCommands {
) )
@CommandPermissions("worldedit.tool.farwand") @CommandPermissions("worldedit.tool.farwand")
public void farwand(Player player, LocalSession session) throws WorldEditException { public void farwand(Player player, LocalSession session) throws WorldEditException {
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
session.setTool(player, new DistanceWand()); session.setTool(player, new DistanceWand());
player.printInfo(TranslatableComponent.of("worldedit.tool.farwand.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.farwand.equip", TextComponent.of(itemType.getName())));
} }
@ -285,7 +284,7 @@ public class ToolCommands {
Pattern secondary) throws WorldEditException { Pattern secondary) throws WorldEditException {
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType(); final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(itemType, new LongRangeBuildTool(primary, secondary)); session.setTool(player, new LongRangeBuildTool(primary, secondary));
player.printInfo(TranslatableComponent.of("worldedit.tool.lrbuild.equip", TextComponent.of(itemType.getName()))); player.printInfo(TranslatableComponent.of("worldedit.tool.lrbuild.equip", TextComponent.of(itemType.getName())));
String primaryName = "pattern"; String primaryName = "pattern";
String secondaryName = "pattern"; String secondaryName = "pattern";

Datei anzeigen

@ -508,7 +508,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
if (target == null) { if (target == null) {
editSession.cancel(); editSession.cancel();
player.print(BBC.NO_BLOCK.s()); player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
return true; return true;
} }
BlockBag bag = session.getBlockBag(player); BlockBag bag = session.getBlockBag(player);
@ -543,7 +543,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
WorldEdit.getInstance().checkMaxBrushRadius(size); WorldEdit.getInstance().checkMaxBrushRadius(size);
brush.build(editSession, target.toBlockPoint(), current.getMaterial(), size); brush.build(editSession, target.toBlockPoint(), current.getMaterial(), size);
} catch (MaxChangedBlocksException e) { } catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached."); player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
} finally { } finally {
session.remember(editSession); session.remember(editSession);
if (bag != null) { if (bag != null) {

Datei anzeigen

@ -40,7 +40,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
if (pos != null) { if (pos != null) {
player.findFreePosition(pos); player.findFreePosition(pos);
} else { } else {
player.printError("No block in sight (or too far)!"); player.printError(TranslatableComponent.of("worldedit.jumpto.none"));
} }
return true; return true;
} }
@ -53,7 +53,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
} }
if (!player.passThroughForwardWall(Math.max(1, maxDist - 10))) { if (!player.passThroughForwardWall(Math.max(1, maxDist - 10))) {
player.printError("Nothing to pass through (or too far)!"); player.printError(TranslatableComponent.of("worldedit.thru.obstructed"));
} }
return true; return true;
} }

Datei anzeigen

@ -774,9 +774,14 @@ public final class PlatformCommandManager {
editSession.flushQueue(); editSession.flushQueue();
session.remember(editSession); session.remember(editSession);
long time = System.currentTimeMillis() - start; long timems = System.currentTimeMillis() - start;
if (time > 1000) { if (timems > 1000) {
BBC.ACTION_COMPLETE.send(actor, time / 1000D); actor.printDebug(TranslatableComponent.of(
"worldedit.command.time-elapsed",
TextComponent.of(timems + "m"),
TextComponent.of(-1),
TextComponent.of(Math.round(-1))
));
} }
worldEdit.flushBlockBag(actor, editSession); worldEdit.flushBlockBag(actor, editSession);

Datei anzeigen

@ -32,11 +32,11 @@ import java.util.List;
public class BlockDistributionResult extends PaginationBox { public class BlockDistributionResult extends PaginationBox {
private final List<Countable<BlockState>> distribution; private final List<Countable> distribution;
private final int totalBlocks; private final int totalBlocks;
private final boolean separateStates; private final boolean separateStates;
public BlockDistributionResult(List<Countable<BlockState>> distribution, boolean separateStates) { public BlockDistributionResult(List<Countable> distribution, boolean separateStates) {
super("Block Distribution", "//distr -p %page%" + (separateStates ? " -d" : "")); super("Block Distribution", "//distr -p %page%" + (separateStates ? " -d" : ""));
this.distribution = distribution; this.distribution = distribution;
// note: doing things like region.getArea is inaccurate for non-cuboids. // note: doing things like region.getArea is inaccurate for non-cuboids.

Datei anzeigen

@ -96,6 +96,7 @@
"worldedit.schematic.save.already-exists": "That schematic already exists. Use the -f flag to overwrite it.", "worldedit.schematic.save.already-exists": "That schematic already exists. Use the -f flag to overwrite it.",
"worldedit.schematic.save.failed-directory": "Could not create folder for schematics!", "worldedit.schematic.save.failed-directory": "Could not create folder for schematics!",
"worldedit.schematic.save.saving": "(Please wait... saving schematic.)", "worldedit.schematic.save.saving": "(Please wait... saving schematic.)",
"worldedit.schematic.delete.empty": "Schematic {0} not found!",
"worldedit.schematic.delete.does-not-exist": "Schematic {0} does not exist!", "worldedit.schematic.delete.does-not-exist": "Schematic {0} does not exist!",
"worldedit.schematic.delete.failed": "Deletion of {0} failed! Is it read-only?", "worldedit.schematic.delete.failed": "Deletion of {0} failed! Is it read-only?",
"worldedit.schematic.delete.deleted": "{0} has been deleted.", "worldedit.schematic.delete.deleted": "{0} has been deleted.",
@ -219,13 +220,13 @@
"worldedit.generate.changed": "{0} columns affected.", "worldedit.generate.changed": "{0} columns affected.",
"worldedit.reload.config": "Configuration reloaded!", "worldedit.reload.config": "Configuration reloaded!",
"worldedit.report.written": "WorldEdit report written to {0}", "worldedit.report.written": "FAWE report written to {0}",
"worldedit.report.error": "Failed to write report: {0}", "worldedit.report.error": "Failed to write report: {0}",
"worldedit.report.callback": "WorldEdit report: {0}.report", "worldedit.report.callback": "FAWE report: {0}.report",
"worldedit.timezone.invalid": "Invalid timezone", "worldedit.timezone.invalid": "Invalid timezone",
"worldedit.timezone.set": "Timezone set for this session to: {0}", "worldedit.timezone.set": "Timezone set for this session to: {0}",
"worldedit.timezone.current": "The current time in that timezone is: {0}", "worldedit.timezone.current": "The current time in that timezone is: {0}",
"worldedit.version.version": "WorldEdit version {0}", "worldedit.version.version": "FAWE version:\n - Date {0}\n - Commit {1}\n - Build {2}\n - Platform {3}",
"worldedit.command.time-elapsed": "{0}s elapsed (history: {1} changed; {2} blocks/sec).", "worldedit.command.time-elapsed": "{0}s elapsed (history: {1} changed; {2} blocks/sec).",
"worldedit.command.permissions": "You are not permitted to do that. Are you in the right mode?", "worldedit.command.permissions": "You are not permitted to do that. Are you in the right mode?",
@ -250,6 +251,7 @@
"worldedit.tool.tree.equip": "Tree tool bound to {0}.", "worldedit.tool.tree.equip": "Tree tool bound to {0}.",
"worldedit.tool.tree.obstructed": "A tree can't go there.", "worldedit.tool.tree.obstructed": "A tree can't go there.",
"worldedit.tool.info.equip": "Info tool bound to {0}.", "worldedit.tool.info.equip": "Info tool bound to {0}.",
"worldedit.tool.inspect.equip": "Inspect tool bound to {0}.",
"worldedit.tool.info.blockstate.hover": "Block state", "worldedit.tool.info.blockstate.hover": "Block state",
"worldedit.tool.info.internalid.hover": "Internal ID", "worldedit.tool.info.internalid.hover": "Internal ID",
"worldedit.tool.info.light.hover": "Block Light/Light Above", "worldedit.tool.info.light.hover": "Block Light/Light Above",