mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
i18n upstream merge
This commit is contained in:
parent
c5a9436174
commit
80d7b0582f
3
.gitignore
vendored
3
.gitignore
vendored
@ -24,3 +24,6 @@ todo.txt
|
|||||||
mvn/*
|
mvn/*
|
||||||
docs/
|
docs/
|
||||||
*.sh
|
*.sh
|
||||||
|
# i18n
|
||||||
|
worldedit-core/src/main/resources/lang/*
|
||||||
|
!worldedit-core/src/main/resources/lang/strings.json
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||||
import com.boydti.fawe.config.Caption;
|
import com.boydti.fawe.config.Caption;
|
||||||
|
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.RunnableVal;
|
import com.boydti.fawe.object.RunnableVal;
|
||||||
@ -280,7 +281,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locale getLocale() {
|
public Locale getLocale() {
|
||||||
return Locale.forLanguageTag(player.getLocale().replace('_', '-'));
|
return TextUtils.getLocaleByMinecraftTag(player.getLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -24,6 +24,7 @@ import com.sk89q.worldedit.extension.input.InputParseException;
|
|||||||
import com.sk89q.worldedit.extent.NullExtent;
|
import com.sk89q.worldedit.extent.NullExtent;
|
||||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||||
|
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||||
import com.sk89q.worldedit.util.logging.LogFormat;
|
import com.sk89q.worldedit.util.logging.LogFormat;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
@ -210,5 +211,12 @@ public abstract class LocalConfiguration {
|
|||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
public void setDefaultLocaleName(String localeName) {
|
||||||
|
this.defaultLocaleName = localeName;
|
||||||
|
if (localeName.equals("default")) {
|
||||||
|
this.defaultLocale = Locale.getDefault();
|
||||||
|
} else {
|
||||||
|
this.defaultLocale = TextUtils.getLocaleByMinecraftTag(localeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ public class SelectionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.wand.toggle")
|
@CommandPermissions("worldedit.wand.toggle")
|
||||||
public void toggleWand(Player player) {
|
public void toggleWand(Player player) {
|
||||||
player.print(TextComponent.of("The selection wand is now a normal tool. You can disable it with ")
|
player.printInfo(TextComponent.of("The selection wand is now a normal tool. You can disable it with ")
|
||||||
.append(TextComponent.of("/none", TextColor.AQUA).clickEvent(
|
.append(TextComponent.of("/none", TextColor.AQUA).clickEvent(
|
||||||
ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/none")))
|
ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/none")))
|
||||||
.append(TextComponent.of(" and rebind it to any item with "))
|
.append(TextComponent.of(" and rebind it to any item with "))
|
||||||
@ -383,7 +383,7 @@ public class SelectionCommands {
|
|||||||
|
|
||||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||||
|
|
||||||
actor.print(TranslatableComponent.of("worldedit.shift.shifted"));
|
actor.printInfo(TranslatableComponent.of("worldedit.shift.shifted"));
|
||||||
} catch (RegionOperationException e) {
|
} catch (RegionOperationException e) {
|
||||||
actor.printError(TextComponent.of(e.getMessage()));
|
actor.printError(TextComponent.of(e.getMessage()));
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ public class SelectionCommands {
|
|||||||
region.expand(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
region.expand(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
||||||
session.getRegionSelector(world).learnChanges();
|
session.getRegionSelector(world).learnChanges();
|
||||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||||
actor.print(TranslatableComponent.of("worldedit.outset.outset"));
|
actor.printInfo(TranslatableComponent.of("worldedit.outset.outset"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -426,7 +426,7 @@ public class SelectionCommands {
|
|||||||
region.contract(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
region.contract(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
||||||
session.getRegionSelector(world).learnChanges();
|
session.getRegionSelector(world).learnChanges();
|
||||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||||
actor.print(TranslatableComponent.of("worldedit.inset.inset"));
|
actor.printInfo(TranslatableComponent.of("worldedit.inset.inset"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockVector3[] getChangesForEachDir(int amount, boolean onlyHorizontal, boolean onlyVertical) {
|
private BlockVector3[] getChangesForEachDir(int amount, boolean onlyHorizontal, boolean onlyVertical) {
|
||||||
|
@ -186,7 +186,7 @@ public class WorldEditCommands {
|
|||||||
actor.printInfo(TranslatableComponent.of("worldedit.timezone.set", TextComponent.of(tz.getDisplayName(
|
actor.printInfo(TranslatableComponent.of("worldedit.timezone.set", TextComponent.of(tz.getDisplayName(
|
||||||
TextStyle.FULL, actor.getLocale()
|
TextStyle.FULL, actor.getLocale()
|
||||||
))));
|
))));
|
||||||
actor.print(TranslatableComponent.of("worldedit.timezone.current",
|
actor.printInfo(TranslatableComponent.of("worldedit.timezone.current",
|
||||||
TextComponent.of(dateFormat.withLocale(actor.getLocale()).format(ZonedDateTime.now(tz)))));
|
TextComponent.of(dateFormat.withLocale(actor.getLocale()).format(ZonedDateTime.now(tz)))));
|
||||||
} catch (ZoneRulesException e) {
|
} catch (ZoneRulesException e) {
|
||||||
actor.printError(TranslatableComponent.of("worldedit.timezone.invalid"));
|
actor.printError(TranslatableComponent.of("worldedit.timezone.invalid"));
|
||||||
|
@ -166,13 +166,13 @@ public final class AsyncCommandBuilder<T> {
|
|||||||
message = converted.getRichMessage();
|
message = converted.getRichMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sender.print(failure.append(TextComponent.of(": ")).append(message));
|
sender.printError(failure.append(TextComponent.of(": ")).append(message));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw orig;
|
throw orig;
|
||||||
}
|
}
|
||||||
} catch (Throwable unknown) {
|
} catch (Throwable unknown) {
|
||||||
sender.print(failure.append(TextComponent.of(": Unknown error. Please see console.")));
|
sender.printError(failure.append(TextComponent.of(": Unknown error. Please see console.")));
|
||||||
logger.error("Uncaught exception occurred in task: " + description, orig);
|
logger.error("Uncaught exception occurred in task: " + description, orig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.factory;
|
package com.sk89q.worldedit.function.factory;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import com.google.common.collect.ImmutableList;
|
||||||
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -42,8 +39,8 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
|
|
||||||
import java.util.Collection;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import java.util.List;
|
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
|
||||||
|
|
||||||
public class Deform implements Contextual<Operation> {
|
public class Deform implements Contextual<Operation> {
|
||||||
|
|
||||||
@ -160,6 +157,12 @@ public class Deform implements Contextual<Operation> {
|
|||||||
session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout());
|
session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Mode {
|
||||||
|
RAW_COORD,
|
||||||
|
OFFSET,
|
||||||
|
UNIT_CUBE
|
||||||
|
}
|
||||||
|
|
||||||
private static final class DeformOperation implements Operation {
|
private static final class DeformOperation implements Operation {
|
||||||
private final Extent destination;
|
private final Extent destination;
|
||||||
private final Region region;
|
private final Region region;
|
||||||
@ -195,16 +198,10 @@ public class Deform implements Contextual<Operation> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Component> getStatusMessages() {
|
public Iterable<Component> getStatusMessages() {
|
||||||
return Lists.newArrayList(TranslatableComponent.of("worldedit.operation.deform.expression",
|
return ImmutableList.of(TranslatableComponent.of("worldedit.operation.deform.expression",
|
||||||
TextComponent.of(expression).color(TextColor.GRAY)));
|
TextComponent.of(expression).color(TextColor.GRAY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Mode {
|
|
||||||
RAW_COORD,
|
|
||||||
OFFSET,
|
|
||||||
UNIT_CUBE
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,54 +19,49 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.operation;
|
package com.sk89q.worldedit.function.operation;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.boydti.fawe.object.extent.BlockTranslateExtent;
|
import com.boydti.fawe.object.extent.BlockTranslateExtent;
|
||||||
import com.boydti.fawe.object.extent.PositionTransformExtent;
|
import com.boydti.fawe.object.extent.PositionTransformExtent;
|
||||||
import com.boydti.fawe.object.function.block.BiomeCopy;
|
import com.boydti.fawe.object.function.block.BiomeCopy;
|
||||||
import com.boydti.fawe.object.function.block.CombinedBlockCopy;
|
import com.boydti.fawe.object.function.block.CombinedBlockCopy;
|
||||||
import com.boydti.fawe.object.function.block.SimpleBlockCopy;
|
import com.boydti.fawe.object.function.block.SimpleBlockCopy;
|
||||||
import com.boydti.fawe.util.MaskTraverser;
|
import com.boydti.fawe.util.MaskTraverser;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.entity.metadata.EntityProperties;
|
import com.sk89q.worldedit.entity.metadata.EntityProperties;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.function.CombinedRegionFunction;
|
import com.sk89q.worldedit.function.CombinedRegionFunction;
|
||||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
|
||||||
import com.sk89q.worldedit.function.FlatRegionMaskingFilter;
|
|
||||||
import com.sk89q.worldedit.function.RegionFunction;
|
import com.sk89q.worldedit.function.RegionFunction;
|
||||||
import com.sk89q.worldedit.function.RegionMaskTestFunction;
|
import com.sk89q.worldedit.function.RegionMaskTestFunction;
|
||||||
import com.sk89q.worldedit.function.biome.ExtentBiomeCopy;
|
|
||||||
import com.sk89q.worldedit.function.RegionMaskingFilter;
|
import com.sk89q.worldedit.function.RegionMaskingFilter;
|
||||||
import com.sk89q.worldedit.function.entity.ExtentEntityCopy;
|
import com.sk89q.worldedit.function.entity.ExtentEntityCopy;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.mask.Masks;
|
import com.sk89q.worldedit.function.mask.Masks;
|
||||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
|
||||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||||
|
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
|
||||||
import com.sk89q.worldedit.function.visitor.IntersectRegionFunction;
|
import com.sk89q.worldedit.function.visitor.IntersectRegionFunction;
|
||||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
|
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.math.transform.Identity;
|
import com.sk89q.worldedit.math.transform.Identity;
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.regions.FlatRegion;
|
import com.sk89q.worldedit.regions.FlatRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
|
||||||
import java.util.Collections;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import java.util.List;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
|
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a copy of a portion of one extent to another extent or another point.
|
* Makes a copy of a portion of one extent to another extent or another point.
|
||||||
*
|
*
|
||||||
@ -428,15 +423,14 @@ public class ForwardExtentCopy implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Component> getStatusMessages() {
|
public Iterable<Component> getStatusMessages() {
|
||||||
List<Component> messages = new ArrayList<>();
|
return ImmutableList.of(
|
||||||
messages.add(TranslatableComponent.of("worldedit.operation.affected.block",
|
TranslatableComponent.of("worldedit.operation.affected.block",
|
||||||
TextComponent.of(affectedBlocks)).color(TextColor.GRAY));
|
TextComponent.of(affectedBlocks)).color(TextColor.LIGHT_PURPLE),
|
||||||
messages.add(TranslatableComponent.of("worldedit.operation.affected.biome",
|
TranslatableComponent.of("worldedit.operation.affected.biome",
|
||||||
TextComponent.of(affectedBiomeCols)).color(TextColor.GRAY));
|
TextComponent.of(affectedBiomeCols)).color(TextColor.LIGHT_PURPLE),
|
||||||
messages.add(TranslatableComponent.of("worldedit.operation.affected.entity",
|
TranslatableComponent.of("worldedit.operation.affected.entity",
|
||||||
TextComponent.of(affectedEntities)).color(TextColor.GRAY));
|
TextComponent.of(affectedEntities)).color(TextColor.LIGHT_PURPLE)
|
||||||
|
);
|
||||||
return messages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,15 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.operation;
|
package com.sk89q.worldedit.function.operation;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
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.TextComponent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,6 +38,11 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
public interface Operation {
|
public interface Operation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is an internal field, and should not be touched.
|
||||||
|
*/
|
||||||
|
Set<String> warnedDeprecatedClasses = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Complete the next step. If this method returns true, then the method may
|
* Complete the next step. If this method returns true, then the method may
|
||||||
* be called again in the future, or possibly never. If this method
|
* be called again in the future, or possibly never. If this method
|
||||||
@ -76,6 +84,13 @@ public interface Operation {
|
|||||||
// TODO Remove legacy code WorldEdit 8.0.0
|
// TODO Remove legacy code WorldEdit 8.0.0
|
||||||
List<String> oldMessages = new ArrayList<>();
|
List<String> oldMessages = new ArrayList<>();
|
||||||
addStatusMessages(oldMessages);
|
addStatusMessages(oldMessages);
|
||||||
|
if (oldMessages.size() > 0) {
|
||||||
|
String className = getClass().getName();
|
||||||
|
if (!warnedDeprecatedClasses.contains(className)) {
|
||||||
|
WorldEdit.logger.warn("An operation is using the old status message API. This will be removed in further versions. Class: " + className);
|
||||||
|
warnedDeprecatedClasses.add(className);
|
||||||
|
}
|
||||||
|
}
|
||||||
return oldMessages.stream().map(TextComponent::of).collect(Collectors.toList());
|
return oldMessages.stream().map(TextComponent::of).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.visitor;
|
|||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.boydti.fawe.object.collection.BlockVectorSet;
|
import com.boydti.fawe.object.collection.BlockVectorSet;
|
||||||
@ -279,7 +279,7 @@ public abstract class BreadthFirstSearch implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Component> getStatusMessages() {
|
public Iterable<Component> getStatusMessages() {
|
||||||
return Lists.newArrayList(TranslatableComponent.of(
|
return ImmutableList.of(TranslatableComponent.of(
|
||||||
"worldedit.operation.affected.block",
|
"worldedit.operation.affected.block",
|
||||||
TextComponent.of(getAffected())
|
TextComponent.of(getAffected())
|
||||||
).color(TextColor.GRAY));
|
).color(TextColor.GRAY));
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.visitor;
|
package com.sk89q.worldedit.function.visitor;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -84,7 +85,7 @@ public class EntityVisitor implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Component> getStatusMessages() {
|
public Iterable<Component> getStatusMessages() {
|
||||||
return Lists.newArrayList(TranslatableComponent.of(
|
return ImmutableList.of(TranslatableComponent.of(
|
||||||
"worldedit.operation.affected.entity",
|
"worldedit.operation.affected.entity",
|
||||||
TextComponent.of(getAffected())
|
TextComponent.of(getAffected())
|
||||||
).color(TextColor.GRAY));
|
).color(TextColor.GRAY));
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.visitor;
|
package com.sk89q.worldedit.function.visitor;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@ -83,7 +84,7 @@ public class FlatRegionVisitor implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Component> getStatusMessages() {
|
public Iterable<Component> getStatusMessages() {
|
||||||
return Lists.newArrayList(TranslatableComponent.of(
|
return ImmutableList.of(TranslatableComponent.of(
|
||||||
"worldedit.operation.affected.column",
|
"worldedit.operation.affected.column",
|
||||||
TextComponent.of(getAffected())
|
TextComponent.of(getAffected())
|
||||||
).color(TextColor.GRAY));
|
).color(TextColor.GRAY));
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.visitor;
|
package com.sk89q.worldedit.function.visitor;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
@ -95,7 +96,7 @@ public class RegionVisitor implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Component> getStatusMessages() {
|
public Iterable<Component> getStatusMessages() {
|
||||||
return Lists.newArrayList(TranslatableComponent.of(
|
return ImmutableList.of(TranslatableComponent.of(
|
||||||
"worldedit.operation.affected.block",
|
"worldedit.operation.affected.block",
|
||||||
TextComponent.of(getAffected())
|
TextComponent.of(getAffected())
|
||||||
).color(TextColor.GRAY));
|
).color(TextColor.GRAY));
|
||||||
|
@ -20,22 +20,21 @@
|
|||||||
package com.sk89q.worldedit.regions;
|
package com.sk89q.worldedit.regions;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Region selectors create {@link Region}s from a series of "selected points."
|
* Region selectors create {@link Region}s from a series of "selected points."
|
||||||
* They are used, for example, to allow users to create a {@link CuboidRegion}
|
* They are used, for example, to allow users to create a {@link CuboidRegion}
|
||||||
@ -163,7 +162,7 @@ public interface RegionSelector {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
default List<String> getInformationLines() {
|
default List<String> getInformationLines() {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get lines of information about the selection.
|
* Get lines of information about the selection.
|
||||||
@ -172,12 +171,13 @@ public interface RegionSelector {
|
|||||||
*/
|
*/
|
||||||
default List<Component> getSelectionInfoLines() {
|
default List<Component> getSelectionInfoLines() {
|
||||||
return getInformationLines().stream()
|
return getInformationLines().stream()
|
||||||
.map(TextComponent::of)
|
.map(line -> TextComponent.of(line, TextColor.LIGHT_PURPLE))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the vertices
|
* Get the vertices
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws IncompleteRegionException
|
* @throws IncompleteRegionException
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +39,6 @@ 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;
|
||||||
|
|
||||||
@ -123,12 +122,7 @@ 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);
|
setDefaultLocaleName(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,7 +30,6 @@ 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}
|
||||||
@ -128,12 +127,7 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
|
|
||||||
extendedYLimit = config.getBoolean("compat.extended-y-limit", false);
|
extendedYLimit = config.getBoolean("compat.extended-y-limit", false);
|
||||||
|
|
||||||
defaultLocaleName = config.getString("default-locale", defaultLocaleName);
|
setDefaultLocaleName(config.getString("default-locale", defaultLocaleName));
|
||||||
if (defaultLocaleName.equals("default")) {
|
|
||||||
defaultLocale = Locale.getDefault();
|
|
||||||
} else {
|
|
||||||
defaultLocale = Locale.forLanguageTag(defaultLocaleName.replace('_', '-'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unload() {
|
public void unload() {
|
||||||
|
@ -35,7 +35,7 @@ public class WorldEditText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Component format(Component component, Locale locale) {
|
public static Component format(Component component, Locale locale) {
|
||||||
return CONFIG_HOLDER.replace(WorldEdit.getInstance().getTranslationManager().convertText(component, locale));
|
return WorldEdit.getInstance().getTranslationManager().convertText(CONFIG_HOLDER.replace(component), locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String reduceToText(Component component, Locale locale) {
|
public static String reduceToText(Component component, Locale locale) {
|
||||||
|
@ -23,6 +23,7 @@ import com.sk89q.worldedit.util.formatting.text.Component;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class TextUtils {
|
public class TextUtils {
|
||||||
|
|
||||||
@ -46,4 +47,13 @@ public class TextUtils {
|
|||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Gets a Java Locale object by the Minecraft locale tag.
|
||||||
|
*
|
||||||
|
* @param locale The Minecraft locale tag
|
||||||
|
* @return A Java locale
|
||||||
|
*/
|
||||||
|
public static Locale getLocaleByMinecraftTag(String locale) {
|
||||||
|
return Locale.forLanguageTag(locale.replace('_', '-'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,18 +28,18 @@ public class ResourceLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static URL getResourceForgeHack(String location) throws IOException {
|
private static URL getResourceForgeHack(String location) throws IOException {
|
||||||
|
try {
|
||||||
return new URL("modjar://worldedit/" + location);
|
return new URL("modjar://worldedit/" + location);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IOException("Could not find " + 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 {
|
|
||||||
return getResourceForgeHack(clazz.getName().substring(0, clazz.getName().lastIndexOf('.')).replace(".", "/")
|
return getResourceForgeHack(clazz.getName().substring(0, clazz.getName().lastIndexOf('.')).replace(".", "/")
|
||||||
+ "/" + name);
|
+ "/" + name);
|
||||||
} catch (Exception e) {
|
|
||||||
throw new IOException("Could not find " + name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@ -47,11 +47,7 @@ public class ResourceLoader {
|
|||||||
public static URL getResourceRoot(String name) throws IOException {
|
public static URL getResourceRoot(String name) throws IOException {
|
||||||
URL url = ResourceLoader.class.getResource("/" + name);
|
URL url = ResourceLoader.class.getResource("/" + name);
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
try {
|
|
||||||
return getResourceForgeHack(name);
|
return getResourceForgeHack(name);
|
||||||
} catch (Exception e) {
|
|
||||||
throw new IOException("Could not find " + name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util.translation;
|
package com.sk89q.worldedit.util.translation;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.io.Resources;
|
|
||||||
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;
|
||||||
@ -29,21 +28,14 @@ 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.File;
|
import java.io.*;
|
||||||
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.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import static java.util.stream.Collectors.toMap;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles translations for the plugin.
|
* Handles translations for the plugin.
|
||||||
@ -62,7 +54,7 @@ public class TranslationManager {
|
|||||||
private static final Gson gson = new GsonBuilder().create();
|
private static final Gson gson = new GsonBuilder().create();
|
||||||
private static final Type STRING_MAP_TYPE = new TypeToken<Map<String, String>>() {}.getType();
|
private static final Type STRING_MAP_TYPE = new TypeToken<Map<String, String>>() {}.getType();
|
||||||
|
|
||||||
private final Map<Locale, Map<String, String>> translationMap = new HashMap<>();
|
private final Map<Locale, Map<String, String>> translationMap = new ConcurrentHashMap<>();
|
||||||
private final FriendlyComponentRenderer<Locale> friendlyComponentRenderer = FriendlyComponentRenderer.from(
|
private final FriendlyComponentRenderer<Locale> friendlyComponentRenderer = FriendlyComponentRenderer.from(
|
||||||
(locale, key) -> new MessageFormat(getTranslationMap(locale).getOrDefault(key, key), locale));
|
(locale, key) -> new MessageFormat(getTranslationMap(locale).getOrDefault(key, key), locale));
|
||||||
private Locale defaultLocale = Locale.ENGLISH;
|
private Locale defaultLocale = Locale.ENGLISH;
|
||||||
@ -80,8 +72,10 @@ public class TranslationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> filterTranslations(Map<String, String> translations) {
|
private Map<String, String> filterTranslations(Map<String, String> translations) {
|
||||||
translations.entrySet().removeIf(entry -> entry.getValue().isEmpty());
|
return translations.entrySet().stream()
|
||||||
return translations;
|
.filter(e -> !e.getValue().isEmpty())
|
||||||
|
.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) {
|
||||||
@ -95,7 +89,7 @@ public class TranslationManager {
|
|||||||
baseTranslations = parseTranslationFile(ResourceLoader.getResourceRoot("lang/" + filename).openStream());
|
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 ConcurrentHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
File localFile = worldEdit.getWorkingDirectoryFile("lang/" + filename);
|
File localFile = worldEdit.getWorkingDirectoryFile("lang/" + filename);
|
||||||
@ -117,7 +111,7 @@ public class TranslationManager {
|
|||||||
}
|
}
|
||||||
checkedLocales.add(locale);
|
checkedLocales.add(locale);
|
||||||
// Make a copy of the default language file
|
// Make a copy of the default language file
|
||||||
Map<String, String> baseTranslations = new HashMap<>();
|
Map<String, String> baseTranslations = new ConcurrentHashMap<>();
|
||||||
if (!locale.equals(defaultLocale)) {
|
if (!locale.equals(defaultLocale)) {
|
||||||
baseTranslations.putAll(getTranslationMap(defaultLocale));
|
baseTranslations.putAll(getTranslationMap(defaultLocale));
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
*/
|
|
@ -13,7 +13,6 @@
|
|||||||
"fawe.worldedit.history.find.element": "&8 - &2{0}: {1} &7ago &3{2}m &6{3} &c/{4}",
|
"fawe.worldedit.history.find.element": "&8 - &2{0}: {1} &7ago &3{2}m &6{3} &c/{4}",
|
||||||
"fawe.worldedit.history.find.hover": "{0} blocks changed, click for more info",
|
"fawe.worldedit.history.find.hover": "{0} blocks changed, click for more info",
|
||||||
|
|
||||||
|
|
||||||
"fawe.info.lighting.propagate.selection": "Lighting has been propogated in {0} chunks. (Note: To remove light use //removelight)",
|
"fawe.info.lighting.propagate.selection": "Lighting has been propogated in {0} chunks. (Note: To remove light use //removelight)",
|
||||||
"fawe.info.updated.lighting.selection": "Lighting has been updated in {0} chunks. (It may take a second for the packets to send)",
|
"fawe.info.updated.lighting.selection": "Lighting has been updated in {0} chunks. (It may take a second for the packets to send)",
|
||||||
"fawe.info.set.region": "Selection set to your current allowed region",
|
"fawe.info.set.region": "Selection set to your current allowed region",
|
||||||
|
@ -34,6 +34,7 @@ import com.sk89q.worldedit.session.SessionKey;
|
|||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||||
|
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer;
|
import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer;
|
||||||
@ -209,7 +210,7 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locale getLocale() {
|
public Locale getLocale() {
|
||||||
return Locale.forLanguageTag(player.language.replace('_', '-'));
|
return TextUtils.getLocaleByMinecraftTag(player.language);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,6 @@ 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,11 +130,6 @@ 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);
|
setDefaultLocaleName(node.getNode("default-locale").getString(defaultLocaleName));
|
||||||
if (defaultLocaleName.equals("default")) {
|
|
||||||
defaultLocale = Locale.getDefault();
|
|
||||||
} else {
|
|
||||||
defaultLocale = Locale.forLanguageTag(defaultLocaleName.replace('_', '-'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user