### Complete LibreLogin Integration Example Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-provider.md A full example of enabling a plugin that integrates with LibreLogin. It shows how to get the provider, retrieve the plugin instance, and subscribe to authentication events. ```java public class MyAuthPlugin { private LibreLoginPlugin libreLogin; public void onEnable() { LibreLoginProvider provider = getLibreLoginProvider(); if (provider == null) { logger.error("LibreLogin is not installed"); return; } libreLogin = provider.getLibreLogin(); // Now use LibreLogin API libreLogin.getEventProvider().subscribe( libreLogin.getEventTypes().authenticated, event -> { logger.info("Player authenticated: " + event.getUUID()); } ); } private LibreLoginProvider getLibreLoginProvider() { // Implementation depends on platform // See platform-specific examples above return null; } } ``` -------------------------------- ### Check and Setup 2FA Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/authorization-provider.md Initiates the two-factor authentication (2FA) setup process by generating a secret and displaying a QR code for the player. ```java AuthorizationProvider auth = plugin.getAuthorizationProvider(); TOTPProvider totp = plugin.getTOTPProvider(); User user = plugin.getDatabaseProvider().getByUUID(player.getUniqueId()); // Generate 2FA secret TOTPData data = totp.generate(user); // Show QR code plugin.getImageProjector().project(data.qr(), player); // User is now in 2FA setup state plugin.getLogger().info("2FA setup started"); ``` -------------------------------- ### Get Plugin Version String Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the plugin version as a string. ```java String getVersion() ``` -------------------------------- ### Check 2FA Setup State Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/authorization-provider.md Checks the current authorization and 2FA setup state of a player to determine the next steps. ```java AuthorizationProvider auth = plugin.getAuthorizationProvider(); if (auth.isAwaiting2FA(player)) { plugin.getLogger().info("Player is setting up 2FA"); // Show 2FA confirmation interface } else if (auth.isAuthorized(player)) { plugin.getLogger().info("Player is fully authorized"); } else { plugin.getLogger().info("Player needs to login"); } ``` -------------------------------- ### Password Hashing and Verification Example Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/crypto-provider.md Demonstrates how to obtain the default CryptoProvider, hash a new password during user registration, and verify a password during login. ```java // Get the default crypto provider CryptoProvider crypto = plugin.getDefaultCryptoProvider(); // Hash a new password during registration String plainPassword = "user_password_123"; HashedPassword hashed = crypto.createHash(plainPassword); if (hashed != null) { User user = plugin.createUser( uuid, null, hashed, "PlayerName", new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis()), null, null, null, null, null ); plugin.getDatabaseProvider().insertUser(user); } // Verify password during login User user = plugin.getDatabaseProvider().getByUUID(playerUUID); String attemptedPassword = "user_input_password"; if (user.isRegistered() && crypto.matches(attemptedPassword, user.getHashedPassword())) { plugin.getLogger().info("Password is correct!"); } else { plugin.getLogger().info("Password is incorrect!"); } ``` -------------------------------- ### Confirm 2FA Setup Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/authorization-provider.md Confirms the player's two-factor authentication (2FA) setup by validating the provided 6-digit code. ```java AuthorizationProvider auth = plugin.getAuthorizationProvider(); User user = plugin.getDatabaseProvider().getByUUID(player.getUniqueId()); Integer userCode = Integer.parseInt(userInput); // 6-digit code // Confirm the code if (auth.confirmTwoFactorAuth(player, userCode, user)) { plugin.getLogger().info("2FA setup confirmed"); // User is no longer in 2FA setup state // isAwaiting2FA() now returns false } else { plugin.getLogger().info("Invalid 2FA code"); } ``` -------------------------------- ### Image Projection Usage Example Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/image-email-limbo.md Demonstrates how to obtain an ImageProjector, generate TOTP data, and project a QR code to a player if they can receive images. ```java ImageProjector projector = plugin.getImageProjector(); TOTPProvider totp = plugin.getTOTPProvider(); User user = plugin.getDatabaseProvider().getByUUID(uuid); if (user != null && projector.canProject(player)) { TOTPData data = totp.generate(user); projector.project(data.qr(), player); } ``` -------------------------------- ### SQL Database Connection Example Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/database-connector.md Demonstrates how to obtain and use a SQL database connection within a try-with-resources block. Ensure the connection is closed after use. ```java try (Connection conn = connector.obtainInterface()) { // Use connection Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM users"); } ``` -------------------------------- ### Get LibreLogin Plugin Instance Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/API_OVERVIEW.md Demonstrates how to obtain an instance of the LibreLoginPlugin using the LibreLoginProvider service or a platform-specific service manager. This is the primary entry point for interacting with the plugin's API. ```java import xyz.kyngs.librelogin.api.LibreLoginPlugin; import xyz.kyngs.librelogin.api.LibreLoginProvider; // Via LibreLoginProvider service LibreLoginProvider provider = getProvider(); LibreLoginPlugin plugin = provider.getLibreLogin(); // Or platform-specific service manager LibreLoginPlugin plugin = servicesManager.load(LibreLoginProvider.class).getLibreLogin(); ``` -------------------------------- ### Get LibreLogin API Instance (Paper/Purpur) Source: https://github.com/kyngs/librelogin/wiki/Basic-API-Information Obtain the LibreLogin API instance for Paper or Purpur servers by declaring it as a dependency in your plugin.yml. ```java var api = ((LibreLoginProvider) Bukkit.getPluginManager().getPlugin("LibreLogin")).getLibreLogin(); ``` -------------------------------- ### Get Plugin Instance Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Retrieves the LibreLogin plugin instance. This is typically the first step before performing any operations. ```java // Get plugin instance LibreLoginPlugin plugin = getLibreLoginInstance(); ``` -------------------------------- ### getVersion Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the plugin version as a string. ```APIDOC ## getVersion ### Description Gets the plugin version as a string. ### Method String ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (String) - **String** - version identifier ### Throws None ``` -------------------------------- ### getServerHandler Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the server handler for managing limbo and lobby servers. ```APIDOC ## getServerHandler ### Description Gets the server handler for managing limbo and lobby servers. ### Method ServerHandler ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (ServerHandler) - **ServerHandler** - server management provider ### Throws None ``` -------------------------------- ### createLimbo Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/image-email-limbo.md Creates a new Limbo server instance with a specified name. The server is automatically registered and returned for further use. This method fails silently if Limbo is not installed. ```APIDOC ## createLimbo ### Description Creates a new Limbo server instance with the given name. The server is automatically registered and returned for use with the ServerHandler. This operation fails silently if Limbo is not installed. ### Method ```java S createLimbo(String serverName) ``` ### Parameters #### Path Parameters - **serverName** (String) - Required - Name for the new limbo server ### Returns - **S** - The created server instance ### Throws - None ``` -------------------------------- ### Get All Servers Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves a collection of all registered server objects. ```java Collection getServers() ``` -------------------------------- ### Get LibreLogin API Instance (BungeeCord/Waterfall) Source: https://github.com/kyngs/librelogin/wiki/Basic-API-Information Obtain the LibreLogin API instance for BungeeCord, Waterfall, or similar proxies by declaring it as a dependency in your plugin.yml/bungee.yml. ```java var api = ((LibreLoginProvider) getProxy().getPluginManager().getPlugin("librelogin")).getLibreLogin(); ``` -------------------------------- ### Logger Usage Example Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/logger-messages.md Demonstrates how to log messages at different levels (info, warn, error, debug) and with exceptions using the plugin's logger. ```APIDOC ## Logger Usage Example ```java Logger logger = plugin.getLogger(); // Log info messages logger.info("Player authenticated successfully"); // Log warnings logger.warn("Failed to connect to premium API"); // Log errors logger.error("Database connection failed"); // Log with exceptions try { plugin.getDatabaseProvider().insertUser(user); } catch (Exception e) { logger.error("Failed to insert user", e); } // Log debug information logger.debug("Processing login for user: " + user.getUuid()); logger.debug("User IP: " + user.getIp(), null); ``` ``` -------------------------------- ### Useful Constants in Java Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Examples of creating a timestamp for the current time, a UUID from a string, and text components for messages, including colored error messages. ```java new Timestamp(System.currentTimeMillis()) ``` ```java UUID.fromString(uuidString) ``` ```java Component.text("message") ``` ```java Component.text("error").color(NamedTextColor.RED) ``` -------------------------------- ### Load LibreLogin Provider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Access the core LibreLogin provider and plugin instance. This is typically the starting point for interacting with the system. ```java // Depends on platform, typically: LibreLoginProvider provider = servicesManager.load(LibreLoginProvider.class); LibreLoginPlugin plugin = provider.getLibreLogin(); ``` -------------------------------- ### Display 2FA QR Code Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Projects the QR code for 2FA setup to a specific player's screen. ```java // Display QR code plugin.getImageProjector().project(data.qr(), player); ``` -------------------------------- ### Get Server by Name Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves a server object by its name. Specify 'limbo' to search only limbo servers. ```java S getServer(String name, boolean limbo) ``` -------------------------------- ### Verify Premium Account Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/premium-totp.md Example of how to retrieve and check premium user status. Handles potential PremiumExceptions, specifically logging warnings for throttled requests. ```java PremiumProvider premium = plugin.getPremiumProvider(); try { PremiumUser premiumUser = premium.getUserForName("PlayerName"); if (premiumUser != null) { plugin.getLogger().info("Premium user UUID: " + premiumUser.uuid()); if (!premiumUser.reliable()) { plugin.getLogger().warn("Premium data may be outdated"); } // Link to existing player User dbUser = plugin.getDatabaseProvider() .getByUUID(playerUUID); if (dbUser != null) { dbUser.setPremiumUUID(premiumUser.uuid()); plugin.getDatabaseProvider().updateUser(dbUser); } } } catch (PremiumException e) { if (e.getIssue() == PremiumException.Issue.THROTTLED) { plugin.getLogger().warn("Premium API throttled, retrying later"); } else { plugin.getLogger().error("Failed to check premium: " + e.getMessage()); } } ``` -------------------------------- ### Get Image Projector Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Retrieves the ImageProjector for displaying images to players, such as QR codes for TOTP setup. ```java ImageProjector

