Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-19 09:20:08 +01:00
Fixed issues brought up in review
Dieser Commit ist enthalten in:
Ursprung
625be46b30
Commit
ded86d4872
@ -21,6 +21,7 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
||||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
@ -98,7 +99,7 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locale getLocale() {
|
public Locale getLocale() {
|
||||||
return Locale.US;
|
return WorldEdit.getInstance().getConfiguration().defaultLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import com.sk89q.bukkit.util.CommandInspector;
|
import com.sk89q.bukkit.util.CommandInspector;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -53,7 +54,7 @@ class BukkitCommandInspector implements CommandInspector {
|
|||||||
public String getShortText(Command command) {
|
public String getShortText(Command command) {
|
||||||
Optional<org.enginehub.piston.Command> mapping = dispatcher.getCommand(command.getName());
|
Optional<org.enginehub.piston.Command> mapping = dispatcher.getCommand(command.getName());
|
||||||
if (mapping.isPresent()) {
|
if (mapping.isPresent()) {
|
||||||
return reduceToText(mapping.get().getDescription(), Locale.US);
|
return reduceToText(mapping.get().getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
||||||
return "Help text not available";
|
return "Help text not available";
|
||||||
@ -64,7 +65,7 @@ class BukkitCommandInspector implements CommandInspector {
|
|||||||
public String getFullText(Command command) {
|
public String getFullText(Command command) {
|
||||||
Optional<org.enginehub.piston.Command> mapping = dispatcher.getCommand(command.getName());
|
Optional<org.enginehub.piston.Command> mapping = dispatcher.getCommand(command.getName());
|
||||||
if (mapping.isPresent()) {
|
if (mapping.isPresent()) {
|
||||||
return reduceToText(mapping.get().getFullHelp(), Locale.US);
|
return reduceToText(mapping.get().getFullHelp(), WorldEdit.getInstance().getConfiguration().defaultLocale);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
||||||
return "Help text not available";
|
return "Help text not available";
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
||||||
import com.sk89q.worldedit.session.SessionKey;
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||||
@ -114,7 +115,7 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locale getLocale() {
|
public Locale getLocale() {
|
||||||
return Locale.US;
|
return WorldEdit.getInstance().getConfiguration().defaultLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
import com.sk89q.bukkit.util.CommandInfo;
|
import com.sk89q.bukkit.util.CommandInfo;
|
||||||
import com.sk89q.bukkit.util.CommandRegistration;
|
import com.sk89q.bukkit.util.CommandRegistration;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
@ -170,8 +171,8 @@ public class BukkitServerInterface implements MultiUserPlatform {
|
|||||||
command.getAliases().stream()
|
command.getAliases().stream()
|
||||||
).toArray(String[]::new);
|
).toArray(String[]::new);
|
||||||
// TODO Handle localisation correctly
|
// TODO Handle localisation correctly
|
||||||
return new CommandInfo(reduceToText(command.getUsage(), Locale.US),
|
return new CommandInfo(reduceToText(command.getUsage(), WorldEdit.getInstance().getConfiguration().defaultLocale),
|
||||||
reduceToText(command.getDescription(), Locale.US), aliases,
|
reduceToText(command.getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale), aliases,
|
||||||
inspector, permissionsArray);
|
inspector, permissionsArray);
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.cli;
|
|||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
import com.sk89q.worldedit.session.SessionKey;
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
@ -141,7 +142,7 @@ public class CLICommandSender implements Actor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locale getLocale() {
|
public Locale getLocale() {
|
||||||
return Locale.getDefault();
|
return WorldEdit.getInstance().getConfiguration().defaultLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,7 +32,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@ -238,13 +238,13 @@ public class CLIWorldEdit {
|
|||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String line = scanner.nextLine();
|
String line = scanner.nextLine();
|
||||||
if (line.equals("stop")) {
|
if (line.equals("stop")) {
|
||||||
commandSender.printInfo(TextComponent.of("Stopping!"));
|
commandSender.printInfo(TranslatableComponent.of("worldedit.cli.stopping"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CommandEvent event = new CommandEvent(commandSender, line);
|
CommandEvent event = new CommandEvent(commandSender, line);
|
||||||
WorldEdit.getInstance().getEventBus().post(event);
|
WorldEdit.getInstance().getEventBus().post(event);
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
commandSender.printError(TextComponent.of("Unknown command!"));
|
commandSender.printError(TranslatableComponent.of("worldedit.cli.unknown-command"));
|
||||||
} else {
|
} else {
|
||||||
saveAllWorlds(false);
|
saveAllWorlds(false);
|
||||||
}
|
}
|
||||||
|
@ -97,18 +97,18 @@ if (project.hasProperty(crowdinApiKey)) {
|
|||||||
files = arrayOf(
|
files = arrayOf(
|
||||||
object {
|
object {
|
||||||
var name = "strings.json"
|
var name = "strings.json"
|
||||||
var source = "$projectDir/src/main/resources/lang/strings.json"
|
var source = "${file("src/main/resources/lang/strings.json")}"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<DownloadTranslationsTask>("crowdinDownload") {
|
tasks.named<DownloadTranslationsTask>("crowdinDownload") {
|
||||||
apiKey = "${project.property(crowdinApiKey)}"
|
apiKey = "${project.property(crowdinApiKey)}"
|
||||||
destination = "$projectDir/src/main/resources/lang"
|
destination = "${file("build/resources/main/lang")}"
|
||||||
projectId = "worldedit-core"
|
projectId = "worldedit-core"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("processResources").configure {
|
tasks.named("classes").configure {
|
||||||
dependsOn("crowdinDownload")
|
dependsOn("crowdinDownload")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -76,6 +77,8 @@ public abstract class LocalConfiguration {
|
|||||||
public boolean allowSymlinks = false;
|
public boolean allowSymlinks = false;
|
||||||
public boolean serverSideCUI = true;
|
public boolean serverSideCUI = true;
|
||||||
public boolean extendedYLimit = false;
|
public boolean extendedYLimit = false;
|
||||||
|
public String defaultLocaleName = "default";
|
||||||
|
public Locale defaultLocale = Locale.getDefault();
|
||||||
|
|
||||||
protected String[] getDefaultDisallowedBlocks() {
|
protected String[] getDefaultDisallowedBlocks() {
|
||||||
List<BlockType> blockTypes = Lists.newArrayList(
|
List<BlockType> blockTypes = Lists.newArrayList(
|
||||||
|
@ -118,7 +118,7 @@ public class BrushCommands {
|
|||||||
tool.setBrush(new SphereBrush(), "worldedit.brush.sphere");
|
tool.setBrush(new SphereBrush(), "worldedit.brush.sphere");
|
||||||
}
|
}
|
||||||
|
|
||||||
player.printInfo(TranslatableComponent.of("worldedit.brush.sphere.equip", TextComponent.of((int) radius)));
|
player.printInfo(TranslatableComponent.of("worldedit.brush.sphere.equip", TextComponent.of(String.format("%.0f", radius))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
@ -96,7 +96,7 @@ public class GeneralCommands {
|
|||||||
session.setBlockChangeLimit(limit);
|
session.setBlockChangeLimit(limit);
|
||||||
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.limit.set", TextComponent.of(limit)));
|
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.limit.set", TextComponent.of(limit)));
|
||||||
if (limit != config.defaultChangeLimit) {
|
if (limit != config.defaultChangeLimit) {
|
||||||
component.append(TranslatableComponent.of("worldedit.limit.return-to-default", TextColor.GRAY));
|
component.append(TextComponent.space()).append(TranslatableComponent.of("worldedit.limit.return-to-default", TextColor.GRAY));
|
||||||
}
|
}
|
||||||
actor.printInfo(component);
|
actor.printInfo(component);
|
||||||
}
|
}
|
||||||
@ -180,7 +180,8 @@ public class GeneralCommands {
|
|||||||
}
|
}
|
||||||
boolean useServerCui = session.shouldUseServerCUI();
|
boolean useServerCui = session.shouldUseServerCUI();
|
||||||
if (drawSelection != null && drawSelection == useServerCui) {
|
if (drawSelection != null && drawSelection == useServerCui) {
|
||||||
player.printError(TranslatableComponent.of(useServerCui ? "worldedit.drawsel.enabled.already" : "worldedit.drawsel.disabled.already"));
|
player.printError(TranslatableComponent.of("worldedit.drawsel." + (useServerCui ? "enabled" : "disabled") + ".already"));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (useServerCui) {
|
if (useServerCui) {
|
||||||
@ -284,7 +285,7 @@ public class GeneralCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (blocksOnly && itemsOnly) {
|
if (blocksOnly && itemsOnly) {
|
||||||
actor.printError(TranslatableComponent.of("worldedit.searchitem.b-and-i"));
|
actor.printError(TranslatableComponent.of("worldedit.searchitem.either-b-or-i"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import java.io.InputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -119,6 +120,12 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
|||||||
allowSymlinks = getBool("allow-symbolic-links", allowSymlinks);
|
allowSymlinks = getBool("allow-symbolic-links", allowSymlinks);
|
||||||
serverSideCUI = getBool("server-side-cui", serverSideCUI);
|
serverSideCUI = getBool("server-side-cui", serverSideCUI);
|
||||||
extendedYLimit = getBool("extended-y-limit", extendedYLimit);
|
extendedYLimit = getBool("extended-y-limit", extendedYLimit);
|
||||||
|
defaultLocaleName = getString("default-locale", defaultLocaleName);
|
||||||
|
if (defaultLocaleName.equals("default")) {
|
||||||
|
defaultLocale = Locale.getDefault();
|
||||||
|
} else {
|
||||||
|
defaultLocale = Locale.forLanguageTag(defaultLocaleName.replace('_', '-'));
|
||||||
|
}
|
||||||
|
|
||||||
LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15));
|
LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15));
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import org.slf4j.Logger;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A less simple implementation of {@link LocalConfiguration}
|
* A less simple implementation of {@link LocalConfiguration}
|
||||||
@ -125,6 +126,13 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
shellSaveType = type.isEmpty() ? null : type;
|
shellSaveType = type.isEmpty() ? null : type;
|
||||||
|
|
||||||
extendedYLimit = config.getBoolean("compat.extended-y-limit", false);
|
extendedYLimit = config.getBoolean("compat.extended-y-limit", false);
|
||||||
|
|
||||||
|
defaultLocaleName = config.getString("default-locale", defaultLocaleName);
|
||||||
|
if (defaultLocaleName.equals("default")) {
|
||||||
|
defaultLocale = Locale.getDefault();
|
||||||
|
} else {
|
||||||
|
defaultLocale = Locale.forLanguageTag(defaultLocaleName.replace('_', '-'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unload() {
|
public void unload() {
|
||||||
|
@ -27,17 +27,20 @@ public class ResourceLoader {
|
|||||||
private ResourceLoader() {
|
private ResourceLoader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static URL getResourceForgeHack(String location) throws IOException {
|
||||||
|
return new URL("modjar://worldedit/" + location);
|
||||||
|
}
|
||||||
|
|
||||||
public static URL getResource(Class clazz, String name) throws IOException {
|
public static URL getResource(Class clazz, String name) throws IOException {
|
||||||
URL url = clazz.getResource(name);
|
URL url = clazz.getResource(name);
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
try {
|
try {
|
||||||
return new URL("modjar://worldedit/" + clazz.getName().substring(0, clazz.getName().lastIndexOf('.')).replace(".", "/") + "/"
|
return getResourceForgeHack(clazz.getName().substring(0, clazz.getName().lastIndexOf('.')).replace(".", "/")
|
||||||
+ name);
|
+ "/" + name);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Not forge.
|
|
||||||
}
|
|
||||||
throw new IOException("Could not find " + name);
|
throw new IOException("Could not find " + name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,12 +48,11 @@ public class ResourceLoader {
|
|||||||
URL url = ResourceLoader.class.getResource("/" + name);
|
URL url = ResourceLoader.class.getResource("/" + name);
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
try {
|
try {
|
||||||
return new URL("modjar://worldedit/" + name);
|
return getResourceForgeHack(name);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Not forge.
|
|
||||||
}
|
|
||||||
throw new IOException("Could not find " + name);
|
throw new IOException("Could not find " + name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,10 @@ import com.sk89q.worldedit.util.formatting.text.renderer.FriendlyComponentRender
|
|||||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@ -81,19 +84,15 @@ public class TranslationManager {
|
|||||||
return translations;
|
return translations;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> parseTranslationFile(File file) throws IOException {
|
private Map<String, String> parseTranslationFile(InputStream inputStream) {
|
||||||
return filterTranslations(gson.fromJson(Files.toString(file, StandardCharsets.UTF_8), STRING_MAP_TYPE));
|
return filterTranslations(gson.fromJson(new InputStreamReader(inputStream), STRING_MAP_TYPE));
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, String> parseTranslationFile(URL file) throws IOException {
|
|
||||||
return filterTranslations(gson.fromJson(Resources.toString(file, StandardCharsets.UTF_8), STRING_MAP_TYPE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<Map<String, String>> loadTranslationFile(String filename) {
|
private Optional<Map<String, String>> loadTranslationFile(String filename) {
|
||||||
Map<String, String> baseTranslations;
|
Map<String, String> baseTranslations;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
baseTranslations = parseTranslationFile(ResourceLoader.getResourceRoot("lang/" + filename));
|
baseTranslations = parseTranslationFile(ResourceLoader.getResourceRoot("lang/" + filename).openStream());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Seem to be missing base. If the user has provided a file use that.
|
// Seem to be missing base. If the user has provided a file use that.
|
||||||
baseTranslations = new HashMap<>();
|
baseTranslations = new HashMap<>();
|
||||||
@ -102,7 +101,7 @@ public class TranslationManager {
|
|||||||
File localFile = worldEdit.getWorkingDirectoryFile("lang/" + filename);
|
File localFile = worldEdit.getWorkingDirectoryFile("lang/" + filename);
|
||||||
if (localFile.exists()) {
|
if (localFile.exists()) {
|
||||||
try {
|
try {
|
||||||
baseTranslations.putAll(parseTranslationFile(localFile));
|
baseTranslations.putAll(parseTranslationFile(new FileInputStream(localFile)));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Failed to parse custom language file. Worth printing.
|
// Failed to parse custom language file. Worth printing.
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
"worldedit.toggleplace.pos1": "Now placing at pos #1.",
|
"worldedit.toggleplace.pos1": "Now placing at pos #1.",
|
||||||
"worldedit.toggleplace.player": "Now placing at the block you stand in.",
|
"worldedit.toggleplace.player": "Now placing at the block you stand in.",
|
||||||
"worldedit.searchitem.too-short": "Enter a longer search string (len > 2).",
|
"worldedit.searchitem.too-short": "Enter a longer search string (len > 2).",
|
||||||
"worldedit.searchitem.b-and-i": "You cannot use both the 'b' and 'i' flags simultaneously.",
|
"worldedit.searchitem.either-b-or-i": "You cannot use both the 'b' and 'i' flags simultaneously.",
|
||||||
"worldedit.searchitem.searching": "(Please wait... searching items.)",
|
"worldedit.searchitem.searching": "(Please wait... searching items.)",
|
||||||
"worldedit.watchdog.no-hook": "This platform has no watchdog hook.",
|
"worldedit.watchdog.no-hook": "This platform has no watchdog hook.",
|
||||||
"worldedit.watchdog.active.already": "Watchdog hook already active.",
|
"worldedit.watchdog.active.already": "Watchdog hook already active.",
|
||||||
@ -323,5 +323,8 @@
|
|||||||
|
|
||||||
"worldedit.help.command-not-found": "The command '{0}' could not be found.",
|
"worldedit.help.command-not-found": "The command '{0}' could not be found.",
|
||||||
"worldedit.help.no-subcommands": "'{0}' has no sub-commands. (Maybe '{1}' is for a parameter?)",
|
"worldedit.help.no-subcommands": "'{0}' has no sub-commands. (Maybe '{1}' is for a parameter?)",
|
||||||
"worldedit.help.subcommand-not-found": "The sub-command '{0}' under '{1}' could not be found."
|
"worldedit.help.subcommand-not-found": "The sub-command '{0}' under '{1}' could not be found.",
|
||||||
|
|
||||||
|
"worldedit.cli.stopping": "Stopping!",
|
||||||
|
"worldedit.cli.unknown-command": "Unknown command!"
|
||||||
}
|
}
|
@ -26,6 +26,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
@Mixin(ServerPlayerEntity.class)
|
@Mixin(ServerPlayerEntity.class)
|
||||||
public interface AccessorServerPlayerEntity {
|
public interface AccessorServerPlayerEntity {
|
||||||
|
|
||||||
@Accessor("clientLanguage")
|
@Accessor
|
||||||
String getClientLanguage();
|
String getClientLanguage();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
|||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.sponge;
|
|||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
import com.sk89q.worldedit.session.SessionKey;
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
@ -144,7 +145,7 @@ public class SpongeCommandSender implements Actor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locale getLocale() {
|
public Locale getLocale() {
|
||||||
return Locale.US;
|
return WorldEdit.getInstance().getConfiguration().defaultLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,6 +34,7 @@ import org.slf4j.Logger;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class ConfigurateConfiguration extends LocalConfiguration {
|
public class ConfigurateConfiguration extends LocalConfiguration {
|
||||||
|
|
||||||
@ -131,5 +132,11 @@ public class ConfigurateConfiguration extends LocalConfiguration {
|
|||||||
shellSaveType = type.equals("") ? null : type;
|
shellSaveType = type.equals("") ? null : type;
|
||||||
|
|
||||||
extendedYLimit = node.getNode("compat", "extended-y-limit").getBoolean(false);
|
extendedYLimit = node.getNode("compat", "extended-y-limit").getBoolean(false);
|
||||||
|
defaultLocaleName = node.getNode("default-locale").getString(defaultLocaleName);
|
||||||
|
if (defaultLocaleName.equals("default")) {
|
||||||
|
defaultLocale = Locale.getDefault();
|
||||||
|
} else {
|
||||||
|
defaultLocale = Locale.forLanguageTag(defaultLocaleName.replace('_', '-'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren