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

Improve BungeeCord support #388

Open
BlackBaroness opened this issue Mar 4, 2024 · 2 comments
Open

Improve BungeeCord support #388

BlackBaroness opened this issue Mar 4, 2024 · 2 comments
Labels
enhancement New feature or request platform

Comments

@BlackBaroness
Copy link
Contributor

To me, the current BungeeCord module is quite simple and not as well-thought-out as some others modules.

I see some improvements we could make (it's annoying to create a lot of issues so we can discuss here and then split):

Outdated argument/contextual message approach

This module doesn't use modern MessageKey system and still uses legacy generic+constructor variant.

No Adventure environment present

Maybe we can add something like bukkit-adventure which would accept a BungeeAudiences instance? Adventure supports BungeeCord and we all (I hope) love MiniMessage, so this is something what default modern plugin would use. BungeeCord isn't really legacy thing by its own, it still can be used in many modern environments.

No platform-specific arguments

To me, we need to add at least:

ProxiedPlayer

Nothing to say, just online player.

ServerInfo

Maybe also restrict it somehow, so players won't see servers they don't have access to in tab-complete? However, I would use such an argument only for admins.

Offline players

It's a kinda difficult but would look nicely - we don't have OfflinePlayer like in Bukkit but we can extract nicknames from some different source, like optionally hooking into LuckPerms. Also, it's important that such an argument must accept any input, maybe we can do a POJO like a OfflineProxiedPlayer(@Nullable ProxiedPlayer)

This can be a great and platform-independent API, actually. We could make something like...

interface OfflinePlayerSource {
   Optional<PlatformOfflinePlayer> find(String name);
   Set<String> names();
}

...and then add a default implementation that would use something it can, for example, hook into the LuckPerms if it's installed or remember player names entered the network during this session. There are a lot to discuss.

I am ready to contribute for these features.

@BlackBaroness
Copy link
Contributor Author

It's a how we would take all the nicknames from LuckPerms (it's in Kotlin but I believe you understand the idea):

fun main() {
    with(LuckPermsProvider.get().userManager) {
        val nicknames = uniqueUsers.join().asSequence()
            .map { getOrLoadUser(it) }
            .mapNotNull { it.username }
            .toCollection(HashSet())
    }
}

fun UserManager.getOrLoadUser(uuid: UUID): User {
    return this.getUser(uuid) ?: this.loadUser(uuid).join()
}

We could load all usernames on startup async and then listen to UserFirstLoginEvent so we can update a local cache without database lookup.

@Rollczi
Copy link
Owner

Rollczi commented Mar 6, 2024

Thanks @BlackBaroness for issue. Yeah, I forgot to implement the modern features in the bungee platform.

TODO list:

  • ProxiedPlayer argument
  • ServerInfo argument
  • ServerInfo context provider
  • use modern MessageKey for messages

Offline player

I think it's better for someone to self-implement it.

No Adventure environment present

Currently you can use adventure on the Bungee platform.
See on this code:
image
You can use only litecommands-bukkit and litecommands-adventure-platform to enable the adventure extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request platform
Projects
Status: Todo
Development

No branches or pull requests

2 participants