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

This commit is contained in:
Jesse Boyd 2019-11-21 13:50:28 +00:00
parent 66744bfaa4
commit 59b8465493
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
8 changed files with 39 additions and 34 deletions

View File

@ -53,5 +53,5 @@ dependencies {
// implementation("net.minecraftforge.gradle:ForgeGradle:3.0.143")
// implementation("net.fabricmc:fabric-loom:$loomVersion")
// 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")
}

View File

@ -827,28 +827,27 @@ public class SchematicCommands {
}
if (files.isEmpty()) {
actor.printError(BBC.SCHEMATIC_NONE.s());
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
return;
}
for (File f : files) {
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;
}
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");
continue;
}
if (!delete(f)) {
actor.printError("Deletion of " + filename + " failed! Maybe it is read-only.");
if (!deleteFile(f)) {
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
continue;
}
BBC.FILE_DELETED.send(actor, filename);
}
}
private boolean delete(File file) {
private boolean deleteFile(File file) {
if (file.delete()) {
new File(file.getParentFile(), "." + file.getName() + ".cached").delete();
return true;

View File

@ -27,6 +27,7 @@ import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.command.tool.BlockDataCyler;
import com.sk89q.worldedit.command.tool.BlockReplacer;
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
@ -126,7 +127,7 @@ public class ToolCommands {
static void setToolNone(Player player, LocalSession session, boolean isBrush)
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"));
}
private final WorldEdit we;
@ -142,9 +143,8 @@ public class ToolCommands {
)
@CommandPermissions("worldedit.setwand")
public void selwand(Player player, LocalSession session) throws WorldEditException {
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())));
}
@ -156,7 +156,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.setwand")
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);
player.printInfo(TranslatableComponent.of("worldedit.tool.navWand.equip", TextComponent.of(itemType.getName())));
}
@ -168,7 +168,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.info")
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());
player.printInfo(TranslatableComponent.of("worldedit.tool.info.equip", TextComponent.of(itemType.getName())));
}
@ -179,9 +179,9 @@ public class ToolCommands {
)
@CommandPermissions("worldedit.tool.inspect")
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());
BBC.TOOL_INSPECT.send(player, itemStack.getType().getName());
player.printInfo(TranslatableComponent.of("worldedit.tool.inspect.equip", TextComponent.of(itemType.getName())));
}
@Command(
@ -193,7 +193,7 @@ public class ToolCommands {
@Arg(desc = "Type of tree to generate", def = "tree")
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));
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")
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));
player.printInfo(TranslatableComponent.of("worldedit.tool.repl.equip", TextComponent.of(itemType.getName())));
}
@ -219,7 +219,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.data-cycler")
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());
player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.equip", TextComponent.of(itemType.getName())));
}
@ -243,7 +243,7 @@ public class ToolCommands {
return;
}
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
session.setTool(player, new FloodFillTool(range, pattern));
player.printInfo(TranslatableComponent.of("worldedit.tool.floodfill.equip", TextComponent.of(itemType.getName())));
}
@ -255,7 +255,7 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.deltree")
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());
player.printInfo(TranslatableComponent.of("worldedit.tool.deltree.equip", TextComponent.of(itemType.getName())));
}
@ -266,8 +266,7 @@ public class ToolCommands {
)
@CommandPermissions("worldedit.tool.farwand")
public void farwand(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 DistanceWand());
player.printInfo(TranslatableComponent.of("worldedit.tool.farwand.equip", TextComponent.of(itemType.getName())));
}
@ -285,7 +284,7 @@ public class ToolCommands {
Pattern secondary) throws WorldEditException {
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())));
String primaryName = "pattern";
String secondaryName = "pattern";

View File

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

View File

@ -40,7 +40,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
if (pos != null) {
player.findFreePosition(pos);
} else {
player.printError("No block in sight (or too far)!");
player.printError(TranslatableComponent.of("worldedit.jumpto.none"));
}
return true;
}
@ -53,7 +53,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
}
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;
}

View File

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

View File

@ -32,11 +32,11 @@ import java.util.List;
public class BlockDistributionResult extends PaginationBox {
private final List<Countable<BlockState>> distribution;
private final List<Countable> distribution;
private final int totalBlocks;
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" : ""));
this.distribution = distribution;
// note: doing things like region.getArea is inaccurate for non-cuboids.

View File

@ -96,6 +96,7 @@
"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.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.failed": "Deletion of {0} failed! Is it read-only?",
"worldedit.schematic.delete.deleted": "{0} has been deleted.",
@ -219,13 +220,13 @@
"worldedit.generate.changed": "{0} columns affected.",
"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.callback": "WorldEdit report: {0}.report",
"worldedit.report.callback": "FAWE report: {0}.report",
"worldedit.timezone.invalid": "Invalid timezone",
"worldedit.timezone.set": "Timezone set for this session to: {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.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.obstructed": "A tree can't go there.",
"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.internalid.hover": "Internal ID",
"worldedit.tool.info.light.hover": "Block Light/Light Above",