getImageProjector() ``` -------------------------------- ### LibreLogin Plugin Usage Example Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Demonstrates common interactions with the LibreLogin plugin, such as checking authorization, retrieving user data, subscribing to authentication events, migrating databases, and registering custom crypto providers. ```java // Get the plugin instance (implementation-specific) LibreLoginPlugin plugin = getLibreLoginPlugin(); // Check player's authentication status AuthorizationProvider auth = plugin.getAuthorizationProvider(); if (auth.isAuthorized(player)) { plugin.getLogger().info("Player is authorized"); } // Access user data User user = plugin.getDatabaseProvider().getByUUID(player.getUniqueId()); if (user != null && user.isRegistered()) { plugin.getLogger().info("User " + user.getLastNickname() + " is registered"); } // Register for authentication events plugin.getEventProvider().subscribe( plugin.getEventTypes().authenticated, event -> plugin.getLogger().info("User authenticated: " + event.getUUID()) ); // Migrate data between databases plugin.migrate(oldDatabase, newDatabase); // Register custom crypto algorithm plugin.registerCryptoProvider(new CustomCryptoProvider()); ``` -------------------------------- ### Get Player's Virtual Host Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves the virtual host (e.g., domain name) the player used to connect. This is primarily relevant for proxy setups. ```java String getPlayersVirtualHost(P player) ``` -------------------------------- ### Get Server Information Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves a collection of all available servers and logs their names, current player counts, and maximum player capacities. ```java PlatformHandle platform = plugin.getPlatformHandle(); Collection servers = platform.getServers(); for (Server server : servers) { String name = platform.getServerName(server); int players = platform.getConnectedPlayers(server); ServerPing ping = platform.ping(server); plugin.getLogger().info( name + ": " + players + "/" + ping.maxPlayers() + " players" ); } ``` -------------------------------- ### Get Platform Information Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Fetches and logs general information about the platform, including its identifier, proxy details (name, server count, plugins, limbos). ```java PlatformHandle platform = plugin.getPlatformHandle(); String platformId = platform.getPlatformIdentifier(); ProxyData proxy = platform.getProxyData(); plugin.getLogger().info("Platform: " + platformId); plugin.getLogger().info("Proxy name: " + proxy.name()); plugin.getLogger().info("Servers: " + proxy.servers().size()); plugin.getLogger().info("Plugins: " + String.join(", ", proxy.plugins())); plugin.getLogger().info("Limbo servers: " + String.join(", ", proxy.limbos())); ``` -------------------------------- ### Platform Abstraction: Player Messaging and Movement Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/API_OVERVIEW.md Demonstrates using the PlatformHandle to get a player's audience object for sending messages and to move the player to a different server. ```java PlatformHandle platform = plugin.getPlatformHandle(); Audience audience = platform.getAudienceForPlayer(player); audience.sendMessage(Component.text("Welcome!")); platform.movePlayer(player, destination); ``` -------------------------------- ### Get All Users Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/database-provider.md Fetches all users from the database. Use with caution on large databases. Returns a collection of all users. ```java Collection getAllUsers() ``` -------------------------------- ### Accessing LibreLogin API Providers Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/README.md Obtain the LibreLogin plugin instance and access its various providers for different functionalities. This is the starting point for interacting with the API. ```java import org.libredrive.librelogin.api.provider.LibreLoginProvider; import org.libredrive.librelogin.api.plugin.LibreLoginPlugin; import org.libredrive.librelogin.api.provider.PremiumProvider; import org.libredrive.librelogin.api.provider.DatabaseProvider; import org.libredrive.librelogin.api.provider.AuthorizationProvider; import org.libredrive.librelogin.api.provider.EventProvider; // Get from service manager LibreLoginProvider provider = servicesManager.load(LibreLoginProvider.class); LibreLoginPlugin plugin = provider.getLibreLogin(); // Then access all providers PremiumProvider premium = plugin.getPremiumProvider(); DatabaseProvider db = plugin.getDatabaseProvider(); AuthorizationProvider auth = plugin.getAuthorizationProvider(); EventProvider events = plugin.getEventProvider(); // ... and more ``` -------------------------------- ### Get Server Handler Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the server handler for managing limbo and lobby servers. ```java ServerHandler getServerHandler() ``` -------------------------------- ### Get Authorization Provider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the AuthorizationProvider for managing player authentication and session state. ```java AuthorizationProvider

