Giter Site home page Giter Site logo

kyoripowered / adventure-platform Goto Github PK

View Code? Open in Web Editor NEW
156.0 12.0 28.0 1.4 MB

Adventure platform implementations

Home Page: https://docs.advntr.dev/platform/index.html

License: MIT License

Java 100.00%
java minecraft bukkit bungeecord spongeapi

adventure-platform's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adventure-platform's Issues

Titles do not send at all

Hi,

When using a BukkitAudience of players, showTitle doesn't... show a title.

Version:
Server: Paper version git-Paper-135 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)
adventure-api: 4.0.0-SNAPSHOT
adventure-platform-bukkit: 4.0.0-SNAPSHOT

Code to Reproduce:

getAudience().players().showTitle(Title.of(
    TextComponent.of("Items Randomized!").color(NamedTextColor.YELLOW),
    TextComponent.of("a")
));

Where getAudience() runs BukkitAudiences.create(plugin) and plugin is an instance of the JavaPlugin defined during onEnable.

As a sanity check, I also verified the same audience of players and the sendMessage function:

getAudience().players().sendMessage(TextComponent.of("test..."));

This works. Notice the messages, but no title.

Minecraft 1.18 not supported

Currently Minecraft 1.18 is not supported, because the fields and methods names in the NMS classes are now obfuscated.

This doesn't work:

  • Actionbars
  • Titles
  • EntitySound
  • Books

Debug output:

15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4770/0x0000000801aa5440
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$Chat@37e6578
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$Chat@bd809f5
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4779/0x0000000801aaa220
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4780/0x0000000801aaa440
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$ActionBar_1_17@50962d45
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$ActionBar@2e664cf3
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$ActionBarLegacy@167e02b3
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4784/0x0000000801aabaa8
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$Title_1_17@7f681954
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$Title@6b4d5d2a
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$SoundWithCategory@1681f8b3
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$Sound@ad9d6c
[15:52:10] [Server thread/WARN]: Failed to initialize EntitySound CraftBukkit facet
java.lang.NullPointerException: Cannot invoke "java.lang.invoke.MethodHandle.invoke(Object, Object)" because "net.kyori.adventure.platform.bukkit.CraftBukkitFacet$EntitySound.REGISTRY_GET_OPTIONAL" is null
	at net.kyori.adventure.platform.bukkit.CraftBukkitFacet$EntitySound.<clinit>(CraftBukkitFacet.java:447) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudience.lambda$static$13(BukkitAudience.java:70) ~[?:?]
	at net.kyori.adventure.platform.facet.Facet.of(Facet.java:71) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudience.<clinit>(BukkitAudience.java:69) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.createAudience(BukkitAudiencesImpl.java:137) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.createAudience(BukkitAudiencesImpl.java:74) ~[?:?]
	at net.kyori.adventure.platform.facet.FacetAudienceProvider.<init>(FacetAudienceProvider.java:99) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.<init>(BukkitAudiencesImpl.java:95) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.lambda$build$1(BukkitAudiencesImpl.java:168) ~[?:?]
	at java.util.HashMap.computeIfAbsent(HashMap.java:1220) ~[?:?]
	at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2760) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.build(BukkitAudiencesImpl.java:168) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.instanceFor(BukkitAudiencesImpl.java:89) ~[?:?]
	at net.kyori.adventure.platform.bukkit.BukkitAudiences.create(BukkitAudiences.java:53) ~[?:?]
	at de.cytooxien.internationalization.spigot.manager.SpigotMessageManagerImpl.<init>(SpigotMessageManagerImpl.java:43) ~[i18n-spigot.jar:?]
	at de.cytooxien.internationalization.spigot.InternationalizationPlugin.onEnable(InternationalizationPlugin.java:36) ~[i18n-spigot.jar:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18-rc3-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18-rc3-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[paper-api-1.18-rc3-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[spigot.jar:git-Paper-"7db994d"]
	at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[spigot.jar:git-Paper-"7db994d"]
	at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:726) ~[spigot.jar:git-Paper-"7db994d"]
	at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:501) ~[spigot.jar:git-Paper-"7db994d"]
	at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:313) ~[spigot.jar:git-Paper-"7db994d"]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1201) ~[spigot.jar:git-Paper-"7db994d"]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[spigot.jar:git-Paper-"7db994d"]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$EntitySound@1672d3cd
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$BookPost1_13@6864f73a
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$Book1_13@3707b542
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$BookPre1_13@dcabb5f
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.viaversion.ViaFacet$BossBar$Builder@35b1d8a2
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.viaversion.ViaFacet$BossBar$Builder1_9_To_1_15@1d4fca84
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$BossBar$Builder@76aa21e3
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$BossBarBuilder@5be363bb
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$BossBarWither$Builder@4a3ddfc5
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.viaversion.ViaFacet$TabList@5e39a7d7
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.PaperFacet$TabList@7bd3f6ad
[15:52:10] [Server thread/INFO]: Skipped facet: net.kyori.adventure.platform.bukkit.CraftBukkitFacet$TabList@2ec756eb
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$TabList@7ae88a6b
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$CommandSenderPointers@722a2e6a
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$ConsoleCommandSenderPointers@23269398
[15:52:10] [Server thread/INFO]: Added facet: net.kyori.adventure.platform.bukkit.BukkitFacet$PlayerPointers@79647d02
[15:52:10] [Server thread/INFO]: Selected facet: net.kyori.adventure.platform.bukkit.BukkitFacet$Chat@bd809f5 for com.destroystokyo.paper.console.TerminalConsoleCommandSender@6ca5e5ce

