diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 0a5a8d23f..cb41e9c99 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,10 +5,12 @@ on: branches: - master - merge + - 1.15 pull_request: branches: - master - merge + - 1.15 jobs: test: diff --git a/.gitignore b/.gitignore index b33e539e0..abbab0e31 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ todo.txt mvn/* docs/ *.sh +# i18n +worldedit-core/src/main/resources/lang/* +!worldedit-core/src/main/resources/lang/strings.json diff --git a/build.gradle.kts b/build.gradle.kts index a208e540e..c8795df6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ logger.lifecycle(""" 1) Read COMPILING.md if you haven't yet 2) Try running 'build' in a separate Gradle run 3) Use gradlew and not gradle - 4) If you still need help, ask on Discord! https://discord.gg/enginehub + 4) If you still need help, ask on Discord! https://discord.gg/ngZCzbU Output files will be in [subproject]/build/libs ******************************************* diff --git a/splash.txt b/splash.txt deleted file mode 100644 index 6513022a7..000000000 --- a/splash.txt +++ /dev/null @@ -1,21 +0,0 @@ - -============= You are compiling: ============= - _______ ___ ____ __ ____ _______ -| ____| / \ \ \ / \ / / | ____| -| |__ / ^ \ \ \/ \/ / | |__ -| __| / /_\ \ \ / | __| -| | / _____ \ \ /\ / | |____ -|__| /__/ \__\ \__/ \__/ |_______| - -======== Authors https://git.io/fjIDU ======== - -If you encounter trouble: - - Run `build` in a separate Gradle run - - Use gradlew and not gradle - - Ask us! - - https://discord.gg/ngZCzbU (Discord) - -Files will be output to `/target` - -============================================== - diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index a9434fd67..06e04034c 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -59,12 +59,10 @@ dependencies { "implementation"("com.massivecraft:Factions:1.6.9.5-U0.2.1-SNAPSHOT") { isTransitive = false } "implementation"("com.github.TechFortress:GriefPrevention:16.12.0") { isTransitive = false } "implementation"("com.massivecraft:mcore:7.0.1") { isTransitive = false } - "implementation"("net.jzx7:regios:5.9.9") { isTransitive = false } "implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") { isTransitive = false } "implementation"("com.palmergames.bukkit:towny:0.84.0.9") { isTransitive = false } "implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") { isTransitive = false } "implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT") { isTransitive = false } - "implementation"("com.wasteofplastic:askyblock:3.0.8.2") { isTransitive = false } } tasks.named("processResources") { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index cc6c94690..cddda8fb0 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -290,15 +290,6 @@ public class FaweBukkit implements IFawe, Listener { } } - final Plugin aSkyBlock = Bukkit.getServer().getPluginManager().getPlugin("ASkyBlock"); - if (aSkyBlock != null && aSkyBlock.isEnabled()) { - try { - managers.add(new ASkyBlockHook(aSkyBlock)); - log.debug("Attempting to use plugin 'ASkyBlock' found. Using it now."); - } catch (Throwable e) { - e.printStackTrace(); - } - } if (Settings.IMP.EXPERIMENTAL.FREEBUILD) { try { managers.add(new FreeBuildRegion()); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/ASkyBlockHook.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/ASkyBlockHook.java deleted file mode 100644 index 84d328400..000000000 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/ASkyBlockHook.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.boydti.fawe.bukkit.regions; - -import com.boydti.fawe.regions.FaweMask; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; -import com.wasteofplastic.askyblock.ASkyBlockAPI; -import com.wasteofplastic.askyblock.Island; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.plugin.Plugin; - -public class ASkyBlockHook extends BukkitMaskManager implements Listener { - - public ASkyBlockHook(final Plugin aSkyBlock) { - super(aSkyBlock.getName()); - - } - - public boolean isAllowed(Player player, Island island, MaskType type) { - return island != null && (player.getUniqueId().equals(island.getOwner()) || (type == MaskType.MEMBER && island.getMembers().contains(player.getUniqueId()) && hasMemberPermission(player))); - } - - @Override - public FaweMask getMask(final com.sk89q.worldedit.entity.Player player, MaskType type) { - final Location location = BukkitAdapter.adapt(player).getLocation(); - - Island island = ASkyBlockAPI.getInstance().getIslandAt(location); - if (island != null && isAllowed(BukkitAdapter.adapt(player), island, type)) { - - Location center1 = island.getCenter(); - MutableBlockVector3 center = MutableBlockVector3.at(center1.getX(), center1.getY(), center1.getZ()); - BlockVector3 pos1 = BlockVector3.at(island.getMinProtectedX(), 0, island.getMinProtectedZ()); - MutableBlockVector3 pos2 = center.add(center.subtract(pos1)).mutY(255); - - return new FaweMask(pos1, pos2) { - @Override - public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { - return isAllowed(BukkitAdapter.adapt(player), island, type); - } - }; - } - - return null; - } -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java index 58d4f12bf..3c293f6f3 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java @@ -19,10 +19,7 @@ package com.sk89q.worldedit.bukkit; -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.Locatable; import com.sk89q.worldedit.extent.Extent; @@ -31,22 +28,24 @@ import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.formatting.WorldEditText; import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter; -import com.sk89q.worldedit.util.formatting.text.format.TextColor; -import java.util.UUID; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.command.BlockCommandSender; - -import java.util.Locale; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.nio.charset.StandardCharsets; +import java.util.Locale; +import java.util.UUID; + +import static com.google.common.base.Preconditions.checkNotNull; + public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements Locatable { + private static final String UUID_PREFIX = "CMD"; + private final BlockCommandSender sender; private final WorldEditPlugin plugin; private final Location location; @@ -59,7 +58,7 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements this.plugin = plugin; this.sender = sender; this.location = BukkitAdapter.adapt(sender.getBlock().getLocation()); - this.uuid = new UUID(location.toVector().toBlockPoint().hashCode(), location.getExtent().hashCode()); + this.uuid = UUID.nameUUIDFromBytes((UUID_PREFIX + sender.getName()).getBytes(StandardCharsets.UTF_8)); } @Override @@ -134,7 +133,6 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements @Override public SessionKey getSessionKey() { return new SessionKey() { - @Nullable @Override public String getName() { return sender.getName(); @@ -154,7 +152,7 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements @Override public boolean isPersistent() { - return false; + return true; } @Override diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 751d915c5..e25697834 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit; import com.boydti.fawe.Fawe; import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.config.Caption; +import com.sk89q.worldedit.util.formatting.component.TextUtils; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.RunnableVal; @@ -280,7 +281,7 @@ public class BukkitPlayer extends AbstractPlayerActor { @Override public Locale getLocale() { - return Locale.forLanguageTag(player.getLocale().replace('_', '-')); + return TextUtils.getLocaleByMinecraftTag(player.getLocale()); } @Nullable diff --git a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java index 38189d7da..a02b6a7e9 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java @@ -21,7 +21,7 @@ public class Settings extends Config { @Final // Indicates that this value isn't configurable public String ISSUES = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues"; @Final - public String WIKI = "https://github.com/boy0001/FastAsyncWorldedit/wiki/"; + public String WIKI = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki"; @Final public String DATE; // These values are set from FAWE before loading @Final @@ -364,7 +364,7 @@ public class Settings extends Config { @Comment({ "[SAFE] Experimental scripting support for Java 9", - " - https://github.com/boy0001/FastAsyncWorldedit/wiki/JavaScript-API" + " - https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki/JavaScript-API" }) public boolean MODERN_CRAFTSCRIPTS = false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index 7725376f6..49a7f39df 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.function.mask.BlockMask; 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.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -210,5 +211,12 @@ public abstract class LocalConfiguration { return item; } - + public void setDefaultLocaleName(String localeName) { + this.defaultLocaleName = localeName; + if (localeName.equals("default")) { + this.defaultLocale = Locale.getDefault(); + } else { + this.defaultLocale = TextUtils.getLocaleByMinecraftTag(localeName); + } + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java index d28f4d8bb..9a0d08b61 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java @@ -312,7 +312,7 @@ public class SelectionCommands { ) @CommandPermissions("worldedit.wand.toggle") 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( ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/none"))) .append(TextComponent.of(" and rebind it to any item with ")) @@ -383,7 +383,7 @@ public class SelectionCommands { session.getRegionSelector(world).explainRegionAdjust(actor, session); - actor.print(TranslatableComponent.of("worldedit.shift.shifted")); + actor.printInfo(TranslatableComponent.of("worldedit.shift.shifted")); } catch (RegionOperationException e) { actor.printError(TextComponent.of(e.getMessage())); } @@ -406,7 +406,7 @@ public class SelectionCommands { region.expand(getChangesForEachDir(amount, onlyHorizontal, onlyVertical)); session.getRegionSelector(world).learnChanges(); session.getRegionSelector(world).explainRegionAdjust(actor, session); - actor.print(TranslatableComponent.of("worldedit.outset.outset")); + actor.printInfo(TranslatableComponent.of("worldedit.outset.outset")); } @Command( @@ -426,7 +426,7 @@ public class SelectionCommands { region.contract(getChangesForEachDir(amount, onlyHorizontal, onlyVertical)); session.getRegionSelector(world).learnChanges(); 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) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index 45d415c28..138f5bee3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -186,7 +186,7 @@ public class WorldEditCommands { actor.printInfo(TranslatableComponent.of("worldedit.timezone.set", TextComponent.of(tz.getDisplayName( 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))))); } catch (ZoneRulesException e) { actor.printError(TranslatableComponent.of("worldedit.timezone.invalid")); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java index d475c387c..5b880f726 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Locatable; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.transform.BlockTransformExtent; import com.sk89q.worldedit.function.mask.Mask; @@ -104,8 +105,8 @@ public class FactoryConverter implements ArgumentConverter { ParserContext parserContext = new ParserContext(); parserContext.setActor(actor); - if (actor instanceof Entity) { - Extent extent = ((Entity) actor).getExtent(); + if (actor instanceof Locatable) { + Extent extent = ((Locatable) actor).getExtent(); if (extent instanceof World) { parserContext.setWorld((World) extent); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java index 7760d1bb9..4543ac224 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java @@ -166,13 +166,13 @@ public final class AsyncCommandBuilder { message = converted.getRichMessage(); } } - sender.print(failure.append(TextComponent.of(": ")).append(message)); + sender.printError(failure.append(TextComponent.of(": ")).append(message)); } } else { throw orig; } } 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); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java index 2aca7cd7d..9bb608bba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java @@ -19,10 +19,7 @@ package com.sk89q.worldedit.function.factory; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; - -import com.google.common.collect.Lists; +import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; 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.format.TextColor; -import java.util.Collection; -import java.util.List; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; public class Deform implements Contextual { @@ -160,6 +157,12 @@ public class Deform implements Contextual { session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout()); } + public enum Mode { + RAW_COORD, + OFFSET, + UNIT_CUBE + } + private static final class DeformOperation implements Operation { private final Extent destination; private final Region region; @@ -195,16 +198,10 @@ public class Deform implements Contextual { @Override public Iterable 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))); } } - public enum Mode { - RAW_COORD, - OFFSET, - UNIT_CUBE - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index 1c3f68a20..8b46bb04e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -19,54 +19,49 @@ 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.PositionTransformExtent; import com.boydti.fawe.object.function.block.BiomeCopy; import com.boydti.fawe.object.function.block.CombinedBlockCopy; import com.boydti.fawe.object.function.block.SimpleBlockCopy; import com.boydti.fawe.util.MaskTraverser; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; 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.RegionMaskTestFunction; -import com.sk89q.worldedit.function.biome.ExtentBiomeCopy; import com.sk89q.worldedit.function.RegionMaskingFilter; import com.sk89q.worldedit.function.entity.ExtentEntityCopy; import com.sk89q.worldedit.function.mask.Mask; 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.FlatRegionVisitor; import com.sk89q.worldedit.function.visitor.IntersectRegionFunction; import com.sk89q.worldedit.function.visitor.RegionVisitor; 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.Identity; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.FlatRegion; 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 java.util.List; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; 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 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. * @@ -428,15 +423,14 @@ public class ForwardExtentCopy implements Operation { @Override public Iterable getStatusMessages() { - List messages = new ArrayList<>(); - messages.add(TranslatableComponent.of("worldedit.operation.affected.block", - TextComponent.of(affectedBlocks)).color(TextColor.GRAY)); - messages.add(TranslatableComponent.of("worldedit.operation.affected.biome", - TextComponent.of(affectedBiomeCols)).color(TextColor.GRAY)); - messages.add(TranslatableComponent.of("worldedit.operation.affected.entity", - TextComponent.of(affectedEntities)).color(TextColor.GRAY)); - - return messages; + return ImmutableList.of( + TranslatableComponent.of("worldedit.operation.affected.block", + TextComponent.of(affectedBlocks)).color(TextColor.LIGHT_PURPLE), + TranslatableComponent.of("worldedit.operation.affected.biome", + TextComponent.of(affectedBiomeCols)).color(TextColor.LIGHT_PURPLE), + TranslatableComponent.of("worldedit.operation.affected.entity", + TextComponent.of(affectedEntities)).color(TextColor.LIGHT_PURPLE) + ); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java index 5ae25eb2b..c21f2a6f7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java @@ -19,12 +19,15 @@ package com.sk89q.worldedit.function.operation; +import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -35,6 +38,11 @@ import java.util.stream.Collectors; */ public interface Operation { + /** + * This is an internal field, and should not be touched. + */ + Set warnedDeprecatedClasses = new HashSet<>(); + /** * 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 @@ -76,6 +84,13 @@ public interface Operation { // TODO Remove legacy code WorldEdit 8.0.0 List oldMessages = new ArrayList<>(); 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()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index 10efa0c9b..e85b7a4f1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.visitor; 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.boydti.fawe.object.collection.BlockVectorSet; @@ -279,7 +279,7 @@ public abstract class BreadthFirstSearch implements Operation { @Override public Iterable getStatusMessages() { - return Lists.newArrayList(TranslatableComponent.of( + return ImmutableList.of(TranslatableComponent.of( "worldedit.operation.affected.block", TextComponent.of(getAffected()) ).color(TextColor.GRAY)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java index bdfb9dcc0..9d4405ca2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.function.visitor; +import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import static com.google.common.base.Preconditions.checkNotNull; @@ -84,7 +85,7 @@ public class EntityVisitor implements Operation { @Override public Iterable getStatusMessages() { - return Lists.newArrayList(TranslatableComponent.of( + return ImmutableList.of(TranslatableComponent.of( "worldedit.operation.affected.entity", TextComponent.of(getAffected()) ).color(TextColor.GRAY)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java index ba43aca0b..799f69bb1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.function.visitor; +import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.google.common.collect.Lists; @@ -83,7 +84,7 @@ public class FlatRegionVisitor implements Operation { @Override public Iterable getStatusMessages() { - return Lists.newArrayList(TranslatableComponent.of( + return ImmutableList.of(TranslatableComponent.of( "worldedit.operation.affected.column", TextComponent.of(getAffected()) ).color(TextColor.GRAY)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java index 89f4123b2..309da923a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.function.visitor; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; @@ -95,7 +96,7 @@ public class RegionVisitor implements Operation { @Override public Iterable getStatusMessages() { - return Lists.newArrayList(TranslatableComponent.of( + return ImmutableList.of(TranslatableComponent.of( "worldedit.operation.affected.block", TextComponent.of(getAffected()) ).color(TextColor.GRAY)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java index 72a7f170c..2e257ce69 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java @@ -20,22 +20,21 @@ package com.sk89q.worldedit.regions; import com.google.common.collect.Lists; - import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; 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.format.TextColor; +import com.sk89q.worldedit.world.World; +import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import javax.annotation.Nullable; - /** * 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} @@ -77,8 +76,8 @@ public interface RegionSelector { /** * Tell the player information about his/her primary selection. * - * @param actor the actor - * @param session the session + * @param actor the actor + * @param session the session * @param position position */ void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position); @@ -86,8 +85,8 @@ public interface RegionSelector { /** * Tell the player information about his/her secondary selection. * - * @param actor the actor - * @param session the session + * @param actor the actor + * @param session the session * @param position position */ void explainSecondarySelection(Actor actor, LocalSession session, BlockVector3 position); @@ -96,7 +95,7 @@ public interface RegionSelector { * The the player information about the region's changes. This may resend * all the defining region information if needed. * - * @param actor the actor + * @param actor the actor * @param session the session */ void explainRegionAdjust(Actor actor, LocalSession session); @@ -157,13 +156,13 @@ public interface RegionSelector { /** * Get lines of information about the selection. - * + * * @return a list of lines describing the region */ @Deprecated default List getInformationLines() { return Lists.newArrayList(); - }; + } /** * Get lines of information about the selection. @@ -172,12 +171,13 @@ public interface RegionSelector { */ default List getSelectionInfoLines() { return getInformationLines().stream() - .map(TextComponent::of) + .map(line -> TextComponent.of(line, TextColor.LIGHT_PURPLE)) .collect(Collectors.toList()); } /** * Get the vertices + * * @return * @throws IncompleteRegionException */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java index fce840b40..d09c30d3a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -39,7 +39,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.HashSet; -import java.util.Locale; import java.util.Properties; import java.util.Set; @@ -123,12 +122,7 @@ public class PropertiesConfiguration extends LocalConfiguration { allowSymlinks = getBool("allow-symbolic-links", allowSymlinks); serverSideCUI = getBool("server-side-cui", serverSideCUI); extendedYLimit = getBool("extended-y-limit", extendedYLimit); - defaultLocaleName = getString("default-locale", defaultLocaleName); - if (defaultLocaleName.equals("default")) { - defaultLocale = Locale.getDefault(); - } else { - defaultLocale = Locale.forLanguageTag(defaultLocaleName.replace('_', '-')); - } + setDefaultLocaleName(getString("default-locale", defaultLocaleName)); LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index 9a3dc841f..6cc54bdf3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -30,7 +30,6 @@ import org.slf4j.Logger; import java.io.IOException; import java.util.HashSet; -import java.util.Locale; /** * A less simple implementation of {@link LocalConfiguration} @@ -128,12 +127,7 @@ public class YAMLConfiguration extends LocalConfiguration { 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('_', '-')); - } + setDefaultLocaleName(config.getString("default-locale", defaultLocaleName)); } public void unload() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/TextUtils.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/TextUtils.java index f604d322a..8540ed3b1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/TextUtils.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/TextUtils.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; import java.util.List; +import java.util.Locale; public class TextUtils { @@ -46,4 +47,13 @@ public class TextUtils { } 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('_', '-')); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ResourceLoader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ResourceLoader.java index 0ce49b115..e3aaca134 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ResourceLoader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ResourceLoader.java @@ -28,18 +28,18 @@ public class ResourceLoader { } private static URL getResourceForgeHack(String location) throws IOException { - return new URL("modjar://worldedit/" + location); + try { + 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 { URL url = clazz.getResource(name); if (url == null) { - try { - return getResourceForgeHack(clazz.getName().substring(0, clazz.getName().lastIndexOf('.')).replace(".", "/") - + "/" + name); - } catch (Exception e) { - throw new IOException("Could not find " + name); - } + return getResourceForgeHack(clazz.getName().substring(0, clazz.getName().lastIndexOf('.')).replace(".", "/") + + "/" + name); } return url; } @@ -47,12 +47,8 @@ public class ResourceLoader { public static URL getResourceRoot(String name) throws IOException { URL url = ResourceLoader.class.getResource("/" + name); if (url == null) { - try { - return getResourceForgeHack(name); - } catch (Exception e) { - throw new IOException("Could not find " + name); - } + return getResourceForgeHack(name); } return url; } -} +} \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java index 46984ce82..656430038 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java @@ -19,8 +19,7 @@ package com.sk89q.worldedit.util.translation; -import com.google.common.io.Files; -import com.google.common.io.Resources; +import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.GsonBuilder; 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.io.ResourceLoader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; import java.lang.reflect.Type; -import java.net.URL; -import java.nio.charset.StandardCharsets; import java.text.MessageFormat; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Locale; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +import static java.util.stream.Collectors.toMap; + /** * Handles translations for the plugin. @@ -62,7 +54,7 @@ public class TranslationManager { private static final Gson gson = new GsonBuilder().create(); private static final Type STRING_MAP_TYPE = new TypeToken>() {}.getType(); - private final Map> translationMap = new HashMap<>(); + private final Map> translationMap = new ConcurrentHashMap<>(); private final FriendlyComponentRenderer friendlyComponentRenderer = FriendlyComponentRenderer.from( (locale, key) -> new MessageFormat(getTranslationMap(locale).getOrDefault(key, key), locale)); private Locale defaultLocale = Locale.ENGLISH; @@ -80,8 +72,10 @@ public class TranslationManager { } private Map filterTranslations(Map translations) { - translations.entrySet().removeIf(entry -> entry.getValue().isEmpty()); - return translations; + return translations.entrySet().stream() + .filter(e -> !e.getValue().isEmpty()) + .map(e -> Maps.immutableEntry(e.getKey(), e.getValue().replace("'", "''"))) + .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); } private Map parseTranslationFile(InputStream inputStream) { @@ -95,7 +89,7 @@ public class TranslationManager { baseTranslations = parseTranslationFile(ResourceLoader.getResourceRoot("lang/" + filename).openStream()); } catch (IOException e) { // 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); @@ -117,7 +111,7 @@ public class TranslationManager { } checkedLocales.add(locale); // Make a copy of the default language file - Map baseTranslations = new HashMap<>(); + Map baseTranslations = new ConcurrentHashMap<>(); if (!locale.equals(defaultLocale)) { baseTranslations.putAll(getTranslationMap(defaultLocale)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java index 05fa97cb2..f4af74483 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java @@ -21,11 +21,14 @@ package com.sk89q.worldedit.world.registry; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; import com.google.common.io.Resources; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.factory.BlockFactory; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Capability; @@ -34,11 +37,9 @@ import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.util.gson.VectorAdapter; import com.sk89q.worldedit.util.io.ResourceLoader; import com.sk89q.worldedit.world.DataFixer; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; @@ -49,13 +50,14 @@ import javax.annotation.Nullable; import java.io.IOException; import java.net.URL; import java.nio.charset.Charset; -import java.util.Map; import java.util.HashMap; +import java.util.Map; public final class LegacyMapper { private static final Logger log = LoggerFactory.getLogger(LegacyMapper.class); private static LegacyMapper INSTANCE = new LegacyMapper(); + static { try { INSTANCE.loadFromResource(); @@ -64,12 +66,15 @@ public final class LegacyMapper { } } - private Map blockEntries = new HashMap<>(); - private final Int2ObjectArrayMap blockStateToLegacyId4Data = new Int2ObjectArrayMap<>(); private final Int2ObjectArrayMap extraId4DataToStateId = new Int2ObjectArrayMap<>(); private final int[] blockArr = new int[4096]; private final BiMap itemMap = HashBiMap.create(); + private Map blockEntries = new HashMap<>(); + private Map stringToBlockMap = new HashMap<>(); + private Multimap blockToStringMap = HashMultimap.create(); + private Map stringToItemMap = new HashMap<>(); + private Multimap itemToStringMap = HashMultimap.create(); /** * Create a new instance. @@ -91,7 +96,8 @@ public final class LegacyMapper { throw new IOException("Could not find legacy.json"); } String source = Resources.toString(url, Charset.defaultCharset()); - LegacyDataFile dataFile = gson.fromJson(source, new TypeToken() {}.getType()); + LegacyDataFile dataFile = gson.fromJson(source, new TypeToken() { + }.getType()); DataFixer fixer = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataFixer(); ParserContext parserContext = new ParserContext(); @@ -101,10 +107,10 @@ public final class LegacyMapper { for (Map.Entry blockEntry : dataFile.blocks.entrySet()) { String id = blockEntry.getKey(); - Integer combinedId = getCombinedId(blockEntry.getKey()); + Integer combinedId = getCombinedId(blockEntry.getKey()); final String value = blockEntry.getValue(); blockEntries.put(id, value); - BlockState blockState = null; + BlockState blockState = null; try { blockState = BlockState.get(null, blockEntry.getValue()); BlockType type = blockState.getBlockType(); @@ -112,18 +118,31 @@ public final class LegacyMapper { blockState = blockState.with(PropertyKey.WATERLOGGED, false); } } catch (InputParseException e) { + BlockFactory blockFactory = WorldEdit.getInstance().getBlockFactory(); if (fixer != null) { - String newEntry = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, value, 1631); try { - blockState = WorldEdit.getInstance().getBlockFactory().parseFromInput(newEntry, parserContext).toImmutableState(); - } catch (InputParseException ignored) {} + String newEntry = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, value, 1631); + blockState = blockFactory.parseFromInput(newEntry, parserContext).toImmutableState(); + } catch (InputParseException f) { + } } + // if it's still null, the fixer was unavailable or failed + if (blockState == null) { + try { + blockState = blockFactory.parseFromInput(value, parserContext).toImmutableState(); + } catch (InputParseException f) { + } + } + // if it's still null, both fixer and default failed if (blockState == null) { log.warn("Unknown block: " + value); - continue; + } else { + // it's not null so one of them succeeded, now use it + blockToStringMap.put(blockState, id); + stringToBlockMap.put(id, blockState); } } - blockArr[combinedId] = blockState.getInternalId(); + blockArr[combinedId] = blockState.getInternalId(); blockStateToLegacyId4Data.put(blockState.getInternalId(), (Integer) combinedId); blockStateToLegacyId4Data.putIfAbsent(blockState.getInternalBlockTypeId(), combinedId); } diff --git a/worldedit-core/src/main/resources/lang/.gitignore b/worldedit-core/src/main/resources/lang/.gitignore deleted file mode 100644 index 0a00d7014..000000000 --- a/worldedit-core/src/main/resources/lang/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*/ \ No newline at end of file diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 6633b240e..33045094c 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -7,7 +7,6 @@ "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.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.set.region": "Selection set to your current allowed region", diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index 0ac91396e..551a83f67 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -34,6 +34,7 @@ import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; 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.world.block.BaseBlock; import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer; @@ -209,7 +210,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public Locale getLocale() { - return Locale.forLanguageTag(player.language.replace('_', '-')); + return TextUtils.getLocaleByMinecraftTag(player.language); } @Override diff --git a/worldedit-logo.png b/worldedit-logo.png deleted file mode 100644 index e0b515743..000000000 Binary files a/worldedit-logo.png and /dev/null differ diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java index e9808c99e..350a7c9a6 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java @@ -34,7 +34,6 @@ import org.slf4j.Logger; import java.io.IOException; import java.util.HashSet; -import java.util.Locale; public class ConfigurateConfiguration extends LocalConfiguration { @@ -131,11 +130,6 @@ public class ConfigurateConfiguration extends LocalConfiguration { shellSaveType = type.equals("") ? null : type; 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('_', '-')); - } + setDefaultLocaleName(node.getNode("default-locale").getString(defaultLocaleName)); } }