- Make disallowed-blocks translatable
- Add more trnslatable messages
- Update WorldEdit messages missing a prefix
This commit is contained in:
NotMyFault 2019-04-11 19:49:09 +02:00
parent 7a88039711
commit dcfa436c64
10 changed files with 30 additions and 20 deletions

View File

@ -236,6 +236,10 @@ public enum BBC {
TIMEZONE_SET("Timezone set for this session to: %s0", "WorldEdit.Timezone"),
TIMEZONE_DISPLAY("The current time in that timezone is: %s0", "WorldEdit.Timezone"),
BLOCK_CYCLER_CANNOT_CYCLE("That block's data cannot be cycled!", "WorldEdit.Cycler"),
BLOCK_CYCLER_LIMIT("Max blocks change limit reached.", "WorldEdit.Cycler"),
BLOCK_CYCLER_NO_PERM("&cYou are not permitted to cycle the data value of that block.", "WorldEdit.Cycler"),
COMMAND_INVALID_SYNTAX("The command was not used properly (no more help available).", "WorldEdit.Command"),
COMMAND_CLARIFYING_BRACKET("&7Added clarifying bracket for &c%s0", "WorldEdit.Help"),
@ -254,6 +258,7 @@ public enum BBC {
COMMAND_SYNTAX("&cUsage: &7%s0", "Error"),
NO_PERM("&cYou are lacking the permission node: %s0", "Error"),
BLOCK_NOT_ALLOWED("You are not allowed to use", "Error"),
SETTING_DISABLE("&cLacking setting: %s0", "Error"),
BRUSH_NOT_FOUND("&cAvailable brushes: %s0", "Error"),
BRUSH_INCOMPATIBLE("&cBrush not compatible with this version", "Error"),

View File

@ -152,7 +152,7 @@ public abstract class HelpBuilder implements Runnable {
displayFailure(BBC.HELP_SUGGEST.f(arg, StringMan.join(found, ", ")));
return;
} else {
String msg = String.format("The sub-command '%s' under '%s' could not be found.",
String msg = String.format(BBC.getPrefix() + "The sub-command '%s' under '%s' could not be found.",
command, Joiner.on(" ").join(visited));
displayFailure(msg);
return;

View File

@ -165,8 +165,8 @@ public class NavigationCommands {
@Command(
aliases = {"jumpto", "j"},
usage = "[world,x,y,z]",
desc = "Teleport to a location" +
"Flags:\n" +
desc = "Teleport to a location\n" +
"Flags:" +
" -f forces the specified position to be used",
flags = "f",
min = 0,

View File

@ -267,14 +267,14 @@ public class OptionsCommands {
actor.print(BBC.getPrefix() + type.getId() + " (" + type.getName() + ")");
} else {
if (query.length() <= 2) {
actor.printError("Enter a longer search string (len > 2).");
actor.printError(BBC.getPrefix() + "Enter a longer search string (len > 2).");
return;
}
if (!blocksOnly && !itemsOnly) {
actor.print(BBC.getPrefix() + "Searching for: " + query);
} else if (blocksOnly && itemsOnly) {
actor.printError("You cannot use both the 'b' and 'i' flags simultaneously.");
actor.printError(BBC.getPrefix() + "You cannot use both the 'b' and 'i' flags simultaneously.");
return;
} else if (blocksOnly) {
actor.print(BBC.getPrefix() + "Searching for blocks: " + query);
@ -308,7 +308,7 @@ public class OptionsCommands {
}
if (found == 0) {
actor.printError("No items found.");
actor.printError(BBC.getPrefix() + "No items found.");
}
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.BBC;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
@ -62,12 +63,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
if (!config.allowedDataCycleBlocks.isEmpty()
&& !player.hasPermission("worldedit.override.data-cycler")
&& !config.allowedDataCycleBlocks.contains(block.getBlockType().getId())) {
player.printError("You are not permitted to cycle the data value of that block.");
BBC.BLOCK_CYCLER_NO_PERM.send(player);
return true;
}
if (block.getStates().keySet().isEmpty()) {
player.printError("That block's data cannot be cycled!");
BBC.BLOCK_CYCLER_CANNOT_CYCLE.send(player);
} else {
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
@ -88,9 +89,9 @@ public class BlockDataCyler implements DoubleActionBlockTool {
EditSession editSession = session.createEditSession(player);
try {
editSession.setBlock(blockPoint, newBlock);
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
player.print(BBC.getPrefix() + "Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
BBC.BLOCK_CYCLER_LIMIT.send(player);
} finally {
session.remember(editSession);
}
@ -101,7 +102,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
index = (index + 1) % properties.size();
currentProperty = properties.get(index);
selectedProperties.put(player.getUniqueId(), currentProperty);
player.print("Now cycling " + currentProperty.getName());
player.print(BBC.getPrefix() + "Now cycling " + currentProperty.getName());
}
}

View File

@ -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;
@ -75,7 +76,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
if (type != null) {
this.pattern = targetBlock;
player.print("Replacer tool switched to: " + type.getName());
player.print(BBC.getPrefix() + "Replacer tool switched to: " + type.getName());
}
return true;

View File

@ -309,12 +309,12 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
if (context.isRestricted()) {
Actor actor = context.requireActor();
if (!actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().checkDisallowedBlocks(holder)) {
throw new DisallowedUsageException(BBC.getPrefix() + "You are not allowed to use '" + holder + "'");
throw new DisallowedUsageException(BBC.BLOCK_NOT_ALLOWED + " '" + holder + "'");
}
CompoundTag nbt = holder.getNbtData();
if (nbt != null) {
if (!actor.hasPermission("worldedit.anyblock")) {
throw new DisallowedUsageException(BBC.getPrefix() + "You are not allowed to nbt'");
throw new DisallowedUsageException("You are not allowed to nbt'");
}
}
}

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.util.command;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.util.StringMan;
import com.google.common.base.Joiner;
import com.sk89q.minecraft.util.commands.CommandException;
@ -141,7 +142,7 @@ public class SimpleDispatcher implements Dispatcher {
}
throw new InvalidUsageException("Please choose a sub-command.", this, true);
throw new InvalidUsageException(BBC.getPrefix() + "Please choose a sub-command.", this, true);
}
@Override

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.util.command.parametric;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.util.StringMan;
import com.google.common.primitives.Chars;
import com.sk89q.minecraft.util.commands.*;
@ -276,14 +277,14 @@ public class FunctionParametricCallable extends AParametricCallable {
}
return result;
} catch (MissingParameterException e) {
throw new InvalidUsageException("Too few parameters!", this, true);
throw new InvalidUsageException(BBC.getPrefix() + "Too few parameters!", this, true);
} catch (UnconsumedParameterException e) {
throw new InvalidUsageException("Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true);
throw new InvalidUsageException(BBC.getPrefix() + "Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true);
} catch (ParameterException e) {
assert parameter != null;
String name = parameter.getName();
throw new InvalidUsageException("For parameter '" + name + "': " + e.getMessage(), this, true);
throw new InvalidUsageException(BBC.getPrefix() + "For parameter '" + name + "': " + e.getMessage(), this, true);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof CommandException) {
throw (CommandException) e.getCause();

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.util.command.parametric;
import com.boydti.fawe.command.SuggestInputParseException;
import com.boydti.fawe.config.BBC;
import com.google.common.primitives.Chars;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
@ -270,9 +271,9 @@ public class ParametricCallable extends AParametricCallable {
}
return result;
} catch (MissingParameterException e) {
throw new InvalidUsageException("Too few parameters!", this, true);
throw new InvalidUsageException(BBC.getPrefix() + "Too few parameters!", this, true);
} catch (UnconsumedParameterException e) {
throw new InvalidUsageException("Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true);
throw new InvalidUsageException(BBC.getPrefix() + "Too many parameters! Unused parameters: " + e.getUnconsumed(), this, true);
} catch (ParameterException e) {
assert parameter != null;
String name = parameter.getName();