getAuthorizationProvider() ``` -------------------------------- ### LibreLogin Database Provider Usage Example Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/database-provider.md Demonstrates how to obtain and use the ReadWriteDatabaseProvider for various database operations including reading user data by different criteria, inserting new users (single and bulk), updating existing user information, deleting users, and migrating data from an old database. ```java // Get the database provider ReadWriteDatabaseProvider db = plugin.getDatabaseProvider(); // Read operations User user = db.getByUUID(playerUUID); User userByName = db.getByName("PlayerName"); User premiumUser = db.getByPremiumUUID(mojangUUID); // Check all users from an IP Collection usersFromIP = db.getByIP("192.168.1.100"); // Write operations User newUser = plugin.createUser( uuid, null, null, "NewPlayer", new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis()), null, "192.168.1.100", null, null, null ); db.insertUser(newUser); // Bulk insert List users = Arrays.asList(user1, user2, user3); db.insertUsers(users); // Update user data user.setLastNickname("UpdatedName"); db.updateUser(user); // Delete user db.deleteUser(user); // Migration ReadDatabaseProvider oldDb = getOldDatabase(); db.insertUsers(oldDb.getAllUsers()); ``` -------------------------------- ### Get Platform Handle Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the platform handle for interacting with platform-specific player and server objects. ```java PlatformHandle getPlatformHandle() ``` -------------------------------- ### Default Server Configuration Source: https://github.com/kyngs/librelogin/wiki/Configuring-Servers This is the default configuration for server setup, where all servers are listed under the 'root' section. It's used when players do not connect from a forced host. ```hocon # The servers player should be sent to when they are authenticated. THE SERVERS MUST BE REGISTERED IN THE PROXY CONFIG. # The configuration allows configuring forced hosts; the servers in "root" are used when players do not connect from a forced host. Use ยง instead of dots. # See: https://github.com/kyngs/LibreLogin/wiki/Configuring-Forced-Hosts lobby { root=[ lobby1, lobby0 ] } ``` -------------------------------- ### Set Up 2FA for User Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/premium-totp.md Demonstrates generating a TOTP secret and QR code for a user, projecting the QR code, and storing the secret in the database after user confirmation. ```java TOTPProvider totp = plugin.getTOTPProvider(); User user = plugin.getDatabaseProvider().getByUUID(playerUUID); if (user != null) { // Generate new TOTP secret TOTPData data = totp.generate(user); // Display QR code to player plugin.getImageProjector().project(data.qr(), player); // Send secret as text fallback player.sendMessage("TOTP Secret: " + data.secret()); // Store secret after user confirms setup user.setSecret(data.secret()); plugin.getDatabaseProvider().updateUser(user); } ``` -------------------------------- ### Get Parsed Plugin Version Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the plugin version parsed into semantic version components. ```java SemanticVersion getParsedVersion() ``` -------------------------------- ### Get Default Crypto Provider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the default CryptoProvider used for hashing new passwords. ```java CryptoProvider getDefaultCryptoProvider() ``` -------------------------------- ### Console Output on Startup Source: https://github.com/kyngs/librelogin/wiki/Installation This message indicates that LibreLogin has loaded and generated a new configuration file. You will need to fill out this file. ```text [16:39:51 INFO] [librelogin]: Loading configuration... [16:39:51 WARN] [librelogin]: !! A new configuration was generated, please fill it out, if in doubt, see the wiki !! ``` -------------------------------- ### Get Plugin Data Folder Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the plugin's data folder where configuration and data files are stored. ```java File getDataFolder() ``` -------------------------------- ### Handle IOException for Resource Loading Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/errors.md Demonstrates how to catch IOException when attempting to load resources like configuration files. This is useful for gracefully handling cases where files are missing or unreadable. ```java try { InputStream resource = plugin.getResourceAsStream("config.yml"); if (resource != null) { // Process resource } } catch (IOException e) { plugin.getLogger().error("Failed to read configuration: " + e.getMessage()); } ``` -------------------------------- ### connect Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/database-connector.md Establishes a connection to the database. This method is typically called once on plugin startup and should load credentials from configuration. It throws an exception if the connection fails. ```APIDOC ## connect ### Description Establishes a connection to the database. Called once on plugin startup. ### Method void ### Throws `E` - exception if connection fails ### Behavior - Called once on plugin startup - Should load credentials from configuration - Throws exception if connection fails - After successful call, `connected()` returns true ``` -------------------------------- ### Authentication Listener Integration Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/logger-messages.md An example of integrating the Messages API into an authentication listener to send welcome messages upon successful authentication and error messages on login failure. ```java public class AuthenticationListener { private final LibreLoginPlugin plugin; private final Logger logger; private final Messages messages; public AuthenticationListener(LibreLoginPlugin plugin) { this.plugin = plugin; this.logger = plugin.getLogger(); this.messages = plugin.getMessages(); } public void onPlayerAuth(Player player, User user) { // Log event logger.info("Player " + user.getLastNickname() + " authenticated"); // Send welcome message TextComponent welcome = messages.getMessage( "messages.authenticated.welcome", user.getLastNickname() ); if (welcome != null) { Audience audience = plugin.getPlatformHandle() .getAudienceForPlayer(player); audience.sendMessage(welcome); } } public void onLoginFailed(Player player) { logger.warn("Login failed for " + player.getName()); TextComponent error = messages.getMessage("messages.error.invalid_password"); if (error != null) { Audience audience = plugin.getPlatformHandle() .getAudienceForPlayer(player); audience.sendMessage(error); } } } ``` -------------------------------- ### Accessing LibreLogin on Paper/Spigot Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-provider.md Shows how to retrieve the LibreLoginProvider using Paper's Adventure service manager and then access the plugin instance. ```java // Using Paper's Adventure service manager LibreLoginProvider provider = this.getServer().getServicesManager() .load(LibreLoginProvider.class); if (provider != null) { LibreLoginPlugin plugin = provider.getLibreLogin(); plugin.getLogger().info("LibreLogin is loaded"); } ``` -------------------------------- ### Server Management: Choose Limbo and Lobby Servers Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/API_OVERVIEW.md Illustrates the process of selecting appropriate limbo and lobby servers for a player based on authentication status and moving the player to the chosen server. ```java Server limbo = handler.chooseLimboServer(user, player); platform.movePlayer(player, limbo); // Player authenticates on limbo Server lobby = handler.chooseLobbyServer(user, player, true, true); platform.movePlayer(player, lobby); ``` -------------------------------- ### Get Player by UUID Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets a player object by their UUID. Note: this only returns players on the current proxy; use `isPresent()` for multi-proxy checks. ```java P getPlayerForUUID(UUID uuid) ``` -------------------------------- ### Database Migration Configuration Source: https://github.com/kyngs/librelogin/wiki/Database-Migration Configure the old database connection details and migration type in config.conf. Set 'on-next-startup' to true to initiate the migration on the next proxy startup. ```hocon # This is used for migrating the database from other plugins. # Please see the wiki for further information: https://github.com/kyngs/LibreLogin/wiki/Database-Migration migration { old-database { mysql { # The name of the database. database=librelogin # The host of the database. host=localhost # The maximum lifetime of a database connection in milliseconds. Don't touch this if you don't know what you're doing. max-life-time=600000 # The password of the database. password="" # The port of the database. port=3306 # The table of the old database. table=user-data # The user of the database. user=root } sqlite { # Path to SQLite database file. Relative to plugin datafolder. path="user-data.db" } } # Migrate the database on the next startup. on-next-startup=false # The type of the migration. Available Types: # jpremium-mysql - Can convert from MySQL JPremium SHA256 and BCrypt # authme-mysql - Can convert from MySQL AuthMe BCrypt and SHA256 # authme-sqlite - Can convert from SQLite AuthMe BCrypt and SHA256 # aegis-mysql - Can convert from MySQL Aegis BCrypt # dba-mysql - Can convert from MySQL DynamicBungeeAuth, which was configured to use SHA-512 # librelogin-mysql - Can convert from MySQL LibreLogin, useful for migrating to a different database # librelogin-sqlite - Can convert from SQLite LibreLogin, useful for migrating to a different database type=authme-sqlite } ``` -------------------------------- ### Get Server Class Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves the Java class of the server type. Use this to get the specific server class for the current platform (e.g., Paper or Velocity). ```java Class getServerClass() ``` -------------------------------- ### chooseLobbyServer (with fallback) Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/server-handler.md Selects an optimal lobby server to send the player to after authentication, with a fallback option. It considers player count, remember settings, and can use a fallback server if normal selection fails. Fires `LobbyServerChooseEvent`. ```APIDOC ## chooseLobbyServer (with fallback) ### Description Selects an optimal lobby server to send the player to after authentication, with fallback option. ### Method ```java S chooseLobbyServer(@Nullable User user, P player, boolean remember, boolean fallback) throws EventCancelledException ``` ### Parameters #### Path Parameters - **user** (User) - Optional - User profile (null for Bedrock players) - **player** (P) - Required - Player object - **remember** (boolean) - Required - Respect "remember last server" setting - **fallback** (boolean) - Required - Select fallback server if normal selection fails ### Response #### Success Response - **Returns** (S or null) - selected server or null if none available ### Throws - `EventCancelledException` - if event is cancelled **Selection logic:** - Normally picks server with lowest player count - Respects remember setting to return last server if enabled - Falls back to default server if fallback=true and normal selection fails - Fires `LobbyServerChooseEvent` which can be overridden ``` -------------------------------- ### Get Player Class Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves the Java class of the player type. Use this to get the specific player class for the current platform (e.g., Paper or Velocity). ```java Class

