BungeeLib - Library for Bungee

BungeeLib

This is a resource for developers looking to work with Bungee without having to deal with plugin messages manually.

This is a replacement for my old library SpongyCord; rather than a plugin, it is a shadowable library. It also has no possibility of multiple plugins interfering, unlike SpongyCord.

This library supports all the standard Bungee functions:

  • Connecting players to other servers
  • Getting players’ real IP addresses
  • Getting players’ real UUIDs
  • Getting player counts, both server and network
  • Getting player lists, both server and network
  • Getting the server name of the current server
  • Sending messages to players on other servers
  • Sending plugin message packets to other players or servers
  • Getting the IP address of servers
  • Kicking players on other servers

Simply construct a BungeeLib using your PluginContainer and everything will work.

Notes:

  • Since the library operates via plugin messages, there must be at least one player online on the server.
  • If the server is not currently in GameState.SERVER_STARTED, an IllegalStateException is thrown.
  • If the server has started, but there are no players online, methods that do not take a player as an argument throw NoPlayerOnlineException.

Source
Javadoc

To use this in your plugin, add the following code to build.gradle:

plugins {
    id 'com.github.johnrengelman.shadow' version '1.2.3'
}
configurations {
    compile.extendsFrom shadow
}
repositories {
    maven {
        url 'https://jitpack.io'
    }
}
dependencies {
    shadow 'com.github.pie-flavor:BungeeLib:1.0.0'
}
shadowJar {
    classifier = null
    configurations = [project.configurations.shadow]
}
build.dependsOn(shadowJar)

No Maven example because maven is bad.

3 Likes

When I’m trying to use this I get this for message

Error:(3, 0) Plugin [id: ‘com.johnrengelman.shadow’, version: ‘1.2.3’] was not found in any of the following sources:

  • Gradle Core Plugins (plugin is not in ‘org.gradle’ namespace)
  • Gradle Central Plugin Repository (no ‘com.johnrengelman.shadow’ plugin available - see https://plugins.gradle.org for available plugins)
    Open File

Now I am nowhere near to being experienced so I could be doing something wrong here but perhaps someone can explain what I’m doing wrong here?

My bad. There’s supposed to be a github in there. Updated the OP.

Yup works. Thanks

Can I also execute commands on the bungeecord?

I’m not fully certain what you’re asking.

Well I think the answer is no.
But I meant if it is possible execute a command through your lib like it is executed from the bungee cord console.

No, that’s not part of BungeeCord’s API.

Would this library still work for the current version of Bungee?

The API has never broken. So yes.