Skip to content

EssentialsXDiscordLink service dissapears after server fully starts. #6086

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

Open
Fami6Xx opened this issue Mar 11, 2025 · 0 comments
Open

EssentialsXDiscordLink service dissapears after server fully starts. #6086

Fami6Xx opened this issue Mar 11, 2025 · 0 comments
Labels
bug: unconfirmed Potential bugs that need replicating to verify.

Comments

@Fami6Xx
Copy link

Fami6Xx commented Mar 11, 2025

Type of bug

Other unexpected behaviour

/ess dump all output

https://essentialsx.net/dump.html?bytebin=rRrJMrySek

Error log (if applicable)

https://paste.gg/p/anonymous/95e9a4c8a79c43158f0805934c0b0523

Bug description

I'm creating a plugin which whitelists only specified players that have specified role.
In onEnable, where i'm using discordService (normal) it functions normally.
All of the plugins load without an error.

Code for getting service classes:

    public static DiscordService getDiscordService() {
        DiscordService service = Bukkit.getServicesManager().load(DiscordService.class);
        if (service == null) {
            getInstance().getLogger().severe("Discord service not found!");
            throw new RuntimeException("Discord service not found!");
        }
        return service;
    }

    public static DiscordLinkService getDiscordLinkService() {
        DiscordLinkService service = Bukkit.getServicesManager().load(DiscordLinkService.class);
        if (service == null) {
            getInstance().getLogger().severe("DiscordLink service not found!");
            throw new RuntimeException("DiscordLink service not found!");
        }
        return service;
    }

Code that is throwing errors:

    public static String getDiscordId(final Player player) {
        final String discordId = getDiscordLinkService().getDiscordId(player.getUniqueId());
        if (discordId == null) {
            return null;
        }

        final InteractionMember member = getDiscordService().getMemberById(discordId).join();
        return member == null ? null : member.getId();
    }

Steps to reproduce

Latest snapshot, use the code.

Expected behaviour

Get the service without it being null.

Actual behaviour

The servicesmanager from bukkit returns null for discordLinkService, don't know if for discordService too.

Additional Information

Code: https://github.com/Fami6Xx/BlockyWhitelist
Server: Paper 1.20.4
Java version: 21

@Fami6Xx Fami6Xx added the bug: unconfirmed Potential bugs that need replicating to verify. label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: unconfirmed Potential bugs that need replicating to verify.
Projects
None yet
Development

No branches or pull requests

1 participant