getPlayerClass() ``` -------------------------------- ### Using a Specific Crypto Algorithm (bcrypt) Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/crypto-provider.md Shows how to retrieve a specific CryptoProvider instance for an algorithm like bcrypt and use it to create a hash. ```java // Use a specific algorithm CryptoProvider bcrypt = plugin.getCryptoProvider("bcrypt"); if (bcrypt != null) { HashedPassword bcryptHash = bcrypt.createHash(plainPassword); plugin.getLogger().info("Algorithm: " + bcryptHash.algo()); } ``` -------------------------------- ### confirmTwoFactorAuth Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/authorization-provider.md Completes the two-factor authentication setup process by verifying a code. Returns true if the code is valid and 2FA setup is completed, otherwise returns false. ```APIDOC ## confirmTwoFactorAuth ### Description Completes the two-factor authentication setup process by verifying a code. ### Method N/A (Java method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **player** (P) - Required - Player confirming 2FA - **code** (Integer) - Required - 6-digit TOTP code from authenticator - **user** (User) - Required - User database profile with secret set ### Response #### Success Response - **boolean** - true if code is valid and 2FA setup completed ### Throws None ``` -------------------------------- ### Premium Account: Get User Data Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/API_OVERVIEW.md Illustrates fetching premium account information using the PremiumProvider and handling potential API exceptions like throttling. ```java try { PremiumUser premium = plugin.getPremiumProvider().getUserForName(name); if (premium != null && premium.reliable()) { user.setPremiumUUID(premium.uuid()); } } catch (PremiumException e) { if (e.getIssue() == PremiumException.Issue.THROTTLED) { // Retry later } } ``` -------------------------------- ### Override Server Selection for Premium Players Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/event-system.md Subscribe to the 'lobbyServerChoose' event to dynamically select a server. This example demonstrates redirecting premium players to a specific VIP server. ```java events.subscribe( events.getTypes().lobbyServerChoose, event -> { User user = event.getUser(); // Always send premium players to vip server if (user != null && user.getPremiumUUID() != null) { Server vipServer = event.getPlatformHandle() .getServer("vip-lobby", false); event.setServer(vipServer); } } ); ``` -------------------------------- ### Accessing LibreLogin via Service Provider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-provider.md Demonstrates how to obtain the LibreLoginProvider and subsequently the LibreLoginPlugin instance using a service manager. This is a common pattern for accessing platform services. ```java // Platform-specific implementation provided by LibreLogin LibreLoginProvider provider = getLibreLoginProvider(); LibreLoginPlugin plugin = provider.getLibreLogin(); // Or directly from platform services LibreLoginProvider provider = ServicesManager.load(LibreLoginProvider.class); if (provider != null) { plugin = provider.getLibreLogin(); } ``` -------------------------------- ### Confirm Two-Factor Authentication Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/authorization-provider.md Completes the two-factor authentication setup by verifying a provided code. Returns true if the code is valid and setup is finalized, false otherwise. ```java boolean confirmTwoFactorAuth(P player, Integer code, User user) ``` -------------------------------- ### Email and Image Service Integration Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/image-email-limbo.md This class demonstrates how to integrate email verification, TOTP QR code display, and dynamic limbo server creation using the LibreLogin plugin API. Ensure the respective handlers (EmailHandler, ImageProjector, LimboIntegration) are available before use. ```java public class EmailAndImageService { private final LibreLoginPlugin plugin; public void setupEmailVerification(Player player, User user) { EmailHandler emailHandler = plugin.getEmailHandler(); if (emailHandler == null) { plugin.getLogger().warn("Email disabled"); return; } String token = UUID.randomUUID().toString(); emailHandler.sendVerificationMail( user.getEmail(), token, user.getLastNickname() ); plugin.getLogger().info("Verification email sent"); } public void displayTOTPQR(Player player, User user) { ImageProjector projector = plugin.getImageProjector(); if (!projector.canProject(player)) { plugin.getLogger().warn("Player cannot see images"); return; } TOTPData data = plugin.getTOTPProvider().generate(user); projector.project(data.qr(), player); } public void createDynamicLimbo() { LimboIntegration limbo = plugin.getLimboIntegration(); if (limbo == null) { plugin.getLogger().warn("Limbo not available"); return; } Server newLimbo = limbo.createLimbo("limbo-" + System.currentTimeMillis()); plugin.getServerHandler().registerLimboServer(newLimbo); } } ``` -------------------------------- ### Get Player Username Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Retrieves the username for a given player. ```java String name = platform.getUsernameForPlayer(player); ``` -------------------------------- ### Accessing LibreLogin on BungeeCord Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-provider.md Demonstrates how to check for the LibreLogin plugin by its name and cast it to LibreLoginProvider to access the plugin instance. ```java // Check if LibreLogin is installed Plugin libreLogin = ProxyServer.getInstance() .getPluginManager() .getPlugin("LibreLogin"); if (libreLogin instanceof LibreLoginProvider) { LibreLoginProvider provider = (LibreLoginProvider) libreLogin; LibreLoginPlugin plugin = provider.getLibreLogin(); plugin.getLogger().info("LibreLogin is loaded"); } ``` -------------------------------- ### Get and Display Messages Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/logger-messages.md Demonstrates how to retrieve simple messages and messages with replacements using the Messages API. It also shows how to reload message configurations and handle potential errors. ```java Messages messages = plugin.getMessages(); // Get simple message TextComponent welcome = messages.getMessage("messages.welcome"); if (welcome != null) { audience.sendMessage(welcome); } // Get message with replacements TextComponent loginPrompt = messages.getMessage( "messages.login.prompt", playerName ); if (loginPrompt != null) { audience.sendMessage(loginPrompt); } // Reload messages when configuration changes try { messages.reload(plugin); plugin.getLogger().info("Messages reloaded"); } catch (IOException e) { plugin.getLogger().error("Failed to read message configuration"); } catch (CorruptedConfigurationException e) { plugin.getLogger().error("Message configuration is malformed"); } ``` -------------------------------- ### LibreLoginPlugin Interface Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/DOCUMENTATION_SUMMARY.txt Documentation for the main plugin interface, LibreLoginPlugin, which is a primary entry point for interacting with the LibreLogin system. It includes details on its Java signature, parameters, return types, exceptions, and usage examples. ```APIDOC ## LibreLoginPlugin ### Description Represents the main plugin interface for LibreLogin, providing access to core functionalities and system interactions. This interface is generic, accepting platform type `P` and server type `S`. ### Java Signature `public interface LibreLoginPlugin` ### Parameters - **P** (Type Parameter): Represents the platform-specific type. - **S** (Type Parameter): Represents the server-specific type. ### Documentation Features - Full Java signature with generic types - Parameter documentation table - Return type specification - Exceptions thrown - Behavioral notes and constraints - Multiple usage examples - Integration patterns - Common error scenarios - Source file location ``` -------------------------------- ### getParsedVersion Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the plugin version parsed into semantic version components. ```APIDOC ## getParsedVersion ### Description Gets the plugin version parsed into semantic version components. ### Method SemanticVersion ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (SemanticVersion) - **SemanticVersion** - parsed version with major, minor, patch, dev flag ### Throws None ``` -------------------------------- ### getReadProviders Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets an immutable map of all registered read-only database providers. ```APIDOC ## getReadProviders ### Description Gets an immutable map of all registered read-only database providers. ### Method GET (Assumed, as it's a retrieval method) ### Endpoint /librelogin/plugin/readProviders (Assumed) ### Parameters None ### Response #### Success Response (200) - **readProviders** (`Map>`) - Immutable map of registered read-only database providers #### Response Example ```json { "readProviders": { "provider1": { ... }, "provider2": { ... } } } ``` ``` -------------------------------- ### Create Limbo Server with LimboIntegration Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/API_OVERVIEW.md Creates a dynamic limbo server with a given name. Requires LimboIntegration service. ```java Server limbo = plugin.getLimboIntegration().createLimbo("temp-limbo"); ``` -------------------------------- ### getDatabaseProvider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the database provider for reading and writing user data. ```APIDOC ## getDatabaseProvider ### Description Gets the database provider for reading and writing user data. ### Method GET (Assumed, as it's a retrieval method) ### Endpoint /librelogin/plugin/databaseProvider (Assumed) ### Parameters None ### Response #### Success Response (200) - **databaseProvider** (`ReadWriteDatabaseProvider`) - database provider instance #### Response Example ```json { "databaseProvider": { ... } } ``` ``` -------------------------------- ### getMessages Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the message provider for accessing configurable plugin messages. ```APIDOC ## getMessages ### Description Gets the message provider for accessing configurable plugin messages. ### Method GET (Assumed, as it's a retrieval method) ### Endpoint /librelogin/plugin/messages (Assumed) ### Parameters None ### Response #### Success Response (200) - **messages** (`Messages`) - message provider instance #### Response Example ```json { "messages": { ... } } ``` ``` -------------------------------- ### getEventProvider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the event provider for subscribing to and firing LibreLogin events. ```APIDOC ## getEventProvider ### Description Gets the event provider for subscribing to and firing LibreLogin events. ### Method GET (Assumed, as it's a retrieval method) ### Endpoint /librelogin/plugin/eventProvider (Assumed) ### Parameters None ### Response #### Success Response (200) - **eventProvider** (`EventProvider`) - event management provider #### Response Example ```json { "eventProvider": { ... } } ``` ``` -------------------------------- ### getAuthorizationProvider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the authorization provider for managing player authentication state. ```APIDOC ## getAuthorizationProvider ### Description Gets the authorization provider for managing player authentication state. ### Method GET (Assumed, as it's a retrieval method) ### Endpoint /librelogin/plugin/authorizationProvider (Assumed) ### Parameters None ### Response #### Success Response (200) - **authorizationProvider** (`AuthorizationProvider

