### Start Standalone JAR Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md Execute this command to start the standalone JAR file. Ensure Java is installed on your system. ```bash java -jar MCXboxBroadcastStandalone.jar ``` -------------------------------- ### Standalone Configuration Example Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt This is a standalone configuration example for MCXboxBroadcast. Update interval for session queries must be at least 20 seconds due to Xbox rate limits. It supports querying the Bedrock server for MOTD sync and can fall back to web query or config values if the query fails. ```yaml session: # Update interval in seconds (minimum 20 due to Xbox rate limits) updateInterval: 30 # Query the bedrock server for MOTD sync queryServer: true # Use Geyser web query as fallback webQueryFallback: false # Fall back to config values if query fails configFallback: false # Default session information sessionInfo: hostName: "My Minecraft Server" worldName: "Survival World" players: 0 maxPlayers: 20 ip: "play.myserver.com" port: 19132 friendSync: # Sync interval in seconds updateInterval: 60 # Auto-follow users who follow us autoFollow: true # Auto-unfollow users who unfollow us autoUnfollow: true # Send game invite when adding a friend initialInvite: true # Friend expiry settings expiry: enabled: true days: 15 # Remove friends inactive for 15 days check: 1800 # Check every 30 minutes notifications: enabled: true # Discord webhook (add /slack to the end) webhookUrl: "https://discord.com/api/webhooks/123/abc/slack" sessionExpiredMessage: " Xbox Session expired! Sign in: %s Code: %s" friendRestrictionMessage: "%s (%s) has restrictions preventing friendship." debugMode: false suppressSessionUpdateMessage: false ``` -------------------------------- ### Standalone Deployment Installation and Execution Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt This bash script demonstrates how to download the latest release of MCXboxBroadcast Standalone JAR file using `curl` and then run the application using `java -jar`. ```bash # Download the latest release curl -L -o MCXboxBroadcastStandalone.jar \ https://github.com/MCXboxBroadcast/Broadcaster/releases/latest/download/MCXboxBroadcastStandalone.jar # Run the standalone application java -jar MCXboxBroadcastStandalone.jar ``` -------------------------------- ### Download and Install Geyser Extension Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt Download the Geyser extension JAR file using curl and move it to the Geyser extensions folder. Restart the server for the extension to auto-configure. Authentication prompts will appear in the console on the first run. ```bash curl -L -o MCXboxBroadcastExtension.jar \ https://github.com/MCXboxBroadcast/Broadcaster/releases/latest/download/MCXboxBroadcastExtension.jar mv MCXboxBroadcastExtension.jar plugins/Geyser-Spigot/extensions/ ``` -------------------------------- ### Geyser Extension Configuration Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt Example configuration file for the MCXboxBroadcast Geyser extension. Customize session details, friend synchronization settings, and notification preferences. ```yaml session: # "auto" uses Geyser's configured address remoteAddress: "auto" # "auto" uses Geyser's configured port remotePort: "auto" updateInterval: 30 friendSync: updateInterval: 60 autoFollow: true autoUnfollow: true initialInvite: true expiry: enabled: true days: 15 check: 1800 notifications: enabled: false webhookUrl: "" ``` -------------------------------- ### Initialize and Manage Xbox Live Session Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt Use SessionManager to create, initialize, and periodically update an Xbox Live session for a Minecraft server. Requires setup of storage and notification managers. The first initialization will prompt for Xbox Live authentication via a web browser. ```java import com.rtm516.mcxboxbroadcast.core.SessionManager; import com.rtm516.mcxboxbroadcast.core.SessionInfo; import com.rtm516.mcxboxbroadcast.core.configs.CoreConfig; import com.rtm516.mcxboxbroadcast.core.storage.FileStorageManager; import com.rtm516.mcxboxbroadcast.core.notifications.SlackNotificationManager; import com.rtm516.mcxboxbroadcast.core.exceptions.SessionCreationException; import com.rtm516.mcxboxbroadcast.core.exceptions.SessionUpdateException; import java.util.concurrent.TimeUnit; // Create storage and notification managers FileStorageManager storageManager = new FileStorageManager("./cache", "./screenshot.jpg"); SlackNotificationManager notificationManager = new SlackNotificationManager(logger, config.notifications()); // Create the session manager SessionManager sessionManager = new SessionManager(storageManager, notificationManager, logger); // Configure session information SessionInfo sessionInfo = new SessionInfo(); sessionInfo.setHostName("My Minecraft Server"); sessionInfo.setWorldName("Survival World"); sessionInfo.setIp("play.myserver.com"); sessionInfo.setPort(19132); sessionInfo.setPlayers(5); sessionInfo.setMaxPlayers(20); // Initialize the session (triggers Xbox Live authentication) // First run will display: "To sign in, use a web browser to open the page // https://www.microsoft.com/link and enter the code XXXXXXXX to authenticate." try { boolean initialized = sessionManager.init(sessionInfo, config.friendSync()); if (initialized) { System.out.println("Session created successfully!"); System.out.println("Gamertag: " + sessionManager.getGamertag()); } } catch (SessionCreationException | SessionUpdateException e) { System.err.println("Failed to create session: " + e.getMessage()); } // Set up periodic session updates sessionManager.scheduledThread().scheduleWithFixedDelay(() -> { try { sessionManager.updateSession(sessionInfo); System.out.println("Updated session!"); } catch (SessionUpdateException e) { System.err.println("Failed to update session: " + e.getMessage()); } }, 30, 30, TimeUnit.SECONDS); // Set restart callback for automatic recovery sessionManager.restartCallback(() -> { System.out.println("Restarting session..."); // Handle restart logic }); // Clean shutdown Runtime.getRuntime().addShutdownHook(new Thread(() -> { sessionManager.shutdown(); })); ``` -------------------------------- ### Loading and Accessing Configuration Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt This Java snippet demonstrates how to load configuration from a 'config.yml' file using `ConfigLoader`. It shows how to access various configuration values related to session, friend synchronization, and notifications. ```java import com.rtm516.mcxboxbroadcast.core.configs.ConfigLoader; import com.rtm516.mcxboxbroadcast.core.configs.CoreConfig; // Load configuration from file File configFile = new File("config.yml"); CoreConfig config = ConfigLoader.loadConfig(configFile, "Standalone"); // or "Extension" // Access configuration values int updateInterval = config.session().updateInterval(); boolean autoFollow = config.friendSync().autoFollow(); boolean notificationsEnabled = config.notifications().enabled(); // Session info from config String serverIp = config.session().sessionInfo().ip(); int serverPort = config.session().sessionInfo().port(); ``` -------------------------------- ### Create and Manage SessionInfo Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt Demonstrates creating SessionInfo objects from configuration or manually, updating fields, and retrieving protocol information. Color codes are automatically stripped from text fields. ```java import com.rtm516.mcxboxbroadcast.core.SessionInfo; import com.rtm516.mcxboxbroadcast.core.configs.CoreConfig; // Create SessionInfo from configuration SessionInfo sessionInfo = new SessionInfo(config.session().sessionInfo()); // Or create manually with all parameters SessionInfo sessionInfo = new SessionInfo( "My Server", // hostName - displayed as server name "Adventure World", // worldName - displayed as world name 10, // players - current player count 100, // maxPlayers - maximum players "play.example.com", // ip - server IP address 19132 // port - server port ); // Update individual fields (color codes are auto-stripped) sessionInfo.setHostName("§aColorful §bServer §cName"); // Becomes "Colorful Server Name" sessionInfo.setWorldName("My World"); sessionInfo.setPlayers(15); sessionInfo.setMaxPlayers(50); sessionInfo.setIp("192.168.1.100"); sessionInfo.setPort(19132); // Get protocol information (auto-detected from Bedrock codec) String version = sessionInfo.getVersion(); // e.g., "1.21.70" int protocol = sessionInfo.getProtocol(); // e.g., 944 // Create a copy for modifications SessionInfo copy = sessionInfo.copy(); ``` -------------------------------- ### Run Standalone Docker Image Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md Use this command to run the standalone version of MCXboxBroadcast using Docker. Mount a volume for configuration files. ```bash docker run --rm -it -v /path/to/config:/opt/app/config ghcr.io/mcxboxbroadcast/standalone:latest ``` -------------------------------- ### List Accounts Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md Lists all accounts currently in use by MCXboxBroadcast and their follower counts. Use the appropriate prefix for the extension version. ```bash accounts list ``` -------------------------------- ### Run Standalone Docker Container Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt Use this command to run the standalone MCXboxBroadcast Docker container. Mount a configuration directory to persist settings. The first run will prompt for Xbox Live authentication. ```bash docker run --rm -it \ -v /path/to/config:/opt/app/config \ ghcr.io/mcxboxbroadcast/standalone:latest ``` -------------------------------- ### Managing Multiple Xbox Accounts with Sub-Sessions Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt This Java code illustrates how to manage multiple Xbox accounts using sub-sessions in MCXboxBroadcast, which is useful for overcoming the 2000 friend limit. It covers listing active sessions, adding new sub-sessions (which prompts for authentication), removing sub-sessions, and dumping session data for debugging. ```java // List all active sessions and their status sessionManager.listSessions(); // Output: // Primary Session: // - Gamertag: MainAccount // Following: 1500/2000 // Sub-sessions: (2) // - ID: sub1 // Gamertag: AltAccount1 // Following: 1200/2000 // - ID: sub2 // Gamertag: AltAccount2 // Following: 800/2000 // Add a new sub-session (will prompt for authentication) sessionManager.addSubSession("sub3"); // Output: "To sign in, use a web browser to open the page // https://www.microsoft.com/link and enter the code YYYYYYYY" // Remove a sub-session sessionManager.removeSubSession("sub1"); // Dump session data for debugging sessionManager.dumpSession(); // Creates: lastSessionResponse.json, currentSessionResponse.json ``` -------------------------------- ### Add Account Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md Adds a new account to MCXboxBroadcast using its sub-session ID. For the extension version, prefix the command with /mcxboxbroadcast. ```bash accounts add ``` -------------------------------- ### Restart MCXboxBroadcast Tool Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md This command restarts the MCXboxBroadcast tool. It is available in both standalone and extension modes. ```bash restart ``` -------------------------------- ### FileStorageManager for Data Persistence Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt This Java code demonstrates the use of `FileStorageManager` for persisting data such as authentication tokens, sub-session data, and player history using SQLite. It shows how to initialize the manager, access player history for tracking friend activity and expiry, manage sub-session storage, and handle custom profile images. ```java import com.rtm516.mcxboxbroadcast.core.storage.FileStorageManager; import com.rtm516.mcxboxbroadcast.core.storage.StorageManager; // Create storage manager with cache folder and screenshot path FileStorageManager storageManager = new FileStorageManager( "./cache", // Cache folder for auth tokens and data "./screenshot.jpg" // Custom profile image path ); // Access player history for friend expiry tracking StorageManager.PlayerHistoryStorage playerHistory = storageManager.playerHistory(); // Record when a player was last seen playerHistory.lastSeen("2535428745123456", Instant.now()); // Get last seen time for a player Instant lastSeen = playerHistory.lastSeen("2535428745123456"); if (lastSeen != null) { System.out.println("Last seen: " + lastSeen); } // Get all player history Map allHistory = playerHistory.all(); for (Map.Entry entry : allHistory.entrySet()) { System.out.println("XUID: " + entry.getKey() + " Last seen: " + entry.getValue()); } // Clear player from history (when unfriending) playerHistory.clear("2535428745123456"); // Get sub-session storage StorageManager subStorage = storageManager.subSession("sub1"); // Get screenshot file for custom profile image File screenshot = storageManager.screenshot(); // Place a 1200x675 JPEG at this path for custom Xbox profile image // Cleanup all cached data storageManager.cleanup(); ``` -------------------------------- ### Exit Standalone Program Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md This command is only available in the standalone version of MCXboxBroadcast and is used to exit the program. ```bash exit ``` -------------------------------- ### Initialize Slack Notification Manager Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt Java code snippet for initializing the Slack notification manager. This manager is used to send alerts for events like session expiration or friend restrictions. For Discord, append '/slack' to the webhook URL. ```java import com.rtm516.mcxboxbroadcast.core.notifications.SlackNotificationManager; import com.rtm516.mcxboxbroadcast.core.notifications.NotificationManager; // Create notification manager SlackNotificationManager notificationManager = new SlackNotificationManager(logger, config.notifications()); // Notifications are sent automatically by the system: // - Session expired: Includes login URL and code // - Friend restriction: When a user has privacy settings preventing friendship // For Discord, append /slack to webhook URL: // webhookUrl: "https://discord.com/api/webhooks/123456/abcdef/slack" ``` -------------------------------- ### Dump Session Data Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md Dumps the current session data to files, which is useful for debugging purposes. ```bash dumpsession ``` -------------------------------- ### Remove Account Source: https://github.com/mcxboxbroadcast/broadcaster/blob/master/README.md Removes an account from MCXboxBroadcast using its sub-session ID. For the extension version, prefix the command with /mcxboxbroadcast. ```bash accounts remove ``` -------------------------------- ### Manage Xbox Live Friends Source: https://context7.com/mcxboxbroadcast/broadcaster/llms.txt Provides functionality for adding, removing, and managing Xbox Live friends, including sending invites and accepting requests. Includes rate limiting and retry logic. ```java import com.rtm516.mcxboxbroadcast.core.FriendManager; import com.rtm516.mcxboxbroadcast.core.models.session.FollowerResponse; import com.rtm516.mcxboxbroadcast.core.exceptions.XboxFriendsException; // FriendManager is accessed through SessionManager FriendManager friendManager = sessionManager.friendManager(); // Initialize with friend sync configuration friendManager.init(config.friendSync()); // Get all friends and followers try { List friends = friendManager.get(); for (FollowerResponse.Person friend : friends) { System.out.println("Friend: " + friend.gamertag + " (XUID: " + friend.xuid + ")"); System.out.println(" Following us: " + friend.isFollowingCaller); System.out.println(" We follow them: " + friend.isFollowedByCaller); } } catch (XboxFriendsException e) { System.err.println("Failed to get friends: " + e.getMessage()); } // Add a friend by XUID friendManager.add("2535428745123456", "PlayerGamertag"); // Add friend only if not already friends (checks status first) boolean added = friendManager.addIfRequired("2535428745123456", "PlayerGamertag"); if (added) { System.out.println("Friend request sent!"); } // Remove a friend friendManager.remove("2535428745123456", "PlayerGamertag"); // Force a user to unfollow (block then unblock) try { friendManager.forceUnfollow("2535428745123456"); } catch (Exception e) { System.err.println("Failed to force unfollow: " + e.getMessage()); } // Send a game invite to a friend friendManager.sendInvite("2535428745123456"); // Get cached friend list (faster, may be stale) List cachedFriends = friendManager.lastFriendCache(); // Accept all pending friend requests friendManager.acceptPendingFriendRequests(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.