java.lang.NoSuchFieldError: LOCALE

// JavaPlugin onEnable()
BukkitAudiences.create(this);
java.lang.NoSuchFieldError: LOCALE
        at net.kyori.adventure.platform.bukkit.BukkitAudience.contributePointers(BukkitAudience.java:117) ~[?:?]
        at net.kyori.adventure.platform.facet.FacetAudience.pointers(FacetAudience.java:449) ~[?:?]
        at net.kyori.adventure.pointer.Pointered.getOrDefault(Pointered.java:65) ~[patched_1.17.1.jar:git-Purpur-1272]
        at net.kyori.adventure.platform.facet.FacetAudienceProvider.addViewer(FacetAudienceProvider.java:114) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.<init>(BukkitAudiencesImpl.java:99) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.lambda$build$1(BukkitAudiencesImpl.java:162) ~[?:?]
        at java.util.HashMap.computeIfAbsent(HashMap.java:1224) ~[?:?]
        at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2722) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.build(BukkitAudiencesImpl.java:162) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.instanceFor(BukkitAudiencesImpl.java:88) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiences.create(BukkitAudiences.java:53) ~[?:?]

NoSuchFieldError: LOCALE on Spigot 1.19 when calling BukkitAudiences#create(Plugin)

Apologies if I'm missing something obvious because this is the first time I've used this library.

java.lang.NoSuchFieldError: LOCALE
        at net.kyori.adventure.platform.bukkit.BukkitAudience.contributePointers(BukkitAudience.java:117) ~[?:?]
        at net.kyori.adventure.platform.facet.FacetAudience.pointers(FacetAudience.java:453) ~[?:?]
        at net.kyori.adventure.pointer.Pointered.getOrDefault(Pointered.java:65) ~[?:?]
        at net.kyori.adventure.platform.facet.FacetAudienceProvider.addViewer(FacetAudienceProvider.java:113) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.<init>(BukkitAudiencesImpl.java:99) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.lambda$build$1(BukkitAudiencesImpl.java:175) ~[?:?]
        at java.util.HashMap.computeIfAbsent(HashMap.java:1220) ~[?:?]
        at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2760) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.build(BukkitAudiencesImpl.java:173) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.instanceFor(BukkitAudiencesImpl.java:89) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiences.create(BukkitAudiences.java:53) ~[?:?]

Server is running CraftBukkit version 3539-Spigot-56be6a8-82f7574 (MC: 1.19) (Implementing API version 1.19-R0.1-SNAPSHOT)
Output of java --version

openjdk 18.0.1.1 2022-04-22
OpenJDK Runtime Environment (build 18.0.1.1+2)
OpenJDK 64-Bit Server VM (build 18.0.1.1+2, mixed mode)

OS is Arch Linux x64

Empty translatable components in console

Component#translatable does not behave the same in minecraft client and server console.

For example:

   message = Component.translatable(
          "commands.gamemode.success.other",
           NamedTextColor.WHITE,
           Component.text(player.getDisplayName()),
           Component.translatable("gameMode."+gamemode.toString().toLowerCase())
    );
    bukkitAudiences.sender(sender).sendMessage(message);

This results in "Set [playername]'s game mode to [gamemodename]" in client, but displays as empty string in the console ignoring the fact that console has the same ability to translate components as client, which is proven by using bungeecord API

     TranslatableComponent component = new TranslatableComponent("commands.gamemode.success.other", 
     player.getDisplayName(), new TranslatableComponent("gameMode."+gamemode.toString().toLowerCase()));
     sender.sendMessage(component);

This returns "Set [playername]'s game mode to [gamemodename]" both in client and console.

I don't know what exactly goes wrong, but components behaving differently in console and client are not expected.

`MinecraftComponentSerializer` throws `UnsupportedOperationException`

Tested on:

  • 1.19.4
  • 1.20.2
  • 1.20.4

I get UnsupportedOperationException when calling MinecraftComponentSerializer.get().serialize(component); on villagers names trade GUI name and some other texts.

Only way to fix that is to convert the adventure Component to Json String and use NMS to convert the Json String to Minecraft MutableComponent, I tried that and works fine.
Seems the issue is somehow caused by the json tree -> MutableComponent implementation.

        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-api</artifactId>
            <version>4.15.0</version>
        </dependency>
        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-text-serializer-gson</artifactId>
            <version>4.15.0</version>
        </dependency>
        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
            <version>4.15.0</version>
        </dependency>
        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-platform-bukkit</artifactId>
            <version>4.3.2</version>
        </dependency>
        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-text-minimessage</artifactId>
            <version>4.15.0</version>
        </dependency>
