Skip to content

Commit 226d0d8

Browse files
committed
Fixed Chat API version detection
1 parent 5ff1747 commit 226d0d8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>InteractiveChat</groupId>
44
<artifactId>InteractiveChat</artifactId>
5-
<version>2.7.1</version>
5+
<version>2.7.2</version>
66
<build>
77
<sourceDirectory>src</sourceDirectory>
88
<resources>

src/com/loohp/interactivechat/InteractiveChat.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
import com.loohp.interactivechat.Utils.RarityUtils;
4242

4343
import net.md_5.bungee.api.chat.ClickEvent;
44+
import net.md_5.bungee.api.chat.HoverEvent;
4445
import net.md_5.bungee.api.chat.TextComponent;
46+
import net.md_5.bungee.api.chat.HoverEvent.Action;
47+
import net.md_5.bungee.api.chat.hover.content.Text;
4548

4649
public class InteractiveChat extends JavaPlugin {
4750

@@ -232,9 +235,11 @@ public void onEnable() {
232235
ClientSettingPackets.clientSettingsListener();
233236

234237
try {
235-
new TextComponent("Legacy Bungeecord Chat API Test").getHoverEvent().getContents();
238+
TextComponent test = new TextComponent("Legacy Bungeecord Chat API Test");
239+
test.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, new Text("Test Hover Text")));
240+
test.getHoverEvent().getContents();
236241
legacyChatAPI = false;
237-
} catch (Exception | NoSuchMethodError e) {
242+
} catch (Throwable e) {
238243
legacyChatAPI = true;
239244
Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[InteractiveChat] Legacy Bungeecord Chat API detected, using legacy methods...");
240245
};

0 commit comments

Comments
 (0)