Class BungeeCordHelper
java.lang.Object
eu.cloudnetservice.modules.bridge.impl.platform.bungeecord.BungeeCordHelper
Helper utilities for bungeecord-related functionalities.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate static final CheckedPredicate<net.md_5.bungee.api.connection.ProxiedPlayer> private final net.md_5.bungee.api.ProxyServerprivate final CheckedConsumer<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> private final CheckedConsumer<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> -
Constructor Summary
ConstructorsConstructorDescriptionBungeeCordHelper(@NonNull net.md_5.bungee.api.ProxyServer proxyServer, @NonNull net.md_5.bungee.api.ProxyConfig proxyConfig) -
Method Summary
Modifier and TypeMethodDescriptionprivate @NonNull net.md_5.bungee.api.config.ServerInfoconstructServerInfo(@NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfo) Constructs a proxy server info from the given service info snapshot.static booleanisInitialConnect(@NonNull net.md_5.bungee.api.connection.ProxiedPlayer player) Tests if the connection of the given player is initial, returningfalseif the player did successfully connect to a backend service before.voidregisterServer(@NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfoSnapshot) Register the given service to the proxy.voidunregisterServer(@NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfoSnapshot) Unregisters the given service from the proxy.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
PLAYER_INITIAL_CONNECT_TESTER
private static final CheckedPredicate<net.md_5.bungee.api.connection.ProxiedPlayer> PLAYER_INITIAL_CONNECT_TESTER -
proxyServer
private final net.md_5.bungee.api.ProxyServer proxyServer -
serverRegisterHandler
private final CheckedConsumer<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> serverRegisterHandler -
serverUnregisterHandler
private final CheckedConsumer<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> serverUnregisterHandler
-
-
Constructor Details
-
BungeeCordHelper
-
-
Method Details
-
isInitialConnect
public static boolean isInitialConnect(@NonNull @NonNull net.md_5.bungee.api.connection.ProxiedPlayer player) Tests if the connection of the given player is initial, returningfalseif the player did successfully connect to a backend service before. The last point in the login sequence where this check returns a valid result is inServerConnectedEvent.- Parameters:
player- the player to test.- Returns:
- true if the player was not connected to any service before, false otherwise.
- Throws:
NullPointerException- if the given player is null.IllegalStateException- if the test failed for some reason.
-
registerServer
public void registerServer(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfoSnapshot) Register the given service to the proxy. An existing service with the same name will be replaced.- Parameters:
serviceInfoSnapshot- the snapshot of the service to register.- Throws:
NullPointerException- if the given service info snapshot is null.
-
unregisterServer
public void unregisterServer(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfoSnapshot) Unregisters the given service from the proxy.- Parameters:
serviceInfoSnapshot- the snapshot of the service to unregister.- Throws:
NullPointerException- if the given service info snapshot is null.
-
constructServerInfo
@NonNull private @NonNull net.md_5.bungee.api.config.ServerInfo constructServerInfo(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfo) Constructs a proxy server info from the given service info snapshot.- Parameters:
serviceInfo- the service info to construct a server info from.- Returns:
- a server info constructed from the given service info snapshot.
- Throws:
NullPointerException- if the given service info snapshot is null.
-