[15:02:10 ERROR]: [ItemsAdder] Unhandled exception occurred in onPacketSending(PacketEvent) for ItemsAdder
java.lang.UnsupportedOperationException: com.google.gson.JsonSyntaxException: Expected id to be a string, was an array ([140...38])
	at net.kyori.adventure.platform.bukkit.MinecraftComponentSerializer.serialize(MinecraftComponentSerializer.java:225) ~[LoneLibs.jar:?]
	at ia.m.iI.a(SourceFile:97) ~[ItemsAdder_3.6.3-beta-5.jar:?]
	at ia.m.hy.onPacketSending(SourceFile:173) ~[ItemsAdder_3.6.3-beta-5.jar:?]
	at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:219) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.SortedPacketListenerList.invokeUnpackedPacketSending(SortedPacketListenerList.java:204) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:139) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.PacketFilterManager.postPacketToListeners(PacketFilterManager.java:553) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:526) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector.onPacketSending(NetworkManagerInjector.java:100) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector.processOutbound(NettyChannelInjector.java:553) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector$2.doProxyRunnable(NettyChannelInjector.java:456) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.proxyRunnable(NettyEventLoopProxy.java:43) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.execute(NettyEventLoopProxy.java:252) ~[ProtocolLib.jar:?]
	at net.minecraft.network.Connection.sendPacket(Connection.java:432) ~[?:?]
	at net.minecraft.network.Connection.send(Connection.java:392) ~[?:?]
	at net.minecraft.server.network.ServerCommonPacketListenerImpl.send(ServerCommonPacketListenerImpl.java:276) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.server.network.ServerCommonPacketListenerImpl.send(ServerCommonPacketListenerImpl.java:261) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.server.level.ServerPlayer.openMenu(ServerPlayer.java:1640) ~[?:?]
	at net.minecraft.world.item.trading.Merchant.openTradingScreen(Merchant.java:41) ~[?:?]
	at net.minecraft.world.entity.npc.Villager.startTrading(Villager.java:453) ~[?:?]
	at net.minecraft.world.entity.npc.Villager.mobInteract(Villager.java:431) ~[?:?]
	at net.minecraft.world.entity.Mob.interact(Mob.java:1374) ~[?:?]
	at net.minecraft.world.entity.player.Player.interactOn(Player.java:1174) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl$4.performInteraction(ServerGamePacketListenerImpl.java:2816) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl$4.a(ServerGamePacketListenerImpl.java:2836) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAction.dispatch(ServerboundInteractPacket.java:131) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:80) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:2775) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:67) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:12) ~[?:?]
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:53) ~[?:?]
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1351) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:193) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1328) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1321) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1299) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1187) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.20.2.jar:git-Purpur-2095]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: com.google.gson.JsonSyntaxException: Expected id to be a string, was an array ([140...38])
	at net.minecraft.util.GsonHelper.convertToString(GsonHelper.java:97) ~[?:?]
	at net.minecraft.util.GsonHelper.getAsString(GsonHelper.java:103) ~[?:?]
	at net.minecraft.network.chat.HoverEvent$EntityTooltipInfo.create(HoverEvent.java:177) ~[?:?]
	at net.minecraft.network.chat.HoverEvent$Action.deserialize(HoverEvent.java:136) ~[?:?]
	at net.minecraft.network.chat.HoverEvent.deserialize(HoverEvent.java:80) ~[?:?]
	at net.minecraft.network.chat.Style$Serializer.getHoverEvent(Style.java:405) ~[?:?]
	at net.minecraft.network.chat.Style$Serializer.deserialize(Style.java:377) ~[?:?]
	at net.minecraft.network.chat.Style$Serializer.deserialize(Style.java:364) ~[?:?]
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.1.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1227) ~[gson-2.10.1.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1329) ~[gson-2.10.1.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1300) ~[gson-2.10.1.jar:?]
	at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179) ~[gson-2.10.1.jar:?]
	at net.minecraft.network.chat.Component$Serializer.deserialize(Component.java:361) ~[?:?]
	at net.minecraft.network.chat.Component$Serializer.deserialize(Component.java:222) ~[?:?]
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.1.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1227) ~[gson-2.10.1.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1329) ~[gson-2.10.1.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1271) ~[gson-2.10.1.jar:?]
	at net.minecraft.network.chat.Component$Serializer.fromJson(Component.java:536) ~[?:?]
	at net.kyori.adventure.platform.bukkit.MinecraftComponentSerializer.serialize(MinecraftComponentSerializer.java:221) ~[LoneLibs.jar:?]
	... 44 more
[15:02:10 ERROR]: Parameters: 
  net.minecraft.network.protocol.game.PacketPlayOutOpenWindow@2d1a960d[
    a=11
    b=net.minecraft.world.inventory.Containers@3a73661d
    c=translation{key='entity.minecraft.villager.farmer', args=[]}[style={hoverEvent=HoverEvent{action=<action show_entity>, value='net.minecraft.network.chat.ChatHoverable$b@8abdf856'},insertion=08629de5-8c47-4554-8ad5-1f075a194266}]
  ]

Problem with ViaVersion and sending message

