geforkt von Mirrors/FastAsyncWorldEdit
Fix translate args
Dieser Commit ist enthalten in:
Ursprung
50c19f5a1c
Commit
9efdd886c5
@ -50,7 +50,6 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
|||||||
}
|
}
|
||||||
Material mat = BukkitAdapter.adapt(blockType);
|
Material mat = BukkitAdapter.adapt(blockType);
|
||||||
if (mat == null) {
|
if (mat == null) {
|
||||||
if (blockType == BlockTypes.__RESERVED__) return new PassthroughBlockMaterial(super.getMaterial(BlockTypes.AIR));
|
|
||||||
return new PassthroughBlockMaterial(null);
|
return new PassthroughBlockMaterial(null);
|
||||||
}
|
}
|
||||||
if (materialMap == null) {
|
if (materialMap == null) {
|
||||||
|
@ -170,9 +170,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(Component component) {
|
public void print(Component component) {
|
||||||
Component prefix = TranslatableComponent.of("fawe.prefix");
|
component = Caption.color(TranslatableComponent.of("prefix", component), getLocale());
|
||||||
component = TextComponent.builder().append(prefix).append(component).build();
|
|
||||||
component = Caption.color(component, getLocale());
|
|
||||||
TextAdapter.sendComponent(player, component);
|
TextAdapter.sendComponent(player, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial;
|
|||||||
import net.minecraft.server.v1_13_R2.BiomeBase;
|
import net.minecraft.server.v1_13_R2.BiomeBase;
|
||||||
import net.minecraft.server.v1_13_R2.Block;
|
import net.minecraft.server.v1_13_R2.Block;
|
||||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_13_R2.Blocks;
|
||||||
import net.minecraft.server.v1_13_R2.Chunk;
|
import net.minecraft.server.v1_13_R2.Chunk;
|
||||||
import net.minecraft.server.v1_13_R2.ChunkProviderServer;
|
import net.minecraft.server.v1_13_R2.ChunkProviderServer;
|
||||||
import net.minecraft.server.v1_13_R2.ChunkSection;
|
import net.minecraft.server.v1_13_R2.ChunkSection;
|
||||||
@ -148,13 +149,13 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I
|
|||||||
@Override
|
@Override
|
||||||
public BlockMaterial getMaterial(BlockType blockType) {
|
public BlockMaterial getMaterial(BlockType blockType) {
|
||||||
Block block = getBlock(blockType);
|
Block block = getBlock(blockType);
|
||||||
return block != null ? new BlockMaterial_1_13(block) : null;
|
return block != null ? new BlockMaterial_1_13(block) : new BlockMaterial_1_13(Blocks.AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockMaterial getMaterial(BlockState state) {
|
public BlockMaterial getMaterial(BlockState state) {
|
||||||
IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState();
|
IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState();
|
||||||
return bs != null ? new BlockMaterial_1_13(bs.getBlock(), bs) : null;
|
return bs != null ? new BlockMaterial_1_13(bs.getBlock(), bs) : new BlockMaterial_1_13(Blocks.AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlock(BlockType blockType) {
|
public Block getBlock(BlockType blockType) {
|
||||||
@ -314,8 +315,13 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockData adapt(BlockStateHolder state) {
|
public BlockData adapt(BlockStateHolder state) {
|
||||||
|
try {
|
||||||
BlockMaterial_1_13 material = (BlockMaterial_1_13) state.getMaterial();
|
BlockMaterial_1_13 material = (BlockMaterial_1_13) state.getMaterial();
|
||||||
return material.getCraftBlockData();
|
return material.getCraftBlockData();
|
||||||
|
} catch (ClassCastException ignore) {
|
||||||
|
System.out.println(state.getAsString() + " cast");
|
||||||
|
throw ignore;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,6 +66,7 @@ import com.sk89q.worldedit.world.registry.BlockMaterial;
|
|||||||
import net.minecraft.server.v1_14_R1.BiomeBase;
|
import net.minecraft.server.v1_14_R1.BiomeBase;
|
||||||
import net.minecraft.server.v1_14_R1.Block;
|
import net.minecraft.server.v1_14_R1.Block;
|
||||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_14_R1.Blocks;
|
||||||
import net.minecraft.server.v1_14_R1.Chunk;
|
import net.minecraft.server.v1_14_R1.Chunk;
|
||||||
import net.minecraft.server.v1_14_R1.ChunkCoordIntPair;
|
import net.minecraft.server.v1_14_R1.ChunkCoordIntPair;
|
||||||
import net.minecraft.server.v1_14_R1.ChunkProviderServer;
|
import net.minecraft.server.v1_14_R1.ChunkProviderServer;
|
||||||
@ -149,7 +150,8 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockMaterial getMaterial(BlockType blockType) {
|
public BlockMaterial getMaterial(BlockType blockType) {
|
||||||
return new BlockMaterial_1_14(getBlock(blockType));
|
Block block = getBlock(blockType);
|
||||||
|
return new BlockMaterial_1_14(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,6 +27,7 @@ import com.boydti.fawe.FaweCache;
|
|||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
import com.boydti.fawe.beta.implementation.queue.SingleThreadQueueExtent;
|
import com.boydti.fawe.beta.implementation.queue.SingleThreadQueueExtent;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_14.BlockMaterial_1_14;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_15.BlockMaterial_1_15;
|
import com.boydti.fawe.bukkit.adapter.mc1_15.BlockMaterial_1_15;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_15.BukkitAdapter_1_15;
|
import com.boydti.fawe.bukkit.adapter.mc1_15.BukkitAdapter_1_15;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_15.BukkitGetBlocks_1_15;
|
import com.boydti.fawe.bukkit.adapter.mc1_15.BukkitGetBlocks_1_15;
|
||||||
@ -68,9 +69,11 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.server.v1_15_R1.BiomeBase;
|
import net.minecraft.server.v1_15_R1.BiomeBase;
|
||||||
import net.minecraft.server.v1_15_R1.Block;
|
import net.minecraft.server.v1_15_R1.Block;
|
||||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_15_R1.Blocks;
|
||||||
import net.minecraft.server.v1_15_R1.Chunk;
|
import net.minecraft.server.v1_15_R1.Chunk;
|
||||||
import net.minecraft.server.v1_15_R1.ChunkCoordIntPair;
|
import net.minecraft.server.v1_15_R1.ChunkCoordIntPair;
|
||||||
import net.minecraft.server.v1_15_R1.ChunkProviderServer;
|
import net.minecraft.server.v1_15_R1.ChunkProviderServer;
|
||||||
@ -139,7 +142,8 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockMaterial getMaterial(BlockType blockType) {
|
public BlockMaterial getMaterial(BlockType blockType) {
|
||||||
return new BlockMaterial_1_15(getBlock(blockType));
|
Block block = getBlock(blockType);
|
||||||
|
return new BlockMaterial_1_15(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,47 +37,68 @@ public class Caption {
|
|||||||
return color(WorldEditText.format(component, locale));
|
return color(WorldEditText.format(component, locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component color(Component parent) {
|
private static Component color(TextComponent text) {
|
||||||
if (parent instanceof TextComponent) {
|
|
||||||
TextComponent text = (TextComponent) parent;
|
|
||||||
String content = text.content();
|
String content = text.content();
|
||||||
if (content.indexOf('&') != -1) {
|
if (content.indexOf('&') != -1) {
|
||||||
Component legacy = LegacyComponentSerializer.legacy().deserialize(content, '&');
|
TextComponent legacy = LegacyComponentSerializer.legacy().deserialize(content, '&');
|
||||||
legacy = legacy.style(parent.style());
|
legacy = (TextComponent) legacy.style(text.style());
|
||||||
if (!parent.children().isEmpty()) {
|
if (!text.children().isEmpty()) {
|
||||||
parent = TextComponent.builder().append(legacy).append(parent.children()).build();
|
text = TextComponent.builder().append(legacy).append(text.children()).build();
|
||||||
} else {
|
} else {
|
||||||
parent = legacy;
|
text = legacy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
TextColor lastColor = parent.color();
|
|
||||||
List<Component> children = parent.children();
|
private static List<Component> color(Component input, List<Component> components) {
|
||||||
if (!children.isEmpty()) {
|
TextColor lastColor = input.color();
|
||||||
for (int i = 0; i < children.size(); i++) {
|
if (!components.isEmpty()) {
|
||||||
Component original = children.get(i);
|
for (int i = 0; i < components.size(); i++) {
|
||||||
|
Component original = components.get(i);
|
||||||
Component child = original;
|
Component child = original;
|
||||||
if (child.color() == null && lastColor != null) {
|
if (child.color() == null && lastColor != null) {
|
||||||
child = child.color(lastColor);
|
child = child.color(lastColor);
|
||||||
}
|
}
|
||||||
child = color(child);
|
child = color(child);
|
||||||
if (original != child) {
|
if (original != child) {
|
||||||
if (!(children instanceof ArrayList)) {
|
if (!(components instanceof ArrayList)) {
|
||||||
children = new ArrayList<>(children);
|
components = new ArrayList<>(components);
|
||||||
}
|
}
|
||||||
children.set(i, child);
|
components.set(i, child);
|
||||||
}
|
}
|
||||||
if (child.color() != null) {
|
if (child.color() != null) {
|
||||||
lastColor = child.color();
|
lastColor = child.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (children instanceof ArrayList) {
|
}
|
||||||
|
return components;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component color(Component parent) {
|
||||||
|
if (parent instanceof TextComponent) {
|
||||||
|
parent = color((TextComponent) parent);
|
||||||
|
}
|
||||||
|
TextColor lastColor = parent.color();
|
||||||
|
List<Component> children = parent.children();
|
||||||
|
if (children != (children = color(parent, children))) {
|
||||||
parent = parent.children(children);
|
parent = parent.children(children);
|
||||||
}
|
}
|
||||||
|
if (parent instanceof TranslatableComponent) {
|
||||||
|
TranslatableComponent tc = (TranslatableComponent) parent;
|
||||||
|
List<Component> args = tc.args();
|
||||||
|
if (args != (args = color(parent, args))) {
|
||||||
|
parent = tc.args(args);
|
||||||
}
|
}
|
||||||
if (parent.color() == null && lastColor != null) {
|
}
|
||||||
|
if (parent.color() == null) {
|
||||||
|
if (!children.isEmpty()) {
|
||||||
|
lastColor = children.get(children.size() - 1).color();
|
||||||
|
}
|
||||||
|
if (lastColor != null) {
|
||||||
parent = parent.color(lastColor);
|
parent = parent.color(lastColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -835,7 +835,7 @@ public class MainUtil {
|
|||||||
long age = now - file.lastModified();
|
long age = now - file.lastModified();
|
||||||
if (age > timeDiff) {
|
if (age > timeDiff) {
|
||||||
pool.submit(file::delete);
|
pool.submit(file::delete);
|
||||||
Component msg = WorldEditText.format(TranslatableComponent.of("worldedit.schematic.delete.deleted"), Locale.ROOT);
|
Component msg = TranslatableComponent.of("worldedit.schematic.delete.deleted");
|
||||||
if (printDebug) Fawe.debug(msg);
|
if (printDebug) Fawe.debug(msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -80,7 +80,7 @@ public class BiomeCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "biomelist",
|
name = "biomelist",
|
||||||
aliases = { "biomels" },
|
aliases = { "biomels", "/biomelist", "/listbiomes" },
|
||||||
desc = "Gets all biomes available."
|
desc = "Gets all biomes available."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.biome.list")
|
@CommandPermissions("worldedit.biome.list")
|
||||||
|
@ -227,7 +227,7 @@ public class HistorySubCommands {
|
|||||||
|
|
||||||
int size = edit.size();
|
int size = edit.size();
|
||||||
|
|
||||||
String pageCommand = arguments.get().replaceAll("-p [0-9]+", "").trim();
|
String pageCommand = "/" + arguments.get().replaceAll("-p [0-9]+", "").trim();
|
||||||
List<Countable<BlockState>> list = null;
|
List<Countable<BlockState>> list = null;
|
||||||
Reference<List<Countable<BlockState>>> cached = player.getMeta(pageCommand);
|
Reference<List<Countable<BlockState>>> cached = player.getMeta(pageCommand);
|
||||||
if (cached != null) {
|
if (cached != null) {
|
||||||
@ -290,7 +290,7 @@ public class HistorySubCommands {
|
|||||||
checkCommandArgument(timeDiff > 0, "Time must be >= 0");
|
checkCommandArgument(timeDiff > 0, "Time must be >= 0");
|
||||||
|
|
||||||
Location origin = player.getLocation();
|
Location origin = player.getLocation();
|
||||||
String pageCommand = arguments.get().replaceAll("-p [0-9]+", "").trim();
|
String pageCommand = "/" + arguments.get().replaceAll("-p [0-9]+", "").trim();
|
||||||
|
|
||||||
List<Supplier<RollbackOptimizedHistory>> list = null;
|
List<Supplier<RollbackOptimizedHistory>> list = null;
|
||||||
Reference<List<Supplier<RollbackOptimizedHistory>>> cached = player.getMeta(pageCommand);
|
Reference<List<Supplier<RollbackOptimizedHistory>>> cached = player.getMeta(pageCommand);
|
||||||
|
@ -552,11 +552,11 @@ public class SchematicCommands {
|
|||||||
if (oldFirst && newFirst) {
|
if (oldFirst && newFirst) {
|
||||||
throw new StopExecutionException(TextComponent.of("Cannot sort by oldest and newest."));
|
throw new StopExecutionException(TextComponent.of("Cannot sort by oldest and newest."));
|
||||||
}
|
}
|
||||||
String pageCommand = arguments.get();
|
String pageCommand = "/" + arguments.get();
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
||||||
|
|
||||||
String schemCmd = "/schematic";
|
String schemCmd = "//schematic";
|
||||||
String loadSingle = schemCmd + " load";
|
String loadSingle = schemCmd + " load";
|
||||||
String loadMulti = schemCmd + " loadall";
|
String loadMulti = schemCmd + " loadall";
|
||||||
String unload = schemCmd + " unload";
|
String unload = schemCmd + " unload";
|
||||||
|
@ -19,23 +19,77 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util.formatting;
|
package com.sk89q.worldedit.util.formatting;
|
||||||
|
|
||||||
|
import com.boydti.fawe.util.StringMan;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
import org.enginehub.piston.config.Config;
|
||||||
import org.enginehub.piston.config.ConfigHolder;
|
import org.enginehub.piston.config.ConfigHolder;
|
||||||
import org.enginehub.piston.config.TextConfig;
|
import org.enginehub.piston.config.TextConfig;
|
||||||
import org.enginehub.piston.util.TextHelper;
|
import org.enginehub.piston.util.TextHelper;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class WorldEditText {
|
public class WorldEditText {
|
||||||
public static final ConfigHolder CONFIG_HOLDER = ConfigHolder.create();
|
public static final ConfigHolder CONFIG_HOLDER = ConfigHolder.create();
|
||||||
|
private static final Method METHOD_APPLY;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
CONFIG_HOLDER.getConfig(TextConfig.commandPrefix()).setValue("/");
|
CONFIG_HOLDER.getConfig(TextConfig.commandPrefix()).setValue("/");
|
||||||
|
try {
|
||||||
|
METHOD_APPLY = Config.class.getDeclaredMethod("apply", List.class);
|
||||||
|
METHOD_APPLY.setAccessible(true);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component format(Component component, Locale locale) {
|
public static Component format(Component component, Locale locale) {
|
||||||
return WorldEdit.getInstance().getTranslationManager().convertText(CONFIG_HOLDER.replace(component), locale);
|
return CONFIG_HOLDER.replace(WorldEdit.getInstance().getTranslationManager().convertText(recursiveReplace(component), locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Component recursiveReplace(Component input) {
|
||||||
|
if (input instanceof TranslatableComponent) {
|
||||||
|
TranslatableComponent tc = (TranslatableComponent)input;
|
||||||
|
List<Component> args = tc.args();
|
||||||
|
if (args != (args = replaceChildren(args))) {
|
||||||
|
input = tc = tc.args(args);
|
||||||
|
}
|
||||||
|
if (CONFIG_HOLDER.getConfigs().containsKey(tc.key())) {
|
||||||
|
Config config = CONFIG_HOLDER.getConfigs().get(tc.key());
|
||||||
|
try {
|
||||||
|
return (Component) METHOD_APPLY.invoke(config, replaceChildren(tc.args()));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Component> original = input.children();
|
||||||
|
List<Component> replacement = replaceChildren(original);
|
||||||
|
return original == replacement ? input : input.children(replacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Component> replaceChildren(List<Component> input) {
|
||||||
|
if (input.isEmpty()) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
ImmutableList.Builder<Component> copy = ImmutableList.builder();
|
||||||
|
boolean modified = false;
|
||||||
|
for (Component component : input) {
|
||||||
|
Component replacement = recursiveReplace(component);
|
||||||
|
if (replacement != component) {
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
copy.add(replacement);
|
||||||
|
}
|
||||||
|
return modified ? copy.build() : input;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String reduceToText(Component component, Locale locale) {
|
public static String reduceToText(Component component, Locale locale) {
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util.translation;
|
package com.sk89q.worldedit.util.translation;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
@ -28,15 +27,20 @@ import com.sk89q.worldedit.util.formatting.text.Component;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.renderer.FriendlyComponentRenderer;
|
import com.sk89q.worldedit.util.formatting.text.renderer.FriendlyComponentRenderer;
|
||||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.*;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles translations for the plugin.
|
* Handles translations for the plugin.
|
||||||
*
|
*
|
||||||
@ -72,10 +76,8 @@ public class TranslationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> filterTranslations(Map<String, String> translations) {
|
private Map<String, String> filterTranslations(Map<String, String> translations) {
|
||||||
return translations.entrySet().stream()
|
translations.entrySet().removeIf(entry -> entry.getValue().isEmpty());
|
||||||
.filter(e -> !e.getValue().isEmpty())
|
return translations;
|
||||||
.map(e -> Maps.immutableEntry(e.getKey(), e.getValue().replace("'", "''")))
|
|
||||||
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> parseTranslationFile(InputStream inputStream) {
|
private Map<String, String> parseTranslationFile(InputStream inputStream) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"fawe.prefix": "&8(&4&lFAWE&8)&7 ",
|
"prefix": "&8(&4&lFAWE&8)&7 {0}",
|
||||||
"fawe.error": "&c{0}",
|
"fawe.error": "&c{0}",
|
||||||
"fawe.info": "&7{0}",
|
"fawe.info": "&7{0}",
|
||||||
"fawe.debug": "&3{0}",
|
"fawe.debug": "&3{0}",
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren