More explanation, I'm using Spigot and Java Discord API (JDA) to send a message to discord when someone speaks in Minecraft chat. I want to show the player's skin's face in an embed but I don't know how to do so since it keeps telling me I'm not using a valid HTTP(s) or attachment url.
Here's my current code, it fails at the .setAuthor
line.
public static void sendMCMessage(String message, String username){
TextChannel channel = api.getTextChannelById("1088516469974908928");
EmbedBuilder embed = new EmbedBuilder()
.setColor(Color.green)
.setAuthor(username, null, "http://minotar.net/helm/" + username + ".png")
.setFooter(api.getSelfUser().getName() + " 2023", api.getSelfUser().getAvatarUrl())
.addField(" ", message, true);
channel.sendMessageEmbeds(embed.build()).queue();
}
Here are the logs:
[22:28:25] [ServerMain/INFO]: Building unoptimized datafixer
[22:28:26] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[22:28:27] [ServerMain/INFO]: Loaded 7 recipes
[22:28:28] [Server thread/INFO]: Starting minecraft server version 1.19
[22:28:28] [Server thread/INFO]: Loading properties
[22:28:28] [Server thread/INFO]: This server is running CraftBukkit version 3553-Spigot-14a2382-ef09464 (MC: 1.19) (Implementing API version 1.19-R0.1-SNAPSHOT)
[22:28:28] [Server thread/INFO]: Debug logging is disabled
[22:28:28] [Server thread/INFO]: Server Ping Player Sample Count: 12
[22:28:28] [Server thread/INFO]: Using 4 threads for Netty based IO
[22:28:28] [Server thread/INFO]: Default game type: CREATIVE
[22:28:28] [Server thread/INFO]: Generating keypair
[22:28:28] [Server thread/INFO]: Starting Minecraft server on *:25565
[22:28:28] [Server thread/INFO]: Using default channel type
[22:28:28] [Server thread/INFO]: [WorldEdit] Loading WorldEdit v7.2.14+6360-094b734
[22:28:29] [Server thread/INFO]: Got request to register class com.sk89q.worldedit.bukkit.BukkitServerInterface with WorldEdit [com.sk89q.worldedit.extension.platform.PlatformManager@388b7766]
[22:28:29] [Server thread/INFO]: [WorldCraft] Loading WorldCraft v0.0.1
[22:28:29] [Server thread/INFO]: [WorldEdit] Enabling WorldEdit v7.2.14+6360-094b734
[22:28:29] [Server thread/INFO]: Registering commands with com.sk89q.worldedit.bukkit.BukkitServerInterface
[22:28:29] [Server thread/INFO]: WEPIF: Using the Bukkit Permissions API.
[22:28:29] [Server thread/INFO]: Using com.sk89q.worldedit.bukkit.adapter.impl.v1_19_R1.PaperweightAdapter as the Bukkit adapter
[22:28:29] [Server thread/INFO]: [WorldEdit] ====================================================
[22:28:29] [Server thread/INFO]: [WorldEdit] WorldEdit works better if you use Paper
[22:28:29] [Server thread/INFO]: [WorldEdit] as your server software.
[22:28:29] [Server thread/INFO]: [WorldEdit]
[22:28:29] [Server thread/INFO]: [WorldEdit] Paper offers significant performance improvements,
[22:28:29] [Server thread/INFO]: [WorldEdit] bug fixes, security enhancements and optional
[22:28:29] [Server thread/INFO]: [WorldEdit] features for server owners to enhance their server.
[22:28:29] [Server thread/INFO]: [WorldEdit]
[22:28:29] [Server thread/INFO]: [WorldEdit] Paper includes Timings v2, which is significantly
[22:28:29] [Server thread/INFO]: [WorldEdit] better at diagnosing lag problems over v1.
[22:28:29] [Server thread/INFO]: [WorldEdit]
[22:28:29] [Server thread/INFO]: [WorldEdit] All of your plugins should still work, and the
[22:28:29] [Server thread/INFO]: [WorldEdit] Paper community will gladly help you fix any issues.
[22:28:29] [Server thread/INFO]: [WorldEdit]
[22:28:29] [Server thread/INFO]: [WorldEdit] Join the Paper Community @ https://papermc.io
[22:28:29] [Server thread/INFO]: [WorldEdit] ====================================================
[22:28:29] [Server thread/INFO]: Preparing level "world"
[22:28:29] [Server thread/INFO]: -------- World Settings For [world] --------
[22:28:29] [Server thread/INFO]: Item Merge Radius: 2.5
[22:28:29] [Server thread/INFO]: Item Despawn Rate: 6000
[22:28:29] [Server thread/INFO]: View Distance: 20
[22:28:29] [Server thread/INFO]: Simulation Distance: 15
[22:28:29] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[22:28:29] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
[22:28:29] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
[22:28:29] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
[22:28:29] [Server thread/INFO]: Experience Merge Radius: 3.0
[22:28:29] [Server thread/INFO]: Cactus Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Cane Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Melon Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Mushroom Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Sapling Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Beetroot Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Carrot Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Potato Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Wheat Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: NetherWart Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Vine Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Cocoa Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Bamboo Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Kelp Growth Modifier: 100%
[22:28:29] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true / Isa false
[22:28:29] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[22:28:29] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Nether: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
[22:28:29] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1 Hopper Can Load Chunks: false
[22:28:29] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[22:28:29] [Server thread/INFO]: Max TNT Explosions: 100
[22:28:29] [Server thread/INFO]: Mob Spawn Range: 6
[22:28:30] [Server thread/INFO]: -------- World Settings For [world_the_end] --------
[22:28:30] [Server thread/INFO]: Item Merge Radius: 2.5
[22:28:30] [Server thread/INFO]: Item Despawn Rate: 6000
[22:28:30] [Server thread/INFO]: View Distance: 20
[22:28:30] [Server thread/INFO]: Simulation Distance: 15
[22:28:30] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[22:28:30] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
[22:28:30] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
[22:28:30] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
[22:28:30] [Server thread/INFO]: Experience Merge Radius: 3.0
[22:28:30] [Server thread/INFO]: Cactus Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Cane Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Melon Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Mushroom Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Sapling Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Beetroot Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Carrot Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Potato Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Wheat Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: NetherWart Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Vine Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Cocoa Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Bamboo Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Kelp Growth Modifier: 100%
[22:28:30] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true / Isa false
[22:28:30] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[22:28:30] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Nether: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
[22:28:30] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1 Hopper Can Load Chunks: false
[22:28:30] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[22:28:30] [Server thread/INFO]: Max TNT Explosions: 100
[22:28:30] [Server thread/INFO]: Mob Spawn Range: 6
[22:28:30] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[22:28:31] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[22:28:31] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[22:28:31] [Worker-Main-11/INFO]: Preparing spawn area: 0%
[22:28:31] [Worker-Main-11/INFO]: Preparing spawn area: 0%
[22:28:32] [Worker-Main-8/INFO]: Preparing spawn area: 34%
[22:28:32] [Server thread/INFO]: Time elapsed: 2331 ms
[22:28:32] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
[22:28:33] [Worker-Main-5/INFO]: Preparing spawn area: 0%
[22:28:33] [Worker-Main-4/INFO]: Preparing spawn area: 0%
[22:28:33] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[22:28:34] [Worker-Main-4/INFO]: Preparing spawn area: 87%
[22:28:34] [Server thread/INFO]: Time elapsed: 1535 ms
[22:28:34] [Server thread/INFO]: [WorldCraft] Enabling WorldCraft v0.0.1
[22:28:34] [Server thread/INFO]: [WorldCraft] Plugin enabled!
[22:28:35] [Server thread/INFO]: Login Successful!
[22:28:35] [Server thread/INFO]: [WorldCraft] Bot online!
[22:28:35] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[22:28:35] [Server thread/INFO]: Done (5.204s)! For help, type "help"
[22:28:35] [JDA MainWS-ReadThread/INFO]: Connected to WebSocket
[22:28:35] [JDA MainWS-ReadThread/INFO]: Finished Loading!
[22:28:37] [User Authenticator #1/INFO]: UUID of player Senkoco is c7216f2f-d79b-41f3-837d-f166cfe29000
[22:28:37] [Server thread/INFO]: Senkoco joined the game
[22:28:37] [Server thread/INFO]: Senkoco[/[0:0:0:0:0:0:0:1]:50402] logged in with entity id 21 at ([world]-8.996503918930333, -50.0068645278064, -9.284796186114068)
[22:28:43] [Async Chat Thread - #0/ERROR]: Could not pass event AsyncPlayerChatEvent to WorldCraft v0.0.1
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.PlayerConnection.chat(PlayerConnection.java:1955) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
at net.minecraft.server.network.PlayerConnection.broadcastChatMessage(PlayerConnection.java:1934) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
at net.minecraft.server.network.PlayerConnection.lambda$17(PlayerConnection.java:1907) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
at java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:757) [?:?]
at java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:735) [?:?]
at java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2182) [?:?]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1907) [spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1813) [spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
at net.minecraft.network.protocol.game.PacketPlayInChat$1.run(PacketPlayInChat.java:54) [spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.IllegalArgumentException: URL must be a valid http(s) or attachment url.
at net.dv8tion.jda.internal.utils.Checks.check(Checks.java:62) ~[?:?]
at net.dv8tion.jda.api.EmbedBuilder.urlCheck(EmbedBuilder.java:813) ~[?:?]
at net.dv8tion.jda.api.EmbedBuilder.setAuthor(EmbedBuilder.java:630) ~[?:?]
at me.senkoco.worldcraft.BotManager.sendMCMessage(BotManager.java:20) ~[?:?]
at me.senkoco.worldcraft.listeners.ChatListener.onPlayerChat(ChatListener.java:14) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
... 17 more
[22:28:43] [Async Chat Thread - #0/INFO]: <Senkoco> Lorem ipsum[m
[22:28:45] [Server thread/INFO]: Senkoco issued server command: /stop
[22:28:45] [Server thread/INFO]: [Senkoco: Stopping the server]
[22:28:45] [Server thread/INFO]: Stopping server
[22:28:45] [Server thread/INFO]: [WorldCraft] Disabling WorldCraft v0.0.1
[22:28:45] [Server thread/INFO]: [WorldEdit] Disabling WorldEdit v7.2.14+6360-094b734
[22:28:45] [Server thread/INFO]: Unregistering com.sk89q.worldedit.bukkit.BukkitServerInterface from WorldEdit
[22:28:45] [Server thread/INFO]: Saving players
[22:28:45] [Server thread/INFO]: Senkoco lost connection: Server closed
[22:28:45] [Server thread/INFO]: Senkoco left the game.
[22:28:45] [Server thread/INFO]: Saving worlds
[22:28:46] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
[22:28:46] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world_the_end]'/minecraft:the_end
[22:28:46] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[22:28:46] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[22:28:46] [Server thread/INFO]: ThreadedAnvilChunkStorage: All dimensions are saved
I attempted to send a skin's face in a Discord embed and expect the Skin's face to be present in the Discord embed but I am receiving an error in the console
After checking the docs for JDA:
The setAuthor()
method can either take a name and an image, or a name, URL, and image. If you don't want to use the URL (and just have the image), you only need 2 arguments.
.setAuthor(username, "http://minotar.net/helm/" + username + ".png")