I use adventure (I think latest release, 4.0.0-SNAPSHOT) (relocated but I think it doesn't changes a lot) weird problem occurs. I have server on Paper 1.12.2 and ViaVersion 3.2.1. When player version is 1.16 or higher that error shows in console.

org.bukkit.command.CommandException: Unhandled exception executing command 'lang' in plugin TitanMessages v1.1.6
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:152) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:685) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1492) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1297) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[patched_1.12.2.jar:git-Paper-1618]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_265]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_265]
        at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:850) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:774) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:666) ~[patched_1.12.2.jar:git-Paper-1618]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]
Caused by: java.lang.NoSuchMethodError: us.myles.ViaVersion.api.PacketWrapper.<init>(ILnet/titanvale/titanapi/libs/netty/buffer/ByteBuf;Lus/myles/ViaVersion/api/data/UserConnection;)V
        at net.titanvale.titanapi.libs.kyori.adventure.platform.viaversion.ViaFacet$ProtocolBased.createPacket(ViaFacet.java:163) ~[?:?]
        at net.titanvale.titanapi.libs.kyori.adventure.platform.viaversion.ViaFacet$Chat.sendMessage(ViaFacet.java:183) ~[?:?]
        at net.titanvale.titanapi.libs.kyori.adventure.platform.viaversion.ViaFacet$Chat.sendMessage(ViaFacet.java:176) ~[?:?]
        at net.titanvale.titanapi.libs.kyori.adventure.platform.facet.FacetAudience.sendMessage(FacetAudience.java:161) ~[?:?]
        at net.titanvale.titanapi.libs.kyori.adventure.audience.Audience.sendMessage(Audience.java:207) ~[?:?]
        at net.titanvale.titanapi.libs.kyori.adventure.audience.Audience.sendMessage(Audience.java:183) ~[?:?]
        at net.titanvale.titanmessages.bukkit.command.LangCommand.onCommand(LangCommand.java:49) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[patched_1.12.2.jar:git-Paper-1618]
        ... 15 more```

When player version is 1.12-1.15.2 all works fine.
I tested other ViaVersion versions (3.2.0 and 3.0.0).
I don't know if it Adventure or ViaVersion problem and I decided to first report it here.

Don't implement `AutoClosable` on `AudienceProvider`

This makes IDEs and other linting tools nag at you for not using try-with-resources and for not closing it. It's not really necessary nor particularly useful in this case for it to exist. It also gives the impression that the audience providers should be used like other AutoClosable objects, like database connections or input streams (where you spin one up, use it and close it) which is not the case.

sendMessage does not send a message to a console command sender audience (Bukkit)

Using adventure-api 4.1.0, and adventure-platform-bukkit 4.0.0-SNAPSHOT, tested on Paper 1.16.3 #231,Audience#sendMessage does not send a message to the console. The audience is gotten from BukkitAudiences#sender in a command executor. A player will execute the command and receive feedback in chat, but console will execute the commad (and the commands executor will run) but no messages will be seen in console.

A test plugin can be seen in this paste:
https://paste.gg/p/anonymous/3f63f1b92212456593fe0601814df075

With this test plugin, in game I can run /testplugin and receive a green message "Test component", and when using the console I can run the command but receive no feedback.

RGB colours to console via Bukkit are corrupted

RGB colours don't seem to be converted to the named colours when outputting to the console, resulting in corruption.

Gradle dependencies:
implementation "net.kyori:adventure-api:4.3.0"
implementation "net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"

Server:
papermc-1.16.4+b259-1 on archlinux

E.g.:

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
...
    Component named = Component.text("")
                        .append(Component.text("red").color(NamedTextColor.RED))
                        .append(Component.text(" green").color(NamedTextColor.GREEN))
                        .append(Component.text(" blue").color(NamedTextColor.BLUE));
    Component rgb = Component.text("")
                        .append(Component.text("red").color(TextColor.color(0xff0000)))
                        .append(Component.text(" green").color(TextColor.color(0x00ff00)))
                        .append(Component.text(" blue").color(TextColor.color(0x0000ff)));

    BukkitAudiences audiences = BukkitAudiences.create(this);
    Audience consoleAudience = audiences.console();
    consoleAudience.sendMessage(named);
    consoleAudience.sendMessage(rgb);

    getLogger().info(LegacyComponentSerializer.legacySection().serialize(named));
    getLogger().info(LegacyComponentSerializer.legacySection().serialize(rgb));

There are 4 outputs here:

  1. sendMessage(named): works fine
  2. sendMessage(rgb): gets corrupted (though fine in client when sent to player)
  3. LegacyComponentSerializer named: works fine
  4. LegacyComponentSerializer rgb: works fine

Screenshot_20201222_231004

Title durations can overflow when converted to ticks

[11:12:11] [Server thread/WARN]: Caused by: java.lang.ArithmeticException: long overflow
[11:12:11] [Server thread/WARN]:     at java.base/java.lang.Math.multiplyExact(Math.java:946)
[11:12:11] [Server thread/WARN]:     at java.base/java.lang.Math.multiplyExact(Math.java:922)
[11:12:11] [Server thread/WARN]:     at java.base/java.time.Duration.toMillis(Duration.java:1225)
[11:12:11] [Server thread/WARN]:     at tc.oc.pgm.lib.net.kyori.adventure.platform.facet.Facet$Title.toTicks(Facet.java:288)
[11:12:11] [Server thread/WARN]:     at tc.oc.pgm.lib.net.kyori.adventure.platform.facet.FacetAudience.showTitle(FacetAudience.java:239)
[11:12:11] [Server thread/WARN]:     at tc.oc.pgm.lib.net.kyori.adventure.audience.ForwardingAudience$Single.showTitle(ForwardingAudience.java:189)
[11:12:11] [Server thread/WARN]:     at tc.oc.pgm.lib.net.kyori.adventure.audience.ForwardingAudience$Single.showTitle(ForwardingAudience.java:189)

This is a snippet of a stack trace that suggests that the toTicks method has no safeguard against overflowing for big values.
The given value in this example is ChronoUnit.FOREVER which lasts Long.MAX_VALUE + a nano adjustment of 999_999_999.

Remove unnecessary subprojects

The craftbukkit and spongeapi serializers see very little use outside of their direct platform implementations. Those modules should be combined into their owning -platforms.

Closes #46 since it becomes irrelevant.

Tablist header/footer works on Spigot 1.17 but not Paper 1.17

Was getting lots of this when running with the debug flag:

[00:23:40 WARN]: Failed to send tab list header and footer to CraftPlayer{name=jasonmpen}
java.lang.ClassCastException: Cannot cast net.kyori.adventure.text.TextComponentImpl to net.minecraft.network.chat.Component
    at java.lang.Class.cast(Class.java:3818) ~[?:?]
    at xyz.jpenilla.tabtps.lib.net.kyori.adventure.platform.bukkit.CraftBukkitFacet$TabList.send(CraftBukkitFacet.java:1249) ~[?:?]
    at xyz.jpenilla.tabtps.lib.net.kyori.adventure.platform.bukkit.CraftBukkitFacet$TabList.send(CraftBukkitFacet.java:1194) ~[?:?]
    at xyz.jpenilla.tabtps.lib.net.kyori.adventure.platform.facet.FacetAudience.sendPlayerListFooter(FacetAudience.java:348) ~[?:?]
    at xyz.jpenilla.tabtps.lib.net.kyori.adventure.audience.ForwardingAudience$Single.sendPlayerListFooter(ForwardingAudience.java:225) ~[?:?]
    at xyz.jpenilla.tabtps.common.display.task.TabDisplayTask.run(TabDisplayTask.java:67) ~[?:?]

Evaluate ComponentSerializer services

With 4.8.0, ComponentSerializer services are available to customize how serializers are initialized.

Classloading on Bukkit makes ServiceLoader a bit fragile, but would it be worth implementing these on the platforms?

There is the additional issue of this causing problems for users who shade without enabling the appropriate service file transformers -- the serializer services will silently fail to initialize, leading to more support requests.

CME when player leaves game with boss bars displayed (Bukkit)

When a player leaves the game while they have a boss bar displayed which is potentially being updated, occasionally a ConcurrentModificationException will be thrown: https://paste.gg/p/anonymous/ac2bf0334dd44a7f8d348ca60afe7f7b

In actual plugins this seems to happen quite rarely, but I have created a test plugin which consistently produces this exception every time I join and then leave the game: https://paste.gg/p/anonymous/31835baec50448cb89a8019c630ba3da

NoSuchMethodError using the Bukkit audiences dependency

When I create an audience using BukkitAudiences.create(JavaPlugin) some users get this error or similar:

java.lang.NoSuchMethodError: 'java.lang.Object net.kyori.adventure.platform.facet.FacetAudience.getOrDefault(net.kyori.adventure.pointer.Pointer, java.lang.Object)'
    at net.kyori.adventure.platform.facet.FacetAudienceProvider.addViewer(FacetAudienceProvider.java:113) ~[?:?]
    at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.<init>(BukkitAudiencesImpl.java:99) ~[?:?]
    at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.lambda$build$1(BukkitAudiencesImpl.java:175) ~[?:?]
    at java.util.HashMap.computeIfAbsent(HashMap.java:1224) ~[?:?]
    at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2722) ~[?:?]
    at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.build(BukkitAudiencesImpl.java:173) ~[?:?]
    at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.instanceFor(BukkitAudiencesImpl.java:89) ~[?:?]
    at net.kyori.adventure.platform.bukkit.BukkitAudiences.create(BukkitAudiences.java:53) ~[?:?]
    at net.citizensnpcs.api.util.Messaging.configure(Messaging.java:71) ~[?:?]
    at net.citizensnpcs.Settings.updateMessagingSettings(Settings.java:56) ~[?:?]
    at net.citizensnpcs.Settings.<init>(Settings.java:31) ~[?:?]
    at net.citizensnpcs.Citizens.onEnable(Citizens.java:332) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
    at java.lang.Thread.run(Thread.java:831) [?:?]

Is there something I'm doing wrong?

Setting motd on bungeecord doesn't work

Serializing a component to the bungeecord format and then trying to use it as an motd utilizing the ProxyPingEvent results in this simple error message with no further explaination:
[/*.*.*.*] <-> InitialHandler - encountered exception
The same component can be used in chat messages with no issues. I tried to get the full stacktrace using try-catch blocks with no success. It doesn't matter if the component is created with Component.text() or with MiniMessage. Using bungeecord components directly works just fine.

1.20.4 - `MinecraftComponentSerializer#deserialize(...)` throws `UnsupportedOperationException`

