diff --git a/helper/pom.xml b/helper/pom.xml index 8404913e..0d904bc9 100644 --- a/helper/pom.xml +++ b/helper/pom.xml @@ -89,6 +89,11 @@ <include>net.kyori:text-serializer-legacy</include> <include>net.kyori:text-feature-pagination</include> <include>me.lucko:textlegacy</include> + <include>net.kyori:adventure-api</include> + <include>net.kyori:adventure-text-serializer-gson</include> + <include>net.kyori:adventure-text-serializer-legacy</include> + <include>net.kyori:adventure-platform-bukkit</include> + <include>net.kyori:examination</include> <include>org.spongepowered:configurate-core</include> <include>org.spongepowered:configurate-yaml</include> <include>org.spongepowered:configurate-gson</include> @@ -110,6 +115,14 @@ <pattern>net.kyori.text</pattern> <shadedPattern>me.lucko.helper.text3</shadedPattern> </relocation> + <!--<relocation> + <pattern>net.kyori.examination</pattern> + <shadedPattern>me.lucko.helper.adventure.examination</shadedPattern> + </relocation> + <relocation> + <pattern>net.kyori.adventure</pattern> + <shadedPattern>me.lucko.helper.adventure</shadedPattern> + </relocation> --> <relocation> <pattern>net.kyori.event</pattern> <shadedPattern>me.lucko.helper.eventbus</shadedPattern> @@ -291,6 +304,41 @@ <scope>compile</scope> <optional>true</optional> </dependency> + <!-- Adventure --> + <dependency> + <groupId>net.kyori</groupId> + <artifactId>adventure-api</artifactId> + <version>${adventure.version}</version> + <scope>compile</scope> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>org.checkerframework</groupId> + <artifactId>checker-qual</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>net.kyori</groupId> + <artifactId>adventure-text-serializer-gson</artifactId> + <version>${adventure.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>net.kyori</groupId> + <artifactId>adventure-text-serializer-legacy</artifactId> + <version>${adventure.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>net.kyori</groupId> + <artifactId>adventure-platform-bukkit</artifactId> + <version>4.</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> <!-- event --> <dependency> <groupId>net.kyori</groupId> diff --git a/helper/src/main/java/me/lucko/helper/adventure/Text.java b/helper/src/main/java/me/lucko/helper/adventure/Text.java new file mode 100644 index 00000000..0923e42b --- /dev/null +++ b/helper/src/main/java/me/lucko/helper/adventure/Text.java @@ -0,0 +1,105 @@ +/* + * This file is part of helper, licensed under the MIT License. + * + * Copyright (c) lucko (Luck) <luck@lucko.me> + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.helper.adventure; + +import java.util.Arrays; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.bukkit.command.CommandSender; + +import me.lucko.helper.internal.LoaderUtils; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; + +/** + * Utilities for working with {@link Component}s and formatted text strings. + * @since 5.7.0 + */ +public class Text { + public static final char SECTION_CHAR = '\u00A7'; // § + public static final char AMPERSAND_CHAR = '&'; + + + public static String joinNewline(String... strings) { + return joinNewline(Arrays.stream(strings)); + } + + public static String joinNewline(Stream<String> strings) { + return strings.collect(Collectors.joining("\n")); + } + + public static Component fromLegacy(String input, char character) { + return LegacyComponentSerializer.legacy(character).deserialize(input); + } + + public static Component fromLegacy(String input) { + return LegacyComponentSerializer.legacy(SECTION_CHAR).deserialize(input); + } + + public static String toLegacy(Component component, char character) { + return LegacyComponentSerializer.legacy(character).serialize(component); + } + + public static String toLegacy(Component component) { + return LegacyComponentSerializer.legacy(SECTION_CHAR).serialize(component); + } + + public static void sendMessage(CommandSender sender, Component message) { + LoaderUtils.getAdventure().sender(sender).sendMessage(message); + } + + public static void sendMessage(Iterable<CommandSender> senders, Component message) { + for (CommandSender sender : senders) { + sendMessage(sender, message); + } + } + + public static String colorize(String s) { + return s == null ? null : translateAlternateColorCodes(AMPERSAND_CHAR, SECTION_CHAR, s); + } + + public static String decolorize(String s) { + return s == null ? null : translateAlternateColorCodes(SECTION_CHAR, AMPERSAND_CHAR, s); + } + + public static String translateAlternateColorCodes(char from, char to, String textToTranslate) { + char[] b = textToTranslate.toCharArray(); + for (int i = 0; i < b.length - 1; i++) { + if (b[i] == from && "0123456789AaBbCcDdEeFfKkLlMmNnOoRrXx".indexOf(b[i+1]) > -1) { + b[i] = to; + b[i+1] = Character.toLowerCase(b[i+1]); + } + } + return new String(b); + } + + private Text() { + throw new UnsupportedOperationException("This class cannot be instantiated"); + } + +} \ No newline at end of file diff --git a/helper/src/main/java/me/lucko/helper/bossbar/BukkitBossBarFactory.java b/helper/src/main/java/me/lucko/helper/bossbar/BukkitBossBarFactory.java index d9767b67..e0769d7d 100644 --- a/helper/src/main/java/me/lucko/helper/bossbar/BukkitBossBarFactory.java +++ b/helper/src/main/java/me/lucko/helper/bossbar/BukkitBossBarFactory.java @@ -25,7 +25,7 @@ package me.lucko.helper.bossbar; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import org.bukkit.Server; import org.bukkit.boss.BarColor; diff --git a/helper/src/main/java/me/lucko/helper/bossbar/ViaBossBarFactory.java b/helper/src/main/java/me/lucko/helper/bossbar/ViaBossBarFactory.java index af2f6cd3..a36a17f9 100644 --- a/helper/src/main/java/me/lucko/helper/bossbar/ViaBossBarFactory.java +++ b/helper/src/main/java/me/lucko/helper/bossbar/ViaBossBarFactory.java @@ -25,7 +25,7 @@ package me.lucko.helper.bossbar; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import me.lucko.helper.utils.ImmutableCollectors; import me.lucko.helper.utils.Players; diff --git a/helper/src/main/java/me/lucko/helper/command/CommandInterruptException.java b/helper/src/main/java/me/lucko/helper/command/CommandInterruptException.java index 96430f8e..0bee3026 100644 --- a/helper/src/main/java/me/lucko/helper/command/CommandInterruptException.java +++ b/helper/src/main/java/me/lucko/helper/command/CommandInterruptException.java @@ -25,7 +25,7 @@ package me.lucko.helper.command; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import org.bukkit.command.CommandSender; diff --git a/helper/src/main/java/me/lucko/helper/config/ConfigFactory.java b/helper/src/main/java/me/lucko/helper/config/ConfigFactory.java index 15ba9f4b..d8eb0cfb 100644 --- a/helper/src/main/java/me/lucko/helper/config/ConfigFactory.java +++ b/helper/src/main/java/me/lucko/helper/config/ConfigFactory.java @@ -35,10 +35,11 @@ import me.lucko.helper.config.typeserializers.JsonTreeTypeSerializer; import me.lucko.helper.config.typeserializers.Text3TypeSerializer; import me.lucko.helper.config.typeserializers.TextTypeSerializer; +import me.lucko.helper.config.typeserializers.AdventureTypeSerializer; import me.lucko.helper.datatree.DataTree; import me.lucko.helper.gson.GsonSerializable; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.yaml.snakeyaml.DumperOptions; @@ -118,8 +119,8 @@ public HoconConfigurationLoader loader(@Nonnull Path path) { helperSerializers.register(TypeToken.of(DataTree.class), JsonTreeTypeSerializer.INSTANCE); helperSerializers.register(TypeToken.of(String.class), ColoredStringTypeSerializer.INSTANCE); helperSerializers.register(TypeToken.of(me.lucko.helper.text.Component.class), TextTypeSerializer.INSTANCE); - helperSerializers.register(TypeToken.of(Component.class), Text3TypeSerializer.INSTANCE); - + helperSerializers.register(TypeToken.of(net.kyori.text.Component.class), Text3TypeSerializer.INSTANCE); + helperSerializers.register(TypeToken.of(Component.class), AdventureTypeSerializer.INSTANCE); TYPE_SERIALIZERS = helperSerializers.newChild(); } diff --git a/helper/src/main/java/me/lucko/helper/config/typeserializers/AdventureTypeSerializer.java b/helper/src/main/java/me/lucko/helper/config/typeserializers/AdventureTypeSerializer.java new file mode 100644 index 00000000..7998c730 --- /dev/null +++ b/helper/src/main/java/me/lucko/helper/config/typeserializers/AdventureTypeSerializer.java @@ -0,0 +1,56 @@ +/* + * This file is part of helper, licensed under the MIT License. + * + * Copyright (c) lucko (Luck) <luck@lucko.me> + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.helper.config.typeserializers; + +import com.google.common.reflect.TypeToken; +import com.google.gson.JsonElement; + +import me.lucko.helper.gson.GsonProvider; + +import net.kyori.adventure.text.Component; + +import ninja.leaping.configurate.ConfigurationNode; +import ninja.leaping.configurate.objectmapping.ObjectMappingException; +import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer; + +public class AdventureTypeSerializer implements TypeSerializer<Component> { + public static final AdventureTypeSerializer INSTANCE = new AdventureTypeSerializer(); + + private AdventureTypeSerializer() { + } + + @Override + public Component deserialize(TypeToken<?> typeToken, ConfigurationNode node) throws ObjectMappingException { + JsonElement json = node.getValue(TypeToken.of(JsonElement.class)); + return GsonProvider.standard().fromJson(json, typeToken.getType()); + } + + @Override + public void serialize(TypeToken<?> typeToken, Component component, ConfigurationNode node) throws ObjectMappingException { + JsonElement element = GsonProvider.standard().toJsonTree(component, typeToken.getType()); + node.setValue(TypeToken.of(JsonElement.class), element); + } +} \ No newline at end of file diff --git a/helper/src/main/java/me/lucko/helper/config/typeserializers/ColoredStringTypeSerializer.java b/helper/src/main/java/me/lucko/helper/config/typeserializers/ColoredStringTypeSerializer.java index bf01976d..9af14428 100644 --- a/helper/src/main/java/me/lucko/helper/config/typeserializers/ColoredStringTypeSerializer.java +++ b/helper/src/main/java/me/lucko/helper/config/typeserializers/ColoredStringTypeSerializer.java @@ -27,7 +27,7 @@ import com.google.common.reflect.TypeToken; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import ninja.leaping.configurate.ConfigurationNode; import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer; diff --git a/helper/src/main/java/me/lucko/helper/config/typeserializers/Text3TypeSerializer.java b/helper/src/main/java/me/lucko/helper/config/typeserializers/Text3TypeSerializer.java index 77ee8094..07e80003 100644 --- a/helper/src/main/java/me/lucko/helper/config/typeserializers/Text3TypeSerializer.java +++ b/helper/src/main/java/me/lucko/helper/config/typeserializers/Text3TypeSerializer.java @@ -36,6 +36,7 @@ import ninja.leaping.configurate.objectmapping.ObjectMappingException; import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer; +@Deprecated public class Text3TypeSerializer implements TypeSerializer<Component> { public static final Text3TypeSerializer INSTANCE = new Text3TypeSerializer(); diff --git a/helper/src/main/java/me/lucko/helper/gson/GsonProvider.java b/helper/src/main/java/me/lucko/helper/gson/GsonProvider.java index 33437ca1..bb2f0432 100644 --- a/helper/src/main/java/me/lucko/helper/gson/GsonProvider.java +++ b/helper/src/main/java/me/lucko/helper/gson/GsonProvider.java @@ -25,6 +25,11 @@ package me.lucko.helper.gson; +import java.io.Reader; +import java.util.Objects; + +import javax.annotation.Nonnull; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; @@ -35,20 +40,15 @@ import me.lucko.helper.gson.typeadapters.BukkitSerializableAdapterFactory; import me.lucko.helper.gson.typeadapters.GsonSerializableAdapterFactory; import me.lucko.helper.gson.typeadapters.JsonElementTreeSerializer; - -import net.kyori.text.serializer.gson.GsonComponentSerializer; - -import java.io.Reader; -import java.util.Objects; - -import javax.annotation.Nonnull; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; /** * Provides static instances of Gson */ public final class GsonProvider { - private static final Gson STANDARD_GSON = GsonComponentSerializer.populate(new GsonBuilder()) + private static final Gson STANDARD_GSON = GsonComponentSerializer.gson().populator() + .apply(new GsonBuilder()) .registerTypeHierarchyAdapter(DataTree.class, JsonElementTreeSerializer.INSTANCE) .registerTypeAdapterFactory(GsonSerializableAdapterFactory.INSTANCE) .registerTypeAdapterFactory(BukkitSerializableAdapterFactory.INSTANCE) @@ -56,7 +56,8 @@ public final class GsonProvider { .disableHtmlEscaping() .create(); - private static final Gson PRETTY_PRINT_GSON = GsonComponentSerializer.populate(new GsonBuilder()) + private static final Gson PRETTY_PRINT_GSON = GsonComponentSerializer.gson().populator() + .apply(new GsonBuilder()) .registerTypeHierarchyAdapter(DataTree.class, JsonElementTreeSerializer.INSTANCE) .registerTypeAdapterFactory(GsonSerializableAdapterFactory.INSTANCE) .registerTypeAdapterFactory(BukkitSerializableAdapterFactory.INSTANCE) @@ -134,4 +135,4 @@ public static Gson getPrettyPrinting() { return prettyPrinting(); } -} +} \ No newline at end of file diff --git a/helper/src/main/java/me/lucko/helper/hologram/BukkitHologramFactory.java b/helper/src/main/java/me/lucko/helper/hologram/BukkitHologramFactory.java index 5a167097..e8819f82 100644 --- a/helper/src/main/java/me/lucko/helper/hologram/BukkitHologramFactory.java +++ b/helper/src/main/java/me/lucko/helper/hologram/BukkitHologramFactory.java @@ -36,7 +36,7 @@ import me.lucko.helper.serialize.Position; import me.lucko.helper.terminable.composite.CompositeTerminable; -import me.lucko.helper.text3.Text; +import me.lucko.helper.adventure.Text; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.entity.ArmorStand; diff --git a/helper/src/main/java/me/lucko/helper/hologram/individual/PacketIndividualHologramFactory.java b/helper/src/main/java/me/lucko/helper/hologram/individual/PacketIndividualHologramFactory.java index 3c439cda..90c8d035 100644 --- a/helper/src/main/java/me/lucko/helper/hologram/individual/PacketIndividualHologramFactory.java +++ b/helper/src/main/java/me/lucko/helper/hologram/individual/PacketIndividualHologramFactory.java @@ -40,7 +40,7 @@ import me.lucko.helper.reflect.ServerReflection; import me.lucko.helper.serialize.Position; import me.lucko.helper.terminable.composite.CompositeTerminable; -import me.lucko.helper.text3.Text; +import me.lucko.helper.adventure.Text; import me.lucko.helper.utils.entityspawner.EntitySpawner; import org.bukkit.Chunk; diff --git a/helper/src/main/java/me/lucko/helper/internal/LoaderUtils.java b/helper/src/main/java/me/lucko/helper/internal/LoaderUtils.java index e9fca615..84289636 100644 --- a/helper/src/main/java/me/lucko/helper/internal/LoaderUtils.java +++ b/helper/src/main/java/me/lucko/helper/internal/LoaderUtils.java @@ -27,6 +27,7 @@ import me.lucko.helper.Helper; import me.lucko.helper.plugin.HelperPlugin; +import net.kyori.adventure.platform.bukkit.BukkitAudiences; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; @@ -45,6 +46,7 @@ public final class LoaderUtils { private static HelperPlugin plugin = null; private static Thread mainThread = null; + private static BukkitAudiences adventure = null; @Nonnull public static synchronized HelperPlugin getPlugin() { @@ -100,6 +102,14 @@ public static synchronized Thread getMainThread() { return mainThread; } + public static synchronized BukkitAudiences getAdventure() { + if (adventure == null) { + adventure = BukkitAudiences.create(getPlugin()); + } + + return adventure; + } + // performs an intial setup for global handlers private static void setup() { diff --git a/helper/src/main/java/me/lucko/helper/item/ItemStackBuilder.java b/helper/src/main/java/me/lucko/helper/item/ItemStackBuilder.java index e96a67cd..c4112b94 100644 --- a/helper/src/main/java/me/lucko/helper/item/ItemStackBuilder.java +++ b/helper/src/main/java/me/lucko/helper/item/ItemStackBuilder.java @@ -26,7 +26,7 @@ package me.lucko.helper.item; import me.lucko.helper.menu.Item; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import me.lucko.helper.utils.annotation.NonnullByDefault; import org.bukkit.ChatColor; diff --git a/helper/src/main/java/me/lucko/helper/menu/Gui.java b/helper/src/main/java/me/lucko/helper/menu/Gui.java index dfeab301..31392290 100644 --- a/helper/src/main/java/me/lucko/helper/menu/Gui.java +++ b/helper/src/main/java/me/lucko/helper/menu/Gui.java @@ -35,7 +35,7 @@ import me.lucko.helper.reflect.MinecraftVersions; import me.lucko.helper.terminable.TerminableConsumer; import me.lucko.helper.terminable.composite.CompositeTerminable; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import me.lucko.helper.utils.annotation.NonnullByDefault; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/helper/src/main/java/me/lucko/helper/network/redirect/AbstractRedirectSystem.java b/helper/src/main/java/me/lucko/helper/network/redirect/AbstractRedirectSystem.java index 6013c2bc..75707022 100644 --- a/helper/src/main/java/me/lucko/helper/network/redirect/AbstractRedirectSystem.java +++ b/helper/src/main/java/me/lucko/helper/network/redirect/AbstractRedirectSystem.java @@ -38,7 +38,7 @@ import me.lucko.helper.messaging.conversation.ConversationReplyListener; import me.lucko.helper.profiles.Profile; import me.lucko.helper.promise.Promise; -import me.lucko.helper.text3.Text; +import me.lucko.helper.adventure.Text; import net.jodah.expiringmap.ExpirationPolicy; import net.jodah.expiringmap.ExpiringMap; diff --git a/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboard.java b/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboard.java index 5ec8c27c..86579af7 100644 --- a/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboard.java +++ b/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboard.java @@ -25,29 +25,28 @@ package me.lucko.helper.scoreboard; -import com.comphenix.protocol.wrappers.WrappedChatComponent; -import com.google.common.base.Preconditions; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; -import me.lucko.helper.Events; -import me.lucko.helper.plugin.HelperPlugin; -import me.lucko.helper.text3.Text; -import me.lucko.helper.utils.Players; -import me.lucko.helper.utils.annotation.NonnullByDefault; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; -import net.kyori.text.serializer.gson.GsonComponentSerializer; +import com.comphenix.protocol.wrappers.WrappedChatComponent; +import com.google.common.base.Preconditions; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scoreboard.DisplaySlot; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import me.lucko.helper.Events; +import me.lucko.helper.adventure.Text; +import me.lucko.helper.plugin.HelperPlugin; +import me.lucko.helper.utils.Players; +import me.lucko.helper.utils.annotation.NonnullByDefault; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; /** * Implements {@link Scoreboard} using ProtocolLib. @@ -263,7 +262,7 @@ public boolean removePlayerObjective(Player player, String id) { } static WrappedChatComponent toComponent(String text) { - return WrappedChatComponent.fromJson(GsonComponentSerializer.INSTANCE.serialize(Text.fromLegacy(text))); + return WrappedChatComponent.fromJson(GsonComponentSerializer.gson().serialize(Text.fromLegacy(text))); } -} +} \ No newline at end of file diff --git a/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardObjective.java b/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardObjective.java index 9bb6b3a5..584690fd 100644 --- a/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardObjective.java +++ b/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardObjective.java @@ -34,7 +34,7 @@ import me.lucko.helper.protocol.Protocol; import me.lucko.helper.reflect.MinecraftVersion; import me.lucko.helper.reflect.MinecraftVersions; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import me.lucko.helper.utils.annotation.NonnullByDefault; import org.bukkit.entity.Player; diff --git a/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardTeam.java b/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardTeam.java index 86902afd..0e975208 100644 --- a/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardTeam.java +++ b/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardTeam.java @@ -36,7 +36,7 @@ import me.lucko.helper.protocol.Protocol; import me.lucko.helper.reflect.MinecraftVersion; import me.lucko.helper.reflect.MinecraftVersions; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import me.lucko.helper.utils.annotation.NonnullByDefault; import me.lucko.shadow.bukkit.PackageVersion; diff --git a/helper/src/main/java/me/lucko/helper/text3/Text.java b/helper/src/main/java/me/lucko/helper/text3/Text.java index 26b1fa98..f383cb66 100644 --- a/helper/src/main/java/me/lucko/helper/text3/Text.java +++ b/helper/src/main/java/me/lucko/helper/text3/Text.java @@ -38,7 +38,10 @@ /** * Utilities for working with {@link Component}s and formatted text strings. + * + * @deprecated Use {@link me.lucko.helper.text3.Text} */ +@Deprecated public final class Text { public static final char SECTION_CHAR = '\u00A7'; // § diff --git a/helper/src/main/java/me/lucko/helper/text3/package-info.java b/helper/src/main/java/me/lucko/helper/text3/package-info.java new file mode 100644 index 00000000..1b330872 --- /dev/null +++ b/helper/src/main/java/me/lucko/helper/text3/package-info.java @@ -0,0 +1,2 @@ +@Deprecated +package me.lucko.helper.text3; diff --git a/helper/src/main/java/me/lucko/helper/utils/Players.java b/helper/src/main/java/me/lucko/helper/utils/Players.java index 186f0e69..43f3ca14 100644 --- a/helper/src/main/java/me/lucko/helper/utils/Players.java +++ b/helper/src/main/java/me/lucko/helper/utils/Players.java @@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableList; import me.lucko.helper.Helper; -import me.lucko.helper.text.Text; +import me.lucko.helper.adventure.Text; import me.lucko.helper.utils.annotation.NonnullByDefault; import org.bukkit.Bukkit; diff --git a/pom.xml b/pom.xml index 84a0848c..31e3c84f 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,7 @@ <source.version>3.2.1</source.version> <javadoc.version>3.3.2</javadoc.version> + <adventure.version>4.14.0</adventure.version> <bukkit.version>1.12.2-R0.1-SNAPSHOT</bukkit.version> </properties>