Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix ClassNotFoundException being thrown for TAB #26

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/main/java/com/mattmx/nametags/hook/NeznamyTABHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ private static void start() {
NameTags plugin = NameTags.getInstance();
NameTagManager nameTagManager = TabAPI.getInstance().getNameTagManager();

if (nameTagManager instanceof UnlimitedNameTagManager) {
boolean isUnlimitedNameTag = false;

try {
Class.forName("me.neznamy.tab.api.nametag.UnlimitedNameTagManager");
isUnlimitedNameTag = nameTagManager instanceof UnlimitedNameTagManager;
} catch (ClassNotFoundException ignored) {
}

if (isUnlimitedNameTag) {
plugin.getLogger().warning("""
⚠ TAB UnlimitedNameTags Mode detected! ⚠

Expand All @@ -51,9 +59,11 @@ private static void start() {
.register(PlayerLoadEvent.class, (event) -> {
final TabPlayer tabPlayer = event.getPlayer();

TabAPI.getInstance()
.getNameTagManager()
.hideNameTag(tabPlayer);
NameTagManager manager = TabAPI.getInstance().getNameTagManager();

if (manager != null) {
manager.hideNameTag(tabPlayer);
}
});
}

Expand Down
Loading