On 1.20.4 I get UnsupportedOperationException when calling:

MinecraftComponentSerializer.get().deserialize(nms);
java.lang.UnsupportedOperationException: null
        at lonelibs.net.kyori.adventure.platform.bukkit.MinecraftComponentSerializer.<clinit>(MinecraftComponentSerializer.java:91) ~[LoneLibs.jar:?]

This didn't happen on 1.20.2.
Attaching a debugger shown that MC_TEXT_GSON and TEXT_SERIALIZER_SERIALIZE are null and SUPPORTED is false.

Thank you for your time!

CraftBukkitFacet player list header footer sending broken on <1.13

Attempting to set a player list header/footer on versions below 1.13 fails with an exception: paste

This seems to be because of these two lines:

private static final @Nullable MethodHandle CLIENTBOUND_TAB_LIST_PACKET_SET_HEADER = findSetterOf(findField(CLIENTBOUND_TAB_LIST_PACKET, "header"));

private static final @Nullable MethodHandle CLIENTBOUND_TAB_LIST_PACKET_SET_FOOTER = findSetterOf(findField(CLIENTBOUND_TAB_LIST_PACKET, "footer"));

Before 1.13, these fields were called a and b, and changing these names from header and footer to a and b fixed the issue for me locally on pre 1.13 versions.

