From ab3394c35e5e02564cccafc6a49ff1aaf6ab939e Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 7 Apr 2019 01:13:23 +0200 Subject: [PATCH] Add prefixes and make FAWE more translatable --- .../main/java/com/boydti/fawe/config/BBC.java | 16 ++++++- .../java/com/sk89q/worldedit/WorldEdit.java | 19 ++++---- .../worldedit/command/ChunkCommands.java | 2 +- .../worldedit/command/GeneralCommands.java | 20 ++++---- .../worldedit/command/RegionCommands.java | 4 +- .../worldedit/command/SchematicCommands.java | 26 +++++------ .../worldedit/command/ScriptingCommands.java | 19 ++++---- .../worldedit/command/SelectionCommands.java | 6 +-- .../worldedit/command/SnapshotCommands.java | 46 +++++++++---------- .../command/SnapshotUtilCommands.java | 18 ++++---- .../worldedit/command/ToolUtilCommands.java | 5 +- .../worldedit/command/tool/DistanceWand.java | 3 +- .../command/tool/FloatingTreeRemover.java | 5 +- .../worldedit/command/tool/TreePlanter.java | 5 +- .../extension/platform/PlatformManager.java | 2 +- .../extent/clipboard/io/ClipboardFormats.java | 4 +- 16 files changed, 110 insertions(+), 90 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java b/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java index c4982a2a9..58e7f50c3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java @@ -72,7 +72,6 @@ public enum BBC { COMMAND_COPY("%s0 blocks were copied.", "WorldEdit.Copy"), - COMMAND_CUT_SLOW("%s0 blocks were cut.", "WorldEdit.Cut"), COMMAND_CUT_LAZY("%s0 blocks will be removed on paste", "WorldEdit.Cut"), @@ -156,6 +155,7 @@ public enum BBC { TOOL_NONE("Tool unbound from your current item.", "WorldEdit.Tool"), TOOL_INFO("Info tool bound to %s0.", "WorldEdit.Tool"), TOOL_TREE("Tree tool bound to %s0.", "WorldEdit.Tool"), + TOOL_TREE_ERROR_BLOCK("A tree can't go here", "WorldEdit.Tool"), TOOL_TREE_ERROR("Tree type %s0 is unknown.", "WorldEdit.Tool"), TOOL_REPL("Block replacer tool bound to %s0.", "WorldEdit.Tool"), TOOL_CYCLER("Block data cycler tool bound to %s0.", "WorldEdit.Tool"), @@ -163,6 +163,8 @@ public enum BBC { TOOL_RANGE_ERROR("Maximum range: %s0.", "WorldEdit.Tool"), TOOL_RADIUS_ERROR("Maximum allowed brush radius: %s0.", "WorldEdit.Tool"), TOOL_DELTREE("Floating tree remover tool bound to %s0.", "WorldEdit.Tool"), + TOOL_DELTREE_ERROR("That's not a tree", "WorldEdit.Tool"), + TOOL_DELTREE_FLOATING_ERROR("That's not a floating tree", "WorldEdit.Tool"), TOOL_FARWAND("Far wand tool bound to %s0.", "WorldEdit.Tool"), TOOL_LRBUILD_BOUND("Long-range building tool bound to %s0.", "WorldEdit.Tool"), TOOL_LRBUILD_INFO("Left-click set to %s0; right-click set to %s1.", "WorldEdit.Tool"), @@ -175,6 +177,14 @@ public enum BBC { SNAPSHOT_NEWEST("Now using newest snapshot.", "WorldEdit.Snapshot"), SNAPSHOT_LIST_HEADER("Snapshots for world (%s0):", "WorldEdit.Snapshot"), SNAPSHOT_LIST_FOOTER("Use /snap use [snapshot] or /snap use latest.", "WorldEdit.Snapshot"), + SNAPSHOT_NOT_CONFIGURED("Snapshot/backup restore is not configured.", "WorldEdit.Snapshot"), + SNAPSHOT_NOT_AVAILABLE("No snapshots are available. See console for details.", "WorldEdit.Snapshot"), + SNAPSHOT_NOT_FOUND_WORLD("No snapshots were found for this world.", "WorldEdit.Snapshot"), + SNAPSHOT_NOT_FOUND("No snapshots were found.", "WorldEdit.Snapshot"), + SNAPSHOT_INVALID_INDEX("Invalid index, must be equal or higher then 1.", "WorldEdit.Snapshot"), + SNAPSHOT_ERROR_DATE("Could not detect the date inputted.", "WorldEdit.Snapshot"), + SNAPSHOT_ERROR_RESTORE("Errors prevented any blocks from being restored.", "WorldEdit.Snapshot"), + SNAPSHOT_ERROR_RESTORE_CHUNKS("No chunks could be loaded. (Bad archive?)", "WorldEdit.Snapshot"), BIOME_LIST_HEADER("Biomes (page %s0/%s1):", "WorldEdit.Biome"), BIOME_CHANGED("Biomes were changed in %s0 columns.", "WorldEdit.Biome"), @@ -299,6 +309,10 @@ public enum BBC { SEL_LIST("For a list of selection types use:&c //sel list", "Selection"), SEL_MODES("Select one of the modes below:", "Selection"), + SCRIPTING_NO_PERM("&cYou do not have permission to execute this craft script", "WorldEdit.Scripting"), + SCRIPTING_CS("Use /cs with a script name first.", "WorldEdit.Scripting"), + SCRIPTING_ERROR("An error occured while executing a craft script", "WorldEditScripting"), + TIP_SEL_LIST("Tip: See the different selection modes with &c//sel list", "Tips"), TIP_SELECT_CONNECTED("Tip: Select all connected blocks with //sel fuzzy", "Tips"), TIP_SET_POS1("Tip: Use pos1 as a pattern with &c//set pos1", "Tips"), diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 9c98f2ea5..3474c5e51 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit; +import com.boydti.fawe.config.BBC; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.sk89q.worldedit.blocks.BaseItem; @@ -611,7 +612,7 @@ public final class WorldEdit { String ext = filename.substring(index + 1); if (!ext.equalsIgnoreCase("js")) { - player.printError("Only .js scripts are currently supported"); + player.printError(BBC.getPrefix() + "Only .js scripts are currently supported"); return; } @@ -624,7 +625,7 @@ public final class WorldEdit { file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename); if (file == null) { - player.printError("Script does not exist: " + filename); + player.printError(BBC.getPrefix() + "Script does not exist: " + filename); return; } } else { @@ -637,7 +638,7 @@ public final class WorldEdit { in.close(); script = new String(data, 0, data.length, StandardCharsets.UTF_8); } catch (IOException e) { - player.printError("Script read error: " + e.getMessage()); + player.printError(BBC.getPrefix() + "Script read error: " + e.getMessage()); return; } @@ -650,8 +651,8 @@ public final class WorldEdit { try { engine = new RhinoCraftScriptEngine(); } catch (NoClassDefFoundError e) { - player.printError("Failed to find an installed script engine."); - player.printError("Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation"); + player.printError(BBC.getPrefix() + "Failed to find an installed script engine."); + player.printError(BBC.getPrefix() + "Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation"); return; } @@ -665,15 +666,15 @@ public final class WorldEdit { try { engine.evaluate(script, filename, vars); } catch (ScriptException e) { - player.printError("Failed to execute:"); + player.printError(BBC.getPrefix() + "Failed to execute:"); player.printRaw(e.getMessage()); - logger.warn("Failed to execute script", e); + logger.warn(BBC.getPrefix() + "Failed to execute script", e); } catch (NumberFormatException | WorldEditException e) { throw e; } catch (Throwable e) { - player.printError("Failed to execute (see console):"); + player.printError(BBC.getPrefix() + "Failed to execute (see console):"); player.printRaw(e.getClass().getCanonicalName()); - logger.warn("Failed to execute script", e); + logger.warn(BBC.getPrefix() + "Failed to execute script", e); } finally { for (EditSession editSession : scriptContext.getEditSessions()) { editSession.flushSession(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java index c36fa5b53..c4bd6a72c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java @@ -115,7 +115,7 @@ public class ChunkCommands { FileOutputStream out = null; if (config.shellSaveType == null) { - player.printError("Shell script type must be configured: 'bat' or 'bash' expected."); + player.printError(BBC.getPrefix() + "Shell script type must be configured: 'bat' or 'bash' expected."); } else if (config.shellSaveType.equalsIgnoreCase("bat")) { try { out = new FileOutputStream("worldedit-delchunks.bat"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 4899ad812..a212a76f3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -68,7 +68,7 @@ public class GeneralCommands { int limit = args.argsLength() == 0 ? config.defaultChangeLimit : Math.max(-1, args.getInteger(0)); if (!mayDisable && config.maxChangeLimit > -1) { if (limit > config.maxChangeLimit) { - player.printError("Your maximum allowable limit is " + config.maxChangeLimit + "."); + player.printError(BBC.getPrefix() + "Your maximum allowable limit is " + config.maxChangeLimit + "."); return; } } @@ -76,9 +76,9 @@ public class GeneralCommands { session.setBlockChangeLimit(limit); if (limit != config.defaultChangeLimit) { - player.print("Block change limit set to " + limit + ". (Use //limit to go back to the default.)"); + player.print(BBC.getPrefix() + "Block change limit set to " + limit + ". (Use //limit to go back to the default.)"); } else { - player.print("Block change limit set to " + limit + "."); + player.print(BBC.getPrefix() + "Block change limit set to " + limit + "."); } } @@ -98,7 +98,7 @@ public class GeneralCommands { int limit = args.argsLength() == 0 ? config.calculationTimeout : Math.max(-1, args.getInteger(0)); if (!mayDisable && config.maxCalculationTimeout > -1) { if (limit > config.maxCalculationTimeout) { - player.printError("Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms."); + player.printError(BBC.getPrefix() + "Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms."); return; } } @@ -106,9 +106,9 @@ public class GeneralCommands { session.setTimeout(limit); if (limit != config.calculationTimeout) { - player.print("Timeout time set to " + limit + " ms. (Use //timeout to go back to the default.)"); + player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms. (Use //timeout to go back to the default.)"); } else { - player.print("Timeout time set to " + limit + " ms."); + player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms."); } } @@ -125,7 +125,7 @@ public class GeneralCommands { String newState = args.getString(0, null); if (session.hasFastMode()) { if ("on".equals(newState)) { - player.printError("Fast mode already enabled."); + player.printError(BBC.getPrefix() + "Fast mode already enabled."); return; } @@ -133,7 +133,7 @@ public class GeneralCommands { player.print("Fast mode disabled."); } else { if ("off".equals(newState)) { - player.printError("Fast mode already disabled."); + player.printError(BBC.getPrefix() + "Fast mode already disabled."); return; } @@ -158,7 +158,7 @@ public class GeneralCommands { String newState = args.getString(0, null); if (session.shouldUseServerCUI()) { if ("on".equals(newState)) { - player.printError("Server CUI already enabled."); + player.printError(BBC.getPrefix() + "Server CUI already enabled."); return; } @@ -167,7 +167,7 @@ public class GeneralCommands { player.print("Server CUI disabled."); } else { if ("off".equals(newState)) { - player.printError("Server CUI already disabled."); + player.printError(BBC.getPrefix() + "Server CUI already disabled."); return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index ac132fe11..09f120fc4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -249,7 +249,7 @@ public class RegionCommands extends MethodCommands { @Switch('h') boolean shell) throws WorldEditException { if (!(region instanceof CuboidRegion)) { - player.printError("//line only works with cuboid selections"); + player.printError(BBC.getPrefix() + "//line only works with cuboid selections"); return; } @@ -770,7 +770,7 @@ public class RegionCommands extends MethodCommands { public void forest(Player player, EditSession editSession, @Selection Region region, @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException { int affected = editSession.makeForest(region, density / 100, type); - player.print(affected + " trees created."); + BBC.COMMAND_TREE.send(player, affected); } @Command( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 5dacbb5a5..9db229f9b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -243,7 +243,7 @@ public class SchematicCommands extends MethodCommands { } f = player.openFileOpenDialog(extensions); if (f == null || !f.exists()) { - player.printError("Schematic " + filename + " does not exist! (" + f + ")"); + player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + f + ")"); return; } } else { @@ -264,7 +264,7 @@ public class SchematicCommands extends MethodCommands { } } if (f == null || !f.exists() || !MainUtil.isInSubDirectory(working, f)) { - player.printError("Schematic " + filename + " does not exist! (" + ((f == null) ? false : f.exists()) + "|" + f + "|" + (f == null ? false : !MainUtil.isInSubDirectory(working, f)) + ")"); + player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + ((f == null) ? false : f.exists()) + "|" + f + "|" + (f == null ? false : !MainUtil.isInSubDirectory(working, f)) + ")"); return; } if (format == null) { @@ -280,9 +280,9 @@ public class SchematicCommands extends MethodCommands { format.hold(player, uri, in); BBC.SCHEMATIC_LOADED.send(player, filename); } catch (IllegalArgumentException e) { - player.printError("Unknown filename: " + filename); + player.printError(BBC.getPrefix() + "Unknown filename: " + filename); } catch (URISyntaxException | IOException e) { - player.printError("File could not be read or it does not exist: " + e.getMessage()); + player.printError(BBC.getPrefix() + "File could not be read or it does not exist: " + e.getMessage()); log.warn("Failed to load a saved clipboard", e); } finally { if (in != null) { @@ -301,7 +301,7 @@ public class SchematicCommands extends MethodCommands { final LocalConfiguration config = this.worldEdit.getConfiguration(); final ClipboardFormat format = ClipboardFormats.findByAlias(formatName); if (format == null) { - player.printError("Unknown schematic format: " + formatName); + player.printError(BBC.getPrefix() + "Unknown schematic format: " + formatName); return; } File working = this.worldEdit.getWorkingDirectoryFile(config.saveDir); @@ -333,7 +333,7 @@ public class SchematicCommands extends MethodCommands { Files.createDirectories(parent.toPath()); } catch (IOException e) { e.printStackTrace(); - log.info("Could not create folder for schematics!"); + log.info(BBC.getPrefix() + "Could not create folder for schematics!"); return; } } @@ -378,11 +378,11 @@ public class SchematicCommands extends MethodCommands { } } catch (IllegalArgumentException e) { e.printStackTrace(); - player.printError("Unknown filename: " + filename); + player.printError(BBC.getPrefix() + "Unknown filename: " + filename); } catch (IOException e) { e.printStackTrace(); - player.printError("Schematic could not written: " + e.getMessage()); - log.warn("Failed to write a saved clipboard", e); + player.printError(BBC.getPrefix() + "Schematic could not written: " + e.getMessage()); + log.warn(BBC.getPrefix() + "Failed to write a saved clipboard", e); } } @@ -394,7 +394,7 @@ public class SchematicCommands extends MethodCommands { final File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working; File destDir = new File(dir, directory); if (!MainUtil.isInSubDirectory(working, destDir)) { - player.printError("Directory " + destDir + " does not exist!"); + player.printError(BBC.getPrefix() + "Directory " + destDir + " does not exist!"); return; } if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) { @@ -408,7 +408,7 @@ public class SchematicCommands extends MethodCommands { return; } if (!destDir.exists() && !destDir.mkdirs()) { - player.printError("Creation of " + destDir + " failed! (check file permissions)"); + player.printError(BBC.getPrefix() + "Creation of " + destDir + " failed! (check file permissions)"); return; } for (File source : sources) { @@ -454,7 +454,7 @@ public class SchematicCommands extends MethodCommands { } for (File f : files) { if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) { - player.printError("Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + (!MainUtil.isInSubDirectory(working, f)) + ")"); + player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + (!MainUtil.isInSubDirectory(working, f)) + ")"); continue; } if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !player.hasPermission("worldedit.schematic.delete.other")) { @@ -462,7 +462,7 @@ public class SchematicCommands extends MethodCommands { continue; } if (!delete(f)) { - player.printError("Deletion of " + filename + " failed! Maybe it is read-only."); + player.printError(BBC.getPrefix() + "Deletion of " + filename + " failed! Maybe it is read-only."); continue; } BBC.FILE_DELETED.send(player, filename); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java index 602a019c9..9693b143c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.command; +import com.boydti.fawe.config.BBC; import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; @@ -84,7 +85,7 @@ public class ScriptingCommands { String ext = filename.substring(index + 1, filename.length()); if (!ext.equalsIgnoreCase("js")) { - actor.printError("Only .js scripts are currently supported"); + actor.printError(BBC.getPrefix() + "Only .js scripts are currently supported"); return null; } @@ -97,7 +98,7 @@ public class ScriptingCommands { file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename); if (file == null) { - actor.printError("Script does not exist: " + filename); + actor.printError(BBC.getPrefix() + "Script does not exist: " + filename); return null; } } else { @@ -110,7 +111,7 @@ public class ScriptingCommands { in.close(); script = new String(data, 0, data.length, "utf-8"); } catch (IOException e) { - actor.printError("Script read error: " + e.getMessage()); + actor.printError(BBC.getPrefix() + "Script read error: " + e.getMessage()); return null; } @@ -145,14 +146,14 @@ public class ScriptingCommands { result = engine.evaluate(script, filename, vars); } catch (ScriptException e) { e.printStackTrace(); - actor.printError("Failed to execute:"); + actor.printError(BBC.getPrefix() + "Failed to execute:"); actor.printRaw(e.getMessage()); } catch (NumberFormatException e) { throw e; } catch (WorldEditException e) { throw e; } catch (Throwable e) { - actor.printError("Failed to execute (see console):"); + actor.printError(BBC.getPrefix() + "Failed to execute (see console):"); actor.printRaw(e.getClass().getCanonicalName()); } if (result instanceof NativeJavaObject) { @@ -169,7 +170,7 @@ public class ScriptingCommands { final String name = args.getString(0); if (!player.hasPermission("worldedit.scripting.execute." + name)) { - player.printError("You don't have permission to use that script."); + BBC.SCRIPTING_NO_PERM.send(player); return; } @@ -197,12 +198,12 @@ public class ScriptingCommands { String lastScript = session.getLastScript(); if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) { - player.printError("You don't have permission to use that script."); + BBC.SCRIPTING_NO_PERM.send(player); return; } if (lastScript == null) { - player.printError("Use /cs with a script name first."); + BBC.SCRIPTING_CS.send(player); return; } @@ -214,7 +215,7 @@ public class ScriptingCommands { try { this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs); } catch (final WorldEditException ex) { - player.printError("Error while executing CraftScript."); + BBC.SCRIPTING_ERROR.send(player); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java index 91c6e27eb..840cb6d7c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java @@ -181,7 +181,7 @@ public class SelectionCommands { session.getRegionSelector(player.getWorld()) .explainPrimarySelection(player, session, pos); } else { - player.printError("No block in sight!"); + BBC.NO_BLOCK.send(player); } } @@ -205,7 +205,7 @@ public class SelectionCommands { session.getRegionSelector(player.getWorld()) .explainSecondarySelection(player, session, pos); } else { - player.printError("No block in sight!"); + BBC.NO_BLOCK.send(player); } } @@ -713,7 +713,7 @@ public class SelectionCommands { size = session.getSelection(player.getWorld()).getArea(); if (distributionData.size() <= 0) { - player.printError("No blocks counted."); + player.printError(BBC.getPrefix() + "No blocks counted."); return; } BBC.SELECTION_DISTR.send(player, size); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java index 9efed048f..178811dfa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java @@ -68,7 +68,7 @@ public class SnapshotCommands { LocalConfiguration config = we.getConfiguration(); if (config.snapshotRepo == null) { - player.printError("Snapshot/backup restore is not configured."); + BBC.SNAPSHOT_NOT_CONFIGURED.send(player); return; } @@ -86,22 +86,22 @@ public class SnapshotCommands { BBC.SNAPSHOT_LIST_FOOTER.send(player); } else { - player.printError("No snapshots are available. See console for details."); + BBC.SNAPSHOT_NOT_AVAILABLE.send(player); // Okay, let's toss some debugging information! File dir = config.snapshotRepo.getDirectory(); try { - WorldEdit.logger.info("WorldEdit found no snapshots: looked in: " + WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in: " + dir.getCanonicalPath()); } catch (IOException e) { - WorldEdit.logger.info("WorldEdit found no snapshots: looked in " + WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in " + "(NON-RESOLVABLE PATH - does it exist?): " + dir.getPath()); } } } catch (MissingWorldException ex) { - player.printError("No snapshots were found for this world."); + BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player); } } @@ -118,7 +118,7 @@ public class SnapshotCommands { LocalConfiguration config = we.getConfiguration(); if (config.snapshotRepo == null) { - player.printError("Snapshot/backup restore is not configured."); + BBC.SNAPSHOT_NOT_CONFIGURED.send(player); return; } @@ -133,17 +133,17 @@ public class SnapshotCommands { session.setSnapshot(null); BBC.SNAPSHOT_NEWEST.send(player); } else { - player.printError("No snapshots were found."); + BBC.SNAPSHOT_NOT_FOUND.send(player); } } catch (MissingWorldException ex) { - player.printError("No snapshots were found for this world."); + BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player); } } else { try { session.setSnapshot(config.snapshotRepo.getSnapshot(name)); BBC.SNAPSHOT_SET.send(player, name); } catch (InvalidSnapshotException e) { - player.printError("That snapshot does not exist or is not available."); + BBC.SNAPSHOT_NOT_AVAILABLE.send(player); } } } @@ -160,7 +160,7 @@ public class SnapshotCommands { LocalConfiguration config = we.getConfiguration(); if (config.snapshotRepo == null) { - player.printError("Snapshot/backup restore is not configured."); + BBC.SNAPSHOT_NOT_CONFIGURED.send(player); return; } @@ -168,30 +168,30 @@ public class SnapshotCommands { try { index = Integer.parseInt(args.getString(0)); } catch (NumberFormatException e) { - player.printError("Invalid index, " + args.getString(0) + " is not a valid integer."); + player.printError(BBC.getPrefix() + "Invalid index, " + args.getString(0) + " is not a valid integer."); return; } if (index < 1) { - player.printError("Invalid index, must be equal or higher then 1."); + BBC.SNAPSHOT_INVALID_INDEX.send(player); return; } try { List snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName()); if (snapshots.size() < index) { - player.printError("Invalid index, must be between 1 and " + snapshots.size() + "."); + player.printError(BBC.getPrefix() + "Invalid index, must be between 1 and " + snapshots.size() + "."); return; } Snapshot snapshot = snapshots.get(index - 1); if (snapshot == null) { - player.printError("That snapshot does not exist or is not available."); + BBC.SNAPSHOT_NOT_AVAILABLE.send(player); return; } session.setSnapshot(snapshot); BBC.SNAPSHOT_SET.send(player, snapshot.getName()); } catch (MissingWorldException e) { - player.printError("No snapshots were found for this world."); + BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player); } } @@ -208,28 +208,28 @@ public class SnapshotCommands { LocalConfiguration config = we.getConfiguration(); if (config.snapshotRepo == null) { - player.printError("Snapshot/backup restore is not configured."); + BBC.SNAPSHOT_NOT_CONFIGURED.send(player); return; } Calendar date = session.detectDate(args.getJoinedStrings(0)); if (date == null) { - player.printError("Could not detect the date inputted."); + BBC.SNAPSHOT_ERROR_DATE.send(player); } else { try { Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, player.getWorld().getName()); if (snapshot == null) { dateFormat.setTimeZone(session.getTimeZone()); - player.printError("Couldn't find a snapshot before " + player.printError(BBC.getPrefix() + "Couldn't find a snapshot before " + dateFormat.format(date.getTime()) + "."); } else { session.setSnapshot(snapshot); BBC.SNAPSHOT_SET.send(player, snapshot.getName()); } } catch (MissingWorldException ex) { - player.printError("No snapshots were found for this world."); + BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player); } } } @@ -247,27 +247,27 @@ public class SnapshotCommands { LocalConfiguration config = we.getConfiguration(); if (config.snapshotRepo == null) { - player.printError("Snapshot/backup restore is not configured."); + BBC.SNAPSHOT_NOT_CONFIGURED.send(player); return; } Calendar date = session.detectDate(args.getJoinedStrings(0)); if (date == null) { - player.printError("Could not detect the date inputted."); + BBC.SNAPSHOT_ERROR_DATE.send(player); } else { try { Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName()); if (snapshot == null) { dateFormat.setTimeZone(session.getTimeZone()); - player.printError("Couldn't find a snapshot after " + player.printError(BBC.getPrefix() + "Couldn't find a snapshot after " + dateFormat.format(date.getTime()) + "."); } else { session.setSnapshot(snapshot); BBC.SNAPSHOT_SET.send(player, snapshot.getName()); } } catch (MissingWorldException ex) { - player.printError("No snapshots were found for this world."); + BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java index 5b860d579..171c16b70 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java @@ -66,7 +66,7 @@ public class SnapshotUtilCommands { LocalConfiguration config = we.getConfiguration(); if (config.snapshotRepo == null) { - player.printError("Snapshot/backup restore is not configured."); + BBC.SNAPSHOT_NOT_CONFIGURED.send(player); return; } @@ -77,7 +77,7 @@ public class SnapshotUtilCommands { try { snapshot = config.snapshotRepo.getSnapshot(args.getString(0)); } catch (InvalidSnapshotException e) { - player.printError("That snapshot does not exist or is not available."); + BBC.SNAPSHOT_NOT_AVAILABLE.send(player); return; } } else { @@ -90,7 +90,7 @@ public class SnapshotUtilCommands { snapshot = config.snapshotRepo.getDefaultSnapshot(player.getWorld().getName()); if (snapshot == null) { - player.printError("No snapshots were found. See console for details."); + BBC.SNAPSHOT_NOT_AVAILABLE.send(player); // Okay, let's toss some debugging information! File dir = config.snapshotRepo.getDirectory(); @@ -107,7 +107,7 @@ public class SnapshotUtilCommands { return; } } catch (MissingWorldException ex) { - player.printError("No snapshots were found for this world."); + BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player); return; } } @@ -119,10 +119,10 @@ public class SnapshotUtilCommands { chunkStore = snapshot.getChunkStore(); BBC.SNAPSHOT_LOADED.send(player, snapshot.getName()); } catch (DataException e) { - player.printError("Failed to load snapshot: " + e.getMessage()); + player.printError(BBC.getPrefix() + "Failed to load snapshot: " + e.getMessage()); return; } catch (IOException e) { - player.printError("Failed to load snapshot: " + e.getMessage()); + player.printError(BBC.getPrefix() + "Failed to load snapshot: " + e.getMessage()); return; } @@ -136,10 +136,10 @@ public class SnapshotUtilCommands { if (restore.hadTotalFailure()) { String error = restore.getLastErrorMessage(); if (error != null) { - player.printError("Errors prevented any blocks from being restored."); - player.printError("Last error: " + error); + BBC.SNAPSHOT_ERROR_RESTORE.send(player); + player.printError(BBC.getPrefix() + "Last error: " + error); } else { - player.printError("No chunks could be loaded. (Bad archive?)"); + BBC.SNAPSHOT_ERROR_RESTORE_CHUNKS.send(player); } } else { player.print(BBC.getPrefix() + String.format("Restored; %d " diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java index 0da33de8a..4d2258064 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.command; +import com.boydti.fawe.config.BBC; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; @@ -55,7 +56,7 @@ public class ToolUtilCommands { String newState = args.getString(0, null); if (session.hasSuperPickAxe()) { if ("on".equals(newState)) { - player.printError("Super pick axe already enabled."); + player.printError(BBC.getPrefix() + "Super pick axe already enabled."); return; } @@ -63,7 +64,7 @@ public class ToolUtilCommands { player.print("Super pick axe disabled."); } else { if ("off".equals(newState)) { - player.printError("Super pick axe already disabled."); + player.printError(BBC.getPrefix() + "Super pick axe already disabled."); return; } session.enableSuperPickAxe(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java index b78f81f15..8f43fce0e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.command.tool; +import com.boydti.fawe.config.BBC; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.entity.Player; @@ -87,7 +88,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool { } if (target == null) { - player.printError("No block in sight!"); + BBC.NO_BLOCK.send(player); return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java index 78bcec914..39c27845d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.command.tool; import com.boydti.fawe.object.collection.BlockVectorSet; +import com.boydti.fawe.config.BBC; import com.boydti.fawe.object.collection.LocalBlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; @@ -75,7 +76,7 @@ public class FloatingTreeRemover implements BlockTool { final BlockState state = world.getBlock(clicked.toVector().toBlockPoint()); if (!isTreeBlock(state.getBlockType())) { - player.printError("That's not a tree."); + BBC.TOOL_DELTREE_ERROR.send(player); return true; } @@ -83,7 +84,7 @@ public class FloatingTreeRemover implements BlockTool { try { final Set blockSet = bfs(world, clicked.toVector().toBlockPoint()); if (blockSet == null) { - player.printError("That's not a floating tree."); + BBC.TOOL_DELTREE_FLOATING_ERROR.send(player); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java index 56c44a985..8dbdb233b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.command.tool; +import com.boydti.fawe.config.BBC; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; @@ -60,10 +61,10 @@ public class TreePlanter implements BlockTool { } if (!successful) { - player.printError("A tree can't go there."); + BBC.TOOL_TREE_ERROR_BLOCK.send(player); } } catch (MaxChangedBlocksException e) { - player.printError("Max. blocks changed reached."); + BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES.send(player); } finally { session.remember(editSession); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 6cd413f16..98f8ee7bd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -511,7 +511,7 @@ public class PlatformManager { if (faweException != null) { BBC.WORLDEDIT_CANCEL_REASON.send(player, faweException.getMessage()); } else { - player.printError("Please report this error: [See console]"); + player.printError(BBC.getPrefix() + "Please report this error: [See console]"); player.printRaw(e.getClass().getName() + ": " + e.getMessage()); MainUtil.handleError(e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java index d3b23efda..cfabef4c5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java @@ -210,7 +210,7 @@ public class ClipboardFormats { } f = player.openFileOpenDialog(extensions); if (f == null || !f.exists()) { - if (message) player.printError("Schematic " + input + " does not exist! (" + f + ")"); + if (message) player.printError(BBC.getPrefix() + "Schematic " + input + " does not exist! (" + f + ")"); return null; } } else { @@ -231,7 +231,7 @@ public class ClipboardFormats { } } if (f == null || !f.exists() || !MainUtil.isInSubDirectory(working, f)) { - if (message) player.printError("Schematic " + input + " does not exist! (" + ((f == null) ? false : f.exists()) + "|" + f + "|" + (f == null ? false : !MainUtil.isInSubDirectory(working, f)) + ")"); + if (message) player.printError(BBC.getPrefix() + "Schematic " + input + " does not exist! (" + ((f == null) ? false : f.exists()) + "|" + f + "|" + (f == null ? false : !MainUtil.isInSubDirectory(working, f)) + ")"); return null; } if (format == null && f.isFile()) {