From 912850f1ab0411e3e4995cba0fa190be4374901c Mon Sep 17 00:00:00 2001 From: Rsl1122 <24460436+Rsl1122@users.noreply.github.com> Date: Sat, 7 Nov 2020 13:25:15 +0200 Subject: [PATCH] Fixed in-game links not working in 1.8 --- .../djrapitops/plan/commands/use/BukkitPartBuilder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Plan/bukkit/src/main/java/com/djrapitops/plan/commands/use/BukkitPartBuilder.java b/Plan/bukkit/src/main/java/com/djrapitops/plan/commands/use/BukkitPartBuilder.java index b44e019d4..896292ca4 100644 --- a/Plan/bukkit/src/main/java/com/djrapitops/plan/commands/use/BukkitPartBuilder.java +++ b/Plan/bukkit/src/main/java/com/djrapitops/plan/commands/use/BukkitPartBuilder.java @@ -22,6 +22,8 @@ import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import org.apache.commons.text.TextStringBuilder; import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.Arrays; @@ -133,6 +135,11 @@ class BukkitPartBuilder implements MessageBuilder { } // CommandSender#spigot#sendMessage(BaseComponent[]) is not supported on 1.8 - current.sender.sender.sendMessage(BaseComponent.toLegacyText(components.toArray(new BaseComponent[0]))); + CommandSender commandSender = current.sender.sender; + if (commandSender instanceof Player) { + ((Player) commandSender).spigot().sendMessage(components.toArray(new BaseComponent[0])); + } else { + commandSender.sendMessage(BaseComponent.toLegacyText(components.toArray(new BaseComponent[0]))); + } } }