ViaFacet.Chat causing broken translation keys for newer clients

When sending item names on a 1.8 server as translatable components to players on 1.13+ such as "item.swordStone.name" the translatable key doesn't get migrated with viaversion before getting sent to the client.

It's sent as {"translate":"item.swordStone.name"} which the client displays as item.swordStone.name in chat.

This only happens when sent with the ViaFacet but if its sent with the CraftBukkitFacet ViaVersions converts the component keys and it displays correctly.

ViaFacet is using ProtocolBased which injects in to ViaVersion "1_16", "1_15_2" to do the hex color stuff but this causes the message to skip the 1.8 to 1.15.2 packet translations steps.

Spoke briefly with @KingOfSquares and @Electroid about this in the past who may be able to advise further.

bukkit: cannot play sounds with self emitter

I believe this used to work but, as of writing, using BukkitAudience#playSound(Sound,Emitter) is not working with Sound.Emitter.self() in bukkit adventure platform v4.1.1 (the sound does not play). tested on git-Paper-65 (MC: 1.19)

Can I use the Crafty Reflection Utility in my Own Plugin?

i noticed on the top of the file is an mit license info thing. if i wanted to include this in my own plugin, do i need to declare it under a new package namespace or can i use my own? from what im getting from the notice, i just need to paste it on the top of the file.

Add adapter-fabric module

This would be another adapter to convert Kyori's text format to the Text format which fabric uses.

I will probably submit a draft of it later. This probably won't be much larger than a single helper class since the Text system fabric uses (which is minecraft's native system already has a built in serializer).

HoverEvents not sending with components

Issue described over discord, but minus well do it here too.

Attempting to add hover events to a text component results in it not being present when it is sent to a client. This is likely the issue for ActionEvents too, but I haven't tested that.

Server & MC Version: PaperSpigot 1.8
bukkit adapter: 3.0.4-SNAPSHOT
gson serializer: 3.0.4
text-api: 3.0.4

Code to reproduce:
TextComponent textComponent = TextComponent.builder() .content("hello") .color(TextColor.RED) .hoverEvent(HoverEvent.showText(TextComponent.of("example"))) .build(); TextAdapter.sendMessage(sender, textComponent);

Result, as stated is that message is sent is sent with colors, but tooltip is unavailable.

BungeeCord Audience sendMessage: source not working with client

The following has been tested on bungeecord, not on spigot however. This is not the exact code, but it shows the logic I've been using and what I already debugged.

public void sendChatMessage(CommandSender sender, UUID sourceId, Component component) {
    Identity identity = Identity.identity(sourceId);
    Audience audience = /*... get BungeeAudiences ...*/.sender(sender);
    audience.sendMessage(source, component, MessageType.CHAT);
}

I debugged using two of my own accounts. On one account, I added the other account to my local ignore list using the social options screen (default keybind is P).
When I was sending a message using the code above with the blocked account as identity, I expected to not see that message with my other account - yet it still came through.

java.lang.NoSuchFieldError: LOCALE

// JavaPlugin onEnable()
BukkitAudiences.create(this);
java.lang.NoSuchFieldError: LOCALE
        at net.kyori.adventure.platform.bukkit.BukkitAudience.contributePointers(BukkitAudience.java:117) ~[?:?]
        at net.kyori.adventure.platform.facet.FacetAudience.pointers(FacetAudience.java:449) ~[?:?]
        at net.kyori.adventure.pointer.Pointered.getOrDefault(Pointered.java:65) ~[patched_1.17.1.jar:git-Purpur-1272]
        at net.kyori.adventure.platform.facet.FacetAudienceProvider.addViewer(FacetAudienceProvider.java:114) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.<init>(BukkitAudiencesImpl.java:99) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.lambda$build$1(BukkitAudiencesImpl.java:162) ~[?:?]
        at java.util.HashMap.computeIfAbsent(HashMap.java:1224) ~[?:?]
        at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2722) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.build(BukkitAudiencesImpl.java:162) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.instanceFor(BukkitAudiencesImpl.java:88) ~[?:?]
        at net.kyori.adventure.platform.bukkit.BukkitAudiences.create(BukkitAudiences.java:53) ~[?:?]
        