`) - provider for authorization operations #### Response Example ```json { "authorizationProvider": { ... } } ``` ``` -------------------------------- ### Logging Different Message Levels Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/logger-messages.md Demonstrates how to log messages at various levels (info, warn, error, debug) using the plugin's logger. Includes an example of logging an exception. ```java Logger logger = plugin.getLogger(); // Log info messages logger.info("Player authenticated successfully"); // Log warnings logger.warn("Failed to connect to premium API"); // Log errors logger.error("Database connection failed"); // Log with exceptions try { plugin.getDatabaseProvider().insertUser(user); } catch (Exception e) { logger.error("Failed to insert user", e); } // Log debug information logger.debug("Processing login for user: " + user.getUuid()); logger.debug("User IP: " + user.getIp(), null); ``` -------------------------------- ### Get Last Nickname Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/user.md Retrieves the last known username of the player. ```java String getLastNickname() ``` -------------------------------- ### Register Custom Database Connector Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/database-connector.md Demonstrates how to implement and register a custom DatabaseConnector with the plugin, then retrieve it. ```java // Implement DatabaseConnector public class CustomDatabaseConnector implements DatabaseConnector { // Implementation... } // Register with plugin plugin.registerDatabaseConnector( CustomDatabaseConnector.class, configPrefix -> new CustomDatabaseConnector(configPrefix), "custom-db" ); // Use it CryptoProvider custom = plugin.getCryptoProvider("custom-db"); ``` -------------------------------- ### Get Server Name Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves the string name of a given server object. ```java String getServerName(S server) ``` -------------------------------- ### chooseLimboServer Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/server-handler.md Selects an optimal limbo server for authentication. It picks the server with the lowest player count and fires `LimboServerChooseEvent`. ```APIDOC ## chooseLimboServer ### Description Selects an optimal limbo server for authentication. ### Method ```java S chooseLimboServer(User user, P player) ``` ### Parameters #### Path Parameters - **user** (User) - Required - User profile - **player** (P) - Required - Player object ### Response #### Success Response - **Returns** (S or null) - selected limbo server or null ### Throws - None **Selection logic:** - Picks server with lowest player count - Fires `LimboServerChooseEvent` which can be overridden ``` -------------------------------- ### getPlatformHandle Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the platform handle for interacting with platform-specific player and server objects. ```APIDOC ## getPlatformHandle ### Description Gets the platform handle for interacting with platform-specific player and server objects. ### Method PlatformHandle ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (PlatformHandle) - **PlatformHandle** - platform abstraction layer ### Throws None ``` -------------------------------- ### Two-Factor Authentication: Generate and Verify Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/API_OVERVIEW.md Demonstrates generating a TOTP secret and QR code for a user, projecting the QR code, and verifying a subsequently entered TOTP code. ```java TOTPData data = plugin.getTOTPProvider().generate(user); plugin.getImageProjector().project(data.qr(), player); // Player scans QR code // Verify code if (plugin.getTOTPProvider().verify(code, user.getSecret())) { auth.confirmTwoFactorAuth(player, code, user); } ``` -------------------------------- ### getTOTPProvider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the TOTP (Time-based One-Time Password) provider for 2FA operations. ```APIDOC ## getTOTPProvider ### Description Gets the TOTP (Time-based One-Time Password) provider for 2FA operations. ### Method GET (Assumed, as it's a retrieval method) ### Endpoint /librelogin/plugin/totpProvider (Assumed) ### Parameters None ### Response #### Success Response (200) - **totpProvider** (`TOTPProvider`) - TOTP provider instance #### Response Example ```json { "totpProvider": { ... } } ``` ``` -------------------------------- ### Authentication: Hash and Match Password Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/API_OVERVIEW.md Shows how to hash a user's password using CryptoProvider and verify it against a stored hash. It also demonstrates authorizing a user upon successful login. ```java AuthorizationProvider auth = plugin.getAuthorizationProvider(); CryptoProvider crypto = plugin.getDefaultCryptoProvider(); HashedPassword hashed = crypto.createHash(password); if (crypto.matches(userInput, user.getHashedPassword())) { auth.authorize(user, player, AuthenticationReason.LOGIN); } ``` -------------------------------- ### getDefaultCryptoProvider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the default crypto provider used for new password hashing. ```APIDOC ## getDefaultCryptoProvider ### Description Gets the default crypto provider used for new password hashing. ### Method GET (Assumed, as it's a retrieval method) ### Endpoint /librelogin/plugin/defaultCryptoProvider (Assumed) ### Parameters None ### Response #### Success Response (200) - **cryptoProvider** (`CryptoProvider`) - default crypto provider #### Response Example ```json { "cryptoProvider": { ... } } ``` ``` -------------------------------- ### EventProvider Interface Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/DOCUMENTATION_SUMMARY.txt Documentation for the EventProvider interface, which serves as the entry point for the event system in LibreLogin. It is generic, accepting platform type `P` and server type `S`. ```APIDOC ## EventProvider ### Description Provides access to the event system, allowing for the dispatching and handling of various events within LibreLogin. It is generic, accepting platform type `P` and server type `S`. ### Java Signature `public interface EventProvider` ### Parameters - **P** (Type Parameter): Represents the platform-specific type. - **S** (Type Parameter): Represents the server-specific type. ### Documentation Features - Full Java signature with generic types - Parameter documentation table - Return type specification - Exceptions thrown - Behavioral notes and constraints - Multiple usage examples - Integration patterns - Common error scenarios - Source file location ``` -------------------------------- ### Get Event Provider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Retrieves the EventProvider for subscribing to and triggering LibreLogin events. ```java EventProvider getEventProvider() ``` -------------------------------- ### Server Selection Logic Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/README.md Determine the appropriate limbo and lobby servers for a player based on user and player data, and then move the player to the selected lobby server. This is crucial for managing player connections. ```java Server limbo = plugin.getServerHandler().chooseLimboServer(user, player); Server lobby = plugin.getServerHandler().chooseLobbyServer(user, player, true, true); plugin.getPlatformHandle().movePlayer(player, lobby); ``` -------------------------------- ### Get Player IP Address Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Retrieves the IP address associated with a player. ```java String ip = platform.getIP(player); ``` -------------------------------- ### Get Player UUID Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Retrieves the unique identifier (UUID) for a given player. ```java // Get player info UUID uuid = platform.getUUIDForPlayer(player); ``` -------------------------------- ### Accessing LibreLogin on Velocity Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-provider.md Illustrates how to obtain the LibreLoginProvider using Velocity's service manager and subsequently access the plugin instance. ```java // Using Velocity's service loader LibreLoginProvider provider = proxyServer.getServicesManager() .provide(LibreLoginProvider.class); if (provider != null) { LibreLoginPlugin plugin = provider.getLibreLogin(); plugin.getLogger().info("LibreLogin is loaded"); } ``` -------------------------------- ### getDataFolder Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Gets the plugin's data folder where configuration and data files are stored. ```APIDOC ## getDataFolder ### Description Gets the plugin's data folder where configuration and data files are stored. ### Method File ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (File) - **File** - the plugin data directory ### Throws None ``` -------------------------------- ### Get Database Provider Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/librelogin-plugin.md Retrieves the ReadWriteDatabaseProvider for performing database read and write operations. ```java ReadWriteDatabaseProvider getDatabaseProvider() ``` -------------------------------- ### Get Algorithm Identifier Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/crypto-provider.md Retrieves the unique identifier for the hashing algorithm implemented by this provider. ```java String getIdentifier() ``` -------------------------------- ### Connect to Database Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/database-connector.md Instantiates and connects to a MySQL database using the DatabaseConnector. Requires SQLException and Connection types. ```java DatabaseConnector connector = new MySQLDatabaseConnector(/* config */); try { connector.connect(); plugin.getLogger().info("Connected to database"); } catch (SQLException e) { plugin.getLogger().error("Failed to connect: " + e.getMessage()); } ``` -------------------------------- ### Get Connected Players Count Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/api-reference/platform-handle.md Retrieves the number of players currently connected to a specific server. ```java int getConnectedPlayers(S server) ``` -------------------------------- ### Choose Limbo Server Source: https://github.com/kyngs/librelogin/blob/master/_autodocs/QUICK_REFERENCE.md Selects an appropriate limbo server for a user and player. ```java // Choose server Server limbo = plugin.getServerHandler().chooseLimboServer(user, player); ```