Saw that issue, Still a problem tho
I was also using 4.9.0. Upgrading to the latest (4.9.1) and like the other post it still causes the problems

Issue #60
This is more of a plea to look at the other issue if you can, or just close this one too but i would like to know how to resolve this

ViaFacet isn't being consistently used when it is the best applicable approach.

There's an issue with the way that the viafacet is currently being handled as it doesn't attempt to re-establish usage of itself if a player's userconnection is temporarily unavailable. This also affects other players that are a part of the same audience as well, as it seems to not care about picking a new facet on a per player basis.

This leads to various issues with message formatting, as it will not attempt to format the message properly with post-1.16 and whatnot formatting changes.

To replicate:

  • Join a server (preferably one that is pre-1.16), have it send a message on login.
  • Send a message.
  • Keep relogging, and it'll eventually break.

How the message should look (on 1.19 for both images):
image
How it ends up looking (downsampled to the pre-1.16 message formatting due to it being permanently unable to tell the client's version):
image

Custom translations aren't being translated when send to the console

Using the bukkit platform 4.0.0-SNAPSHOT, and trying to send a custom translateable message to the console with BukkitAudiences#console but during my plugins onEnable hook, the message that is sent, is just the translation key, like it failed to translate. The same message works fine when sent to a player

Interestingly enough, in the onDisable hook, I'm also sending a message, and that one is translated correctly.

Nothing weird when I ran the server with the debug flag.

[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4208/0x000000080163d588
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$Chat@de03ca9
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitFacet$Chat@59cb323f
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4214/0x000000080184c500
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4215/0x000000080184c720
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$ActionBar_1_17@b2fd87
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$ActionBar@8e10600
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$ActionBarLegacy@cc55414
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitAudience$$Lambda$4219/0x000000080184dd88
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$Title_1_17@7d904c75
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$Title@76235303
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitFacet$SoundWithCategory@70d8c78c
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitFacet$Sound@8b6468e
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$EntitySound@330b031a
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$BookPost1_13@3740628f
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$Book1_13@6b5f70fa
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$BookPre1_13@4dba406d
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.viaversion.ViaFacet$BossBar$Builder@2faf2f4e
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.viaversion.ViaFacet$BossBar$Builder1_9_To_1_15@254df9cb
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$BossBar$Builder@67c60027
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitFacet$BossBarBuilder@5b145014
[23:39:30 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$BossBarWither$Builder@1a86cf24
[23:39:30 INFO]: Skipped facet: me.machinemaker.libs.kyori.adventure.platform.viaversion.ViaFacet$TabList@56841b3c
[23:39:31 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.PaperFacet$TabList@7c775579
[23:39:31 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.CraftBukkitFacet$TabList@7856ab3f
[23:39:31 INFO]: Added facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitFacet$TabList@2e68fa24
[23:39:31 INFO]: Selected facet: me.machinemaker.libs.kyori.adventure.platform.bukkit.BukkitFacet$Chat@59cb323f for com.destroystokyo.paper.console.TerminalConsoleCommandSender@385aae50
[23:39:31 INFO]: plugin-lifecycle.on-enable.loaded-modules
[23:39:31 INFO]: plugin-lifecycle.on-enable.enabled-modules

SpongeAudience#playSound(Sound) breaks after player death/respawn

The Audience#playSound(Sound) method from Sponge 7's platform breaks (i.e. stops playing sounds) after the target player dies and respawns. Relogging fixes the issue (due to the creation of a new Audience object).

Likely an issue with fetching the player's position as Audience#playSound(Sound,double,double,double) works fine.


Version Information

<dependency>
    <groupId>net.kyori</groupId>
    <artifactId>adventure-platform-spongeapi</artifactId>
    <version>4.0.1</version>
</dependency>

SpongeVanilla
Minecraft: 1.12.2
SpongeAPI: 7.4.0-5ea6215
Sponge: 1.12.2-7.4.7
SpongeVanilla: 1.12.2-7.4.7
JVM: 1.8.0_312/32-bit (Temurin)
OS: Windows 10 (10.0/x86)

BungeeComponentSerializer doesn't work on Java 16

With Java 16, the BungeeComponentSerializer no longer works.

    public PlayerChatInput setComponent(Component component) {
        System.out.println("Input: " + component);
        this.message = BungeeComponentSerializer.get().serialize(component);
        System.out.println("Output: " + Arrays.toString(message));
        return this;
    }

Input Component:

[22:15:52] [Server thread/INFO]: Input: TextComponentImpl{content="", style=StyleImpl{color=null, obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[TextComponentImpl{content="Schreibe den Betrag an ", style=StyleImpl{color=NamedTextColor{value="#aaaaaa"}, obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content="Chips", style=StyleImpl{color=NamedTextColor{value="#ffaa00"}, obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content=", welche du ", style=StyleImpl{color=NamedTextColor{value="#aaaaaa"}, obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content="verkaufen ", style=StyleImpl{color=NamedTextColor{value="#ffaa00"}, obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content="möchtest, in den Chat.", style=StyleImpl{color=NamedTextColor{value="#aaaaaa"}, obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}]}

Output BaseComponent:

[22:15:52] [Server thread/INFO]: Output: [BaseComponent(color=, font=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=null, hoverEvent=null)]

ViaVersion Sponge incompatibility

Description

ViaVersion seems to be incompatible with LuckPerms on Sponge. The error is here.
I've narrowed this down to this line in ViaFacet of the LuckPerms adventure platform. The issue appears to stem from LuckPerms loading the class before ViaVersion. The class loaded has a static declaration, and one of the methods called references it's own plugin. LuckPerms manages this just fine, however when ViaVersion ends up loading it promptly fails as a result. I believe this could be solved with using a different Class.forName method, however i'm not terribly familiar with Sponge classloading if they do anything weird or the LuckPerms adventure platform.

Reproduction steps

Use the latest builds of LuckPerms and ViaVersion together on a Sponge server (tested with SpongeVanilla, probably the same on SpongeForge).

Environment details

SpongeVanilla 1.12.2 API 7.3.0
LuckPerms Sponge 5.2.78 (5.2.76 and some in-between versions also tested)
ViaVersion 3.2.2 (or latest dev 3.3.0, back to 3.2.0 was tested a bit ago)

Issue copied from Luckperms#2822

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): Update plugin io.github.gradle-nexus.publish-plugin to v2.0.0
  • chore(deps): Update dependency com.google.errorprone:error_prone_annotations to v2.27.0

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/build.yml
.github/workflows/rebuild-docs-on-release.yml
gradle
gradle.properties
settings.gradle
  • org.gradle.toolchains.foojay-resolver-convention 0.8.0
build.gradle
  • net.kyori.indra 3.1.3
  • net.kyori.indra.publishing.sonatype 3.1.3
  • net.kyori.indra.licenser.spotless 3.1.3
  • net.kyori.indra.crossdoc 3.1.3
  • io.github.gradle-nexus.publish-plugin 2.0.0-rc-2
  • com.google.errorprone:error_prone_annotations 2.26.1
  • org.jetbrains:annotations 24.1.0
  • ca.stellardrift:contract-validator 1.0.1
  • ca.stellardrift:stylecheck 0.2.1
  • org.junit.jupiter:junit-jupiter-api 5.10.2
  • org.junit.jupiter:junit-jupiter-engine 5.10.2
  • net.kyori:adventure-api 4.13.1
  • net.kyori:adventure-text-serializer-legacy 4.13.1
  • net.kyori:adventure-nbt 4.13.1
  • net.kyori:adventure-text-serializer-gson 4.13.1
  • net.kyori:adventure-text-serializer-gson-legacy-impl 4.13.1
api/build.gradle
platform-bukkit/build.gradle
  • com.destroystokyo.paper:paper-api 1.15.2-R0.1-SNAPSHOT
platform-bungeecord/build.gradle
  • net.md-5:bungeecord-api 1.16-R0.4
platform-facet/build.gradle
platform-spongeapi/build.gradle
  • org.spongepowered:spongeapi 7.1.0
platform-viaversion/build.gradle
  • com.viaversion:viaversion-api 4.3.0
text-serializer-bungeecord/build.gradle
text-serializer-legacy-text3/build.gradle
  • net.kyori:text-serializer-gson 3.0.4
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

BungeeComponentSerializer causes "IllegalArgumentException: Component loop" error

When using the BungeeComponentSerializer's serialize method does BungeeCord print a IllegalArgumentException: Component loop error in the console, when attempting to turn the BaseComponent[] into a Single TextComponent from BungeeCord.

Full Stacktrace: https://hasteb.in/odorajob.lua

I did the following Checks:

1.) Only send BungeeCord Components:

                BaseComponent c1 = new TextComponent("§cUnsupported Minecraft Version ({userVersion})!");
                BaseComponent c2 = new TextComponent("§cChange your version to §7{version}§c.");
                
                TextComponent component = new TextComponent(c1, c2);

Result: Worked

2.) Create KyoriPowered Component and then parse it into a BaseComponent array for TextComponent.

                Component c1 = Component.text("Unsupported Minecraft Version ({userVersion})!").color(NamedTextColor.RED)
                        .append(Component.newline())
                        .append(Component.text("Change your version to {version}.").color(NamedTextColor.RED));
                
                BaseComponent[] components = BungeeComponentSerializer.get().serialize(c1); // Parse to BaseComponent[]
                
                TextComponent component = new TextComponent(components); // Turn into single TextComponent.

Result: Failed

Both attempts where used to provide them to BungeeCord's ServerPing#setDescriptionComponent(BaseComponent) method to modify the Server MOTD.

CraftBukkitFacet creates a component with legacy codes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.