### ZenithProxy Cloud-Init Setup Script (YAML) Source: https://github.com/rfresh2/zenithproxy/wiki/DigitalOcean-Setup-Guide This YAML script is used for cloud-init initialization on a DigitalOcean Droplet. It automatically downloads the ZenithProxy launcher to the user's home directory and installs essential tools like tmux. This script is intended to be pasted into the 'Add Initialization Scripts' section during Droplet creation. ```yaml #cloud-config package_update: true packages: - tmux runcmd: - cd ~ - curl -sSL https://raw.githubusercontent.com/rfresh2/ZenithProxy/1.21.0/scripts/cloud-init.yaml | bash ``` -------------------------------- ### Start ZenithProxy Application Source: https://context7.com/rfresh2/zenithproxy/llms.txt This Java code snippet shows the main entry point for starting the ZenithProxy application. It initializes the proxy instance and begins its operation, including setting up event handlers, loading configurations, and initializing various modules and services like the TCP connection manager, database, Discord bot, plugins, and ViaVersion. ```java public static void main(String... args) { Proxy.getInstance().start(); } public void start() { initEventHandlers(); CONFIG.debug.debugLogs = true; MODULE.init(); this.tcpManager = new TcpConnectionManager(); if (CONFIG.database.enabled) { DATABASE.start(); } if (CONFIG.discord.enable) { DISCORD.start(); } if (CONFIG.plugins.enabled) { PLUGIN_MANAGER.initialize(); } if (CONFIG.client.viaversion.enabled || CONFIG.server.viaversion.enabled) { VIA_INITIALIZER.init(); } startServer(); if (CONFIG.client.autoConnect && !isConnected()) { connect(); } } ``` -------------------------------- ### Install Plugin via ZenithProxy Command Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Plugins.md Downloads and installs a plugin from a given URL using the ZenithProxy command line. Requires the plugin JAR file URL as input. ```cli plugins download plugins download https://github.com/rfresh2/ZenithProxyChatControl/releases/download/1.0.4/ZenithProxyChatControl-1.0.4.jar ``` -------------------------------- ### Launch ZenithProxy Application (Shell) Source: https://github.com/rfresh2/zenithproxy/wiki/DigitalOcean-Setup-Guide Command to execute the ZenithProxy launcher script. This script initiates the setup and launch process for the ZenithProxy application on the Droplet. Users will be prompted to select the platform (e.g., 'linux') during this process. ```shell ./launch ``` -------------------------------- ### Navigate to ZenithProxy Directory (Shell) Source: https://github.com/rfresh2/zenithproxy/wiki/DigitalOcean-Setup-Guide Command to change the current directory to the ZenithProxy installation folder. This is typically done after SSHing into the Droplet and before launching the application. ```shell cd ZenithProxy ``` -------------------------------- ### Registering and Executing Commands in Java Source: https://context7.com/rfresh2/zenithproxy/llms.txt Demonstrates the CommandManager class for initializing and executing commands. It shows how commands are parsed from string input and executed, including error handling for command syntax exceptions. The ConnectCommand example illustrates registering a command with arguments and asynchronous execution. ```java public class CommandManager { private final List commandsList = Lists.newArrayList( new ConnectCommand(), new DisconnectCommand(), new StatusCommand(), new WhitelistCommand(), new SpectatorCommand(), new AutoEatCommand(), new AutoReconnectCommand(), new KillAuraCommand(), new PathfinderCommand() // ... 80+ commands total ); // Execute command from string input public int execute(String input, CommandSource source) { try { ParseResults parseResults = dispatcher.parse(input, new CommandContext(source)); return dispatcher.execute(parseResults); } catch (CommandSyntaxException e) { source.sendError("Command error: " + e.getMessage()); return 0; } } } // Example command implementation: ConnectCommand public class ConnectCommand extends Command { @Override public void register(CommandDispatcher dispatcher) { dispatcher.register(literal("connect") .then(argument("address", string()) .then(argument("port", integer(1, 65535)) .executes(c -> { String address = getString(c, "address"); int port = getInteger(c, "port"); // Validate not already connected if (Proxy.getInstance().isConnected()) { c.getSource().sendError("Already connected! Disconnect first."); return 0; } // Update config CONFIG.client.server.address = address; CONFIG.client.server.port = port; saveConfigAsync(); // Connect asynchronously EXECUTOR.execute(() -> { try { Proxy.getInstance().connect(address, port); } catch (Exception e) { c.getSource().sendError("Failed to connect: " + e.getMessage()); } }); return 1; }) ) ) .executes(c -> { // Connect to default server if (Proxy.getInstance().isConnected()) { c.getSource().sendError("Already connected!"); return 0; } EXECUTOR.execute(Proxy.getInstance()::connect); return 1; }) ); } @Override public String getName() { return "connect"; } @Override public CommandCategory getCategory() { return CommandCategory.CORE; } } ``` -------------------------------- ### Start Proxy Server (Java) Source: https://context7.com/rfresh2/zenithproxy/llms.txt Initiates the proxy server, binding it to a specified address and port. It configures the server with a custom session factory and channel initializer for enhanced compatibility. Optional features like LAN broadcasting and UPnP port forwarding can also be enabled. ```java // Start MC server that players connect to public synchronized void startServer() { if (this.server != null && this.server.isListening()) { throw new IllegalStateException("Server already started!"); } if (!CONFIG.server.enabled) return; var address = CONFIG.server.bind.address; var port = CONFIG.server.bind.port; SERVER_LOG.info("Starting server on {}:{}...", address, port); // Create TCP server with custom session factory this.server = new TcpServer( address, port, MinecraftProtocol::new, tcpManager, (socketAddress) -> new ServerSession( socketAddress.getHostName(), socketAddress.getPort(), (MinecraftProtocol) server.createPacketProtocol(), server ) ); // Set channel initializer for ViaVersion support this.server.setGlobalFlag( MinecraftConstants.SERVER_CHANNEL_INITIALIZER, ZenithServerChannelInitializer.FACTORY ); // Start LAN broadcast if (this.lanBroadcaster == null && CONFIG.server.ping.lanBroadcast) { this.lanBroadcaster = new LanBroadcaster(); lanBroadcaster.start(); } // Add server listener this.server.addListener(new ProxyServerListener()); this.server.bind(false); // Open UPnP port forwarding if (CONFIG.server.upnp) { EXECUTOR.execute(this::openUpnp); } } // Example: Server health check scheduled task private void serverHealthCheck() { if (!CONFIG.server.enabled || !CONFIG.server.healthCheck) return; if (server != null && server.isListening()) return; SERVER_LOG.error("Server is not listening! Is another service on this port?"); this.startServer(); // Send Discord alert if server fails to start EXECUTOR.schedule(() -> { if (server == null || !server.isListening()) { var errorMessage = """ The ZenithProxy MC server was unable to start correctly. Most likely you have two or more ZenithProxy instance running on the same configured port: %s. Shut down duplicate instances, or change the configured port: `serverConnection port ` """.formatted(CONFIG.server.bind.port); DISCORD.sendEmbedMessage( Embed.builder() .title("ZenithProxy Server Error") .description(errorMessage) .errorColor() ); } }, 30, TimeUnit.SECONDS); } ``` -------------------------------- ### Java: Visual Range Enter Event and Handling Source: https://context7.com/rfresh2/zenithproxy/llms.txt Demonstrates the creation of a `VisualRangeEnterEvent` record and its handling within the VisualRange module. This includes posting the event, sending Discord notifications, and conditionally starting replay recording based on configuration. It requires access to event bus, player profiles, configuration settings, and replay mod functionality. ```java public record VisualRangeEnterEvent(String playerName, UUID uuid) {} // In VisualRange module private void handlePlayerSpawn(AddPlayerEvent event) { var profile = event.profile(); if (CACHE.getPlayerCache().getEntityId() == event.entityId()) return; // Post visual range event EVENT_BUS.post(new VisualRangeEnterEvent( profile.getName(), profile.getId() )); // Send Discord notification if (CONFIG.client.extra.visualRange.enter.enabled) { boolean isFriend = PLAYER_LISTS.getFriendsList().contains(profile); if (!isFriend || !CONFIG.client.extra.visualRange.ignoreFriends) { DISCORD.sendEmbedMessage(Embed.builder() .title("Player Entered Visual Range") .description(profile.getName()) .addField("UUID", profile.getId().toString()) .color(isFriend ? CONFIG.theme.success.hex() : CONFIG.theme.error.hex()) .mention(CONFIG.client.extra.visualRange.enter.mention) ); } } // Auto-start replay recording if (CONFIG.client.extra.visualRange.replayRecording.enabled) { boolean shouldRecord = switch ( CONFIG.client.extra.visualRange.replayRecording.mode) { case ENEMY -> !PLAYER_LISTS.getFriendsList().contains(profile); case ALL -> true; }; if (shouldRecord && !MODULE.get(ReplayMod.class).isRecording()) { MODULE.get(ReplayMod.class).startRecording(); } } } ``` -------------------------------- ### Example AutoEat Module (Java) Source: https://context7.com/rfresh2/zenithproxy/llms.txt This Java snippet demonstrates an `AutoEat` module that extends the base `Module` class. It automatically eats food when the player's health or hunger falls below configured thresholds. It handles finding food, using items, and managing the eating state, subscribing to relevant game events. ```java // AutoEat automatically eats food when health/hunger is low public class AutoEat extends Module { private boolean eating = false; @Override protected boolean shouldBeEnabled() { return CONFIG.client.extra.autoEat.enabled; } @Override protected void subscribeEvents() { EVENT_BUS.subscribe(this, of(SetHealthEvent.class, this::handleHealthUpdate), of(StartConfigurationEvent.class, e -> eating = false) ); } private void handleHealthUpdate(SetHealthEvent event) { if (!Proxy.getInstance().isConnected()) return; float health = event.health(); int food = event.food(); // Check if should eat if (health <= CONFIG.client.extra.autoEat.healthThreshold || food <= CONFIG.client.extra.autoEat.hungerThreshold) { if (!eating) { startEating(); } } else if (eating) { stopEating(); } } private void startEating() { // Find food in inventory var foodSlot = findBestFood(); if (foodSlot == -1) { if (CONFIG.client.extra.autoEat.warning) { DISCORD.sendEmbedMessage(Embed.builder() .title("AutoEat Warning") .description("No food found in inventory!") .errorColor()); } return; } eating = true; // Switch to food slot CLIENT.send(new ServerboundSetCarriedItemPacket(foodSlot)); // Start using item (eating) CLIENT.send(new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, CACHE.getPlayerCache().getActionId().incrementAndGet())); // Schedule stop eating after 1.6 seconds EXECUTOR.schedule(this::stopEating, 1600, TimeUnit.MILLISECONDS); } private void stopEating() { if (!eating) return; eating = false; // Release use item CLIENT.send(new ServerboundPlayerActionPacket( PlayerAction.RELEASE_USE_ITEM, BlockPos.ZERO, Direction.DOWN, CACHE.getPlayerCache().getActionId().incrementAndGet() )); } private int findBestFood() { var inventory = CACHE.getPlayerCache().getInventory(); int bestSlot = -1; int bestNutrition = 0; for (int i = 0; i < 9; i++) { ItemStack item = inventory.getItem(i); if (item == null) continue; var foodProperties = getFoodProperties(item); if (foodProperties == null) continue; if (!CONFIG.client.extra.autoEat.allowUnsafeFood && isUnsafeFood(item)) continue; if (foodProperties.nutrition > bestNutrition) { bestNutrition = foodProperties.nutrition; bestSlot = i; } } return bestSlot; } } ``` -------------------------------- ### Start tmux Session (Shell) Source: https://github.com/rfresh2/zenithproxy/wiki/DigitalOcean-Setup-Guide Command to start a new tmux session. Tmux is a terminal multiplexer that allows users to create, manage, and switch between multiple terminal sessions within a single window. This is often used to keep processes running even after disconnecting from SSH. ```shell tmux ``` -------------------------------- ### Discord Bot Setup and Message Handling in Java Source: https://context7.com/rfresh2/zenithproxy/llms.txt The `DiscordBot` class manages the bot's connection to Discord, channel configurations, and message event handling. It uses the JDA library to interact with Discord. The `MessageListener` inner class processes incoming messages, checks for command prefixes and user permissions before executing commands. Dependencies include JDA and configuration settings from `CONFIG`. ```java // DiscordBot manages Discord integration public class DiscordBot { private JDA jda; private TextChannel managementChannel; private TextChannel relayChannel; public void start() { if (!CONFIG.discord.enable) return; // Build JDA instance jda = JDABuilder.createDefault(CONFIG.discord.token) .setActivity(Activity.playing("ZenithProxy")) .enableIntents( GatewayIntent.GUILD_MESSAGES, GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MEMBERS ) .addEventListeners(new MessageListener()) .build() .awaitReady(); // Get channels managementChannel = jda.getTextChannelById(CONFIG.discord.channelId); relayChannel = jda.getTextChannelById(CONFIG.discord.relayChannelId); DISCORD_LOG.info("Discord bot connected as {}", jda.getSelfUser().getName()); // Send startup message sendEmbedMessage(Embed.builder() .title("ZenithProxy Started") .description("Bot is online and ready for commands") .successColor() ); } // Send embed message to management channel public void sendEmbedMessage(Embed embed) { if (managementChannel == null) return; var embedBuilder = new EmbedBuilder() .setTitle(embed.title()) .setDescription(embed.description()) .setColor(Color.decode(embed.color())); // Add fields for (var field : embed.fields()) { embedBuilder.addField(field.name(), field.value(), field.inline()); } // Build message var messageBuilder = new MessageCreateBuilder() .setEmbeds(embedBuilder.build()); // Add mention if requested if (embed.mention() && CONFIG.discord.roleId != null) { messageBuilder.setContent("<@&" + CONFIG.discord.roleId + ">"); } managementChannel.sendMessage(messageBuilder.build()).queue(); } // Update bot presence with current status public void updatePresence() { if (jda == null) return; String status; ActivityType activityType; if (Proxy.getInstance().isConnected()) { if (Proxy.getInstance().isInQueue()) { status = "Queue: " + Proxy.getInstance().getQueuePosition(); activityType = ActivityType.WATCHING; } else { status = "Online for " + Proxy.getInstance().getOnlineTimeString(); activityType = ActivityType.PLAYING; } } else { status = "Offline"; activityType = ActivityType.WATCHING; } jda.getPresence().setActivity(Activity.of(activityType, status)); } } // Message listener for Discord commands private class MessageListener extends ListenerAdapter { @Override public void onMessageReceived(MessageReceivedEvent event) { // Ignore bots if (event.getAuthor().isBot()) return; // Check if in management channel if (!event.getChannel().getId().equals(CONFIG.discord.channelId)) return; String content = event.getMessage().getContentDisplay(); // Check for command prefix if (!content.startsWith(CONFIG.discord.commandPrefix)) return; // Check permissions Member member = event.getMember(); if (member == null) return; boolean hasRole = member.getRoles().stream() .anyMatch(role -> role.getId().equals(CONFIG.discord.roleId)); if (!hasRole) { event.getMessage().reply("You don't have permission to use commands!").queue(); return; } // Execute command String command = content.substring(CONFIG.discord.commandPrefix.length()); var source = new DiscordCommandSource(event.getMessage()); try { COMMAND.execute(command, source); } catch (Exception e) { source.sendError("Command failed: " + e.getMessage()); } } } ``` -------------------------------- ### Command Execution Sources in Java Source: https://context7.com/rfresh2/zenithproxy/llms.txt Illustrates different implementations of the CommandSource abstract class for handling commands from various interfaces, including Terminal, Discord, and in-game players. Each source provides specific methods for sending messages and errors, tailored to its environment. An example shows how a Discord bot message handler processes incoming commands. ```java // Terminal command execution public class TerminalCommandSource extends CommandSource { @Override public void sendMessage(String message) { DEFAULT_LOG.info(message); } @Override public void sendError(String message) { DEFAULT_LOG.error(message); } } // Discord command execution public class DiscordCommandSource extends CommandSource { private final Message discordMessage; @Override public void sendMessage(String message) { discordMessage.reply(message).queue(); } @Override public void sendEmbed(Embed embed) { var embedBuilder = new EmbedBuilder() .setTitle(embed.title()) .setDescription(embed.description()) .setColor(embed.color()); discordMessage.reply(embedBuilder.build()).queue(); } } // In-game command execution public class PlayerCommandSource extends CommandSource { private final ServerSession session; @Override public void sendMessage(String message) { session.sendAsyncMessage(Component.text(message)); } } // Example: Processing command from Discord // In DiscordBot message handler private void handleCommand(MessageReceivedEvent event) { String content = event.getMessage().getContentDisplay(); // Check for command prefix if (!content.startsWith(CONFIG.discord.commandPrefix)) return; String command = content.substring(CONFIG.discord.commandPrefix.length()); var source = new DiscordCommandSource(event.getMessage()); var context = new CommandContext(source); // Execute command COMMAND.execute(command, source); } ``` -------------------------------- ### Perform Player Respawn Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Executes a respawn action for the player in the game. This command simulates the player respawning after death or at the start of a new game. ```plaintext respawn ``` -------------------------------- ### Get Player Stats on 2b2t Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Fetches a player's statistics on the 2b2t server via the https://api.2b2t.vc API. The command requires the player's name as input. ```command stats ``` -------------------------------- ### Get Player Playtime on 2b2t Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Retrieves a player's total playtime on the 2b2t server using the https://api.2b2t.vc/ API. Requires the player's name as an argument. ```command playtime ``` -------------------------------- ### Remove Plugin via ZenithProxy Command Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Plugins.md Removes an installed plugin using its unique ID via the ZenithProxy command line. Requires the plugin ID as input. ```cli plugins remove plugins remove chat-control ``` -------------------------------- ### Configure Automatic Replay Recording Health Threshold Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Sets the health threshold for the 'health' mode of automatic replay recording. When player health drops to or below this integer value, recording will automatically start. ```plaintext replay autoRecord health ``` -------------------------------- ### Get Player's First and Last Seen Times on 2b2t Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Retrieves the first and last recorded times a player was seen on the 2b2t server using the https://api.2b2t.vc API. Requires the player's name as an argument. ```command seen ``` -------------------------------- ### Control Replay Recording and Uploads Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Manages ReplayMod recordings, including starting, stopping, and uploading replays to Discord or file.io. It allows setting a maximum recording time and configuring automatic recording modes. Note that recordings are stopped on disconnects regardless of the max recording time. ```plaintext replay start replay stop replay discordUpload on/off replay fileIoUpload on/off replay maxRecordingTime replay autoRecord mode replay autoRecord health replay featureFlags on/off ``` -------------------------------- ### Requeue to Minecraft Server Queue Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Cancels KeepAlive packets to force a disconnection from the Minecraft server, effectively placing the player at the start of the queue. This is useful for resetting player state without a full client reconnect. ```plaintext requeue ``` -------------------------------- ### Get 2b2t Queue Status Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Fetches the current 2b2t queue length and estimated wait time (ETA). The command can refresh the status manually, set a refresh interval, toggle ETA display, and configure automatic refreshing when not on 2b2t. ```command queueStatus queueStatus refresh queueStatus refresh interval queueStatus refresh eta on/off queueStatus refresh whileNotOn2b2t on/off ``` -------------------------------- ### Manage ZenithProxy Plugins (BETA) Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Controls the ZenithProxy plugin manager, supporting user-created add-ons. Plugins are only available on the 'java' release channel. Commands include enabling/disabling, listing, downloading from a URL, and removing plugins. ```Bash plugins on/off plugins list plugins download plugins remove ``` -------------------------------- ### ZenithProxy Core Commands (In-game) Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Provides the basic commands for interacting with ZenithProxy in-game. These commands cover essential functions like connecting, disconnecting, checking status, and managing updates, using '/' or '!' as a prefix. ```text /help /connect /disconnect /spectator on/off /spectator whitelist add/del /spectator whitelist list /spectator entity list /spectator chat on/off /status /update ``` -------------------------------- ### Configure JVM Arguments for ZenithProxy Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages the JVM arguments used by the ZenithProxy launcher. Key arguments include setting the maximum heap size (-Xmx). Default heap sizes vary by release channel (java: 300M, linux: 200M). Caution is advised as incorrect settings can prevent restarts. ```Bash jvmArgs reset jvmArgs get jvmArgs setXmx jvmArgs set ``` -------------------------------- ### Load and Save Configuration in Java Source: https://context7.com/rfresh2/zenithproxy/llms.txt Handles loading application configuration from 'config.json' on startup and saving it. If the file doesn't exist, a default configuration is created. Asynchronous saving is supported to prevent blocking the main thread. Dependencies include Gson for JSON processing and standard Java IO/NIO. ```java import java.nio.file.Files; import java.nio.file.Path; import java.io.Reader; import java.io.Writer; // Configuration management in Globals class public class Globals { public static final Config CONFIG = loadConfig(); private static Config loadConfig() { Path configPath = Path.of("config.json"); if (!Files.exists(configPath)) { // Create default config Config defaultConfig = new Config(); saveConfig(defaultConfig); return defaultConfig; } try (Reader reader = Files.newBufferedReader(configPath)) { return GSON.fromJson(reader, Config.class); } catch (Exception e) { DEFAULT_LOG.error("Failed to load config, using defaults", e); return new Config(); } } public static void saveConfig() { try (Writer writer = Files.newBufferedWriter(Path.of("config.json"))) { GSON.toJson(CONFIG, writer); } catch (Exception e) { DEFAULT_LOG.error("Failed to save config", e); } } public static void saveConfigAsync() { EXECUTOR.execute(Globals::saveConfig); } } // Config structure with nested classes public final class Config { public final Authentication authentication = new Authentication(); public final Client client = new Client(); public final Server server = new Server(); public final Discord discord = new Discord(); public static final class Authentication { public AccountType accountType = AccountType.DEVICE_CODE; public String email = "not@set.com"; public String password = "abc123"; public String username = "Unknown"; public boolean prio = false; public enum AccountType { MSA, DEVICE_CODE, DEVICE_CODE_WITHOUT_DEVICE_TOKEN, PRISM, OFFLINE } } public static final class Client { public final Server server = new Server(); public boolean autoConnect = false; public String bindAddress = "0.0.0.0"; public final Extra extra = new Extra(); public static final class Server { public String address = "connect.2b2t.org"; public int port = 25565; } public static final class Extra { public final AutoEat autoEat = new AutoEat(); public final KillAura killAura = new KillAura(); public static final class AutoEat { public boolean enabled = false; public int healthThreshold = 10; public int hungerThreshold = 6; public boolean warning = true; } } } public static final class Server { public boolean enabled = true; public final Bind bind = new Bind(); public final Spectator spectator = new Spectator(); public static final class Bind { public String address = "0.0.0.0"; public int port = 25565; } public String getProxyAddress() { return proxyIP != null ? proxyIP : bind.address + ":" + bind.port; } private String proxyIP = null; } public static final class Discord { public boolean enable = false; public String token = ""; public String channelId = ""; public String relayChannelId = ""; public String roleId = ""; public String commandPrefix = "."; public final ChatRelay chatRelay = new ChatRelay(); public static final class ChatRelay { public boolean enabled = false; public boolean publicChat = true; public boolean whispers = true; public boolean deathMessages = true; public boolean connectionMessages = false; public boolean whisperMentions = true; } } } ``` -------------------------------- ### Display Software License Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Shows the software license and outlines the user's legal rights concerning the software. This command is purely informational and does not require any arguments. ```command license ``` -------------------------------- ### ZenithProxy Core Commands (Terminal) Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Provides the basic commands for interacting with ZenithProxy in a terminal environment. These commands cover essential functions like connecting, disconnecting, checking status, and managing updates. ```text help connect disconnect spectator on/off spectator whitelist add/del spectator whitelist list spectator entity list spectator chat on/off status update ``` -------------------------------- ### ZenithProxy Account and Server Management Commands Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/FAQ.md These are basic commands for managing ZenithProxy connections. 'disconnect' and 'auth clear' are used to log out or clear authentication tokens. 'connect' is used to establish a connection. 'server
' is used to specify the Minecraft server ZenithProxy should connect to. ```bash disconnect auth clear connect server
``` -------------------------------- ### ZenithProxy Core Commands (Discord) Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Provides the basic commands for interacting with ZenithProxy via Discord. These commands cover essential functions like connecting, disconnecting, checking status, and managing updates, using '.' as a prefix. ```text .help .connect .disconnect .spectator on/off .spectator whitelist add/del .spectator whitelist list .spectator entity list .spectator chat on/off .status .update ``` -------------------------------- ### Register and Switch Minecraft Servers Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages connections to alternate Minecraft servers. Servers must have transfers enabled and be on MC version 1.20.6 or higher. Commands include registering new servers, listing registered servers, and switching to a specific server. ```plaintext switch switch register
switch list switch ``` -------------------------------- ### Configure Command Settings Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Configures ZenithProxy command prefixes and operational settings for Discord and in-game commands. Includes options for setting Discord prefixes, enabling/disabling in-game commands, managing slash commands, and controlling access for account owner commands. ```bash commandConfig discord prefix commandConfig ingame on/off commandConfig ingame slashCommands on/off commandConfig ingame slashCommands replaceServerCommands on/off commandConfig ingame slashCommands suggestions on/off commandConfig ingame prefix commandConfig ingame allowWhitelistedToUseAccountOwnerCommands on/off ``` -------------------------------- ### Configure Unsupported ZenithProxy Security Settings Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages potentially critical and unsupported security settings for ZenithProxy, such as whitelist, spectator whitelist, offline player authentication, and offline username configuration. Modifications to these settings are strongly discouraged and may void user support. ```Bash unsupported whitelist on/off unsupported spectatorWhitelist on/off unsupported allowOfflinePlayers on/off unsupported auth type offline unsupported auth offlineUsername ``` -------------------------------- ### Configure Pearl Loader (ZenithProxy) Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Manages the loading of player's pearls by interacting with specific blocks like levers or buttons. Requires positions to be unobstructed and reachable. Supports adding, deleting, loading pearls by ID, and listing configured positions. ```Shell pearlLoader add pearlLoader del pearlLoader load pearlLoader list pearlLoader returnToStartPos on/off ``` -------------------------------- ### Display Help Information (ZenithProxy) Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Displays the list of available ZenithProxy commands or specific help for a category or command. Aliases include 'h'. ```plaintext help ``` ```plaintext help ``` ```plaintext help ``` -------------------------------- ### Module Registration and Management (Java) Source: https://context7.com/rfresh2/zenithproxy/llms.txt This snippet defines the `ModuleManager` and base `Module` classes. `ModuleManager` handles the initialization and retrieval of automation modules. The `Module` class provides a framework for enabling, disabling, and synchronizing module states with configuration, including event subscriptions and lifecycle methods. ```java import java.util.Arrays; // ModuleManager initializes and manages all automation modules public class ModuleManager { private final Reference2ObjectMap, Module> moduleClassMap = new Reference2ObjectOpenHashMap<>(); public void init() { asList( new ActionLimiter(), new ActiveHours(), new AntiAFK(), new AntiKick(), new AutoDisconnect(), new AutoEat(), new AutoReconnect(), new AutoRespawn(), new AutoTotem(), new KillAura(), new ReplayMod(), new Spammer(), new VisualRange() // ... 25+ modules total ).forEach(m -> { addModule(m); m.syncEnabledFromConfig(); }); } private void addModule(Module module) { moduleClassMap.put(module.getClass(), module); } public T get(final Class clazz) { return (T) moduleClassMap.get(clazz); } } // Base Module interface abstract class Module { protected boolean enabled = false; // Enable module public void enable() { if (enabled) return; enabled = true; subscribeEvents(); onEnable(); } // Disable module public void disable() { if (!enabled) return; enabled = false; unsubscribeEvents(); onDisable(); } // Sync with config public void syncEnabledFromConfig() { if (shouldBeEnabled()) { enable(); } else { disable(); } } protected abstract boolean shouldBeEnabled(); protected abstract void subscribeEvents(); protected abstract void unsubscribeEvents(); protected void onEnable() {} protected void onDisable() {} } ``` -------------------------------- ### Manage Whitelist (ZenithProxy) Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages the list of players allowed to login to ZenithProxy. This includes adding, deleting, listing, and clearing players from the whitelist and blacklist. Aliases include 'wl'. ```plaintext whitelist add/del ``` ```plaintext whitelist addAll ,... ``` ```plaintext whitelist list ``` ```plaintext whitelist clear ``` ```plaintext whitelist autoAddZenithAccount on/off ``` ```plaintext whitelist blacklist add/del ``` ```plaintext whitelist blacklist clear ``` -------------------------------- ### Start/Stop Replay Recording Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Controls the recording of gameplay using ReplayMod. Recordings can be uploaded to Discord or file.io if they are within size limits. A maxRecordingTime of 0 means no limit, but recordings stop on disconnects. ```plaintext replay start replay stop ``` -------------------------------- ### Set ZenithProxy Release Channel Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Configures the AutoUpdater release channel, which is a combination of a platform (java or linux) and a Minecraft protocol version. Available commands include listing channels and setting a new channel. ```Bash channel list channel set ``` -------------------------------- ### Configure ViaVersion Module Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Configure the integrated ViaVersion module for ZenithProxy. This module handles version compatibility between clients and servers. Usage involves enabling/disabling the module, controlling specific features like 'disableOn2b2t', and setting the target Minecraft version. ```text via zenithToServer on/off via zenithToServer disableOn2b2t on/off via zenithToServer version auto via zenithToServer version ``` ```text via playerToZenith on/off ``` -------------------------------- ### Configure VisualRange Module Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Configure the VisualRange notification feature. This module alerts users in the terminal and optionally via Discord mentions when players enter or leave a specified range. It supports replay recording with different modes (enemy/all) and configurable cooldowns. Aliases include 'vr'. ```text visualRange on/off visualRange list visualRange enter on/off visualRange enter mention on/off visualRange enter whisper on/off visualRange enter whisper message visualRange enter whisper cooldown visualRange enter whisper command visualRange leave on/off visualRange logout on/off visualRange ignoreFriends on/off ``` ```text visualRange replayRecording on/off visualRange replayRecording mode visualRange replayRecording cooldown ``` -------------------------------- ### Configure Database Module Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Configures the database module used for https://api.2b2t.vc. This module is disabled by default and is used for collecting specific in-game data. Settings include host, port, username, password for the main database and Redis, and options for enabling/disabling data collection for various features. ```bash database on/off database host database port database username database password database redis address
database redis username database redis password database queueWait on/off database queueLength on/off database publicChat on/off database joinLeave on/off database deathMessages on/off database restarts on/off database playerCount on/off database tablist on/off database playtime on/off database time on/off ``` -------------------------------- ### Login with Configured Account Type (Java) Source: https://context7.com/rfresh2/zenithproxy/llms.txt Handles the process of logging into a Minecraft server using configured account credentials. It includes retry logic for failed login attempts and caches player certificates. Dependencies include configuration settings and an authenticator service. ```java // Login with configured account type public synchronized MinecraftProtocol logIn() { if (!loggingIn.compareAndSet(false, true)) { throw new RuntimeException("Already logging in!"); } AUTH_LOG.info("Logging in {}...", CONFIG.authentication.username); MinecraftProtocol minecraftProtocol = null; // Retry up to 3 times for (int tries = 0; tries < 3; tries++) { minecraftProtocol = retrieveLoginTaskResult(loginTask()); if (minecraftProtocol != null || !loggingIn.get()) break; AUTH_LOG.warn("Failed login attempt {}", tries + 1); Wait.wait((int) (3 + (Math.random() * 7.0))); } if (!loggingIn.compareAndSet(true, false)) { throw new RuntimeException("Login Cancelled"); } if (minecraftProtocol == null) { throw new RuntimeException("Auth failed"); } var username = minecraftProtocol.getProfile().getName(); var uuid = minecraftProtocol.getProfile().getId(); // Cache player certificates CACHE.getChatCache().setPlayerCertificates( minecraftProtocol.getProfile().getPlayerCertificates() ); AUTH_LOG.info("Logged in as {} [{}].", username, uuid); // Auto-add to whitelist if (CONFIG.server.extra.whitelist.autoAddClient && CONFIG.authentication.accountType != OFFLINE) { if (PLAYER_LISTS.getWhitelist().add(username, uuid)) { SERVER_LOG.info("Auto added {} [{}] to whitelist", username, uuid); } } // Update server icon with player skin if (CONFIG.server.updateServerIcon) { EXECUTOR.execute(() -> updateServerIcon(minecraftProtocol.getProfile())); } return minecraftProtocol; } // Authenticator performs the actual auth flow public Future loginTask() { return EXECUTOR.submit(() -> { try { return Authenticator.INSTANCE.login(); } catch (final Exception e) { CLIENT_LOG.error("Login failed", e); EVENT_BUS.postAsync(new ClientLoginFailedEvent(e)); return null; } }); } ``` -------------------------------- ### Configure Debug Settings Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages debug settings for features in testing or development. Options include syncing inventory and chunks, clearing effects, packet logging (client/server, with filtering), kick/disconnect behavior, and enabling/disabling debug logs and chunk cache fullbright. ```bash debug sync inventory debug sync chunks debug clearEffects debug packetLog on/off debug packetLog client on/off debug packetLog server on/off debug packetLog filter debug kickDisconnect on/off debug dc debug debugLogs on/off debug chunkCacheFullbright on/off debug defaultClientRenderDistance debug lockFile on/off ``` -------------------------------- ### Connect ZenithProxy to Destination Server Source: https://context7.com/rfresh2/zenithproxy/llms.txt This Java code demonstrates how ZenithProxy connects to a configured destination Minecraft server. It handles connection logic, including authentication, session creation, and network configuration. The method supports connecting to specific addresses and ports, and includes options for SRV record resolution and read timeouts, crucial for stable proxy operations. ```java public synchronized void connect() { connect(CONFIG.client.server.address, CONFIG.client.server.port); } public synchronized void connect(final String address, final int port) { if (this.isConnected()) throw new IllegalStateException("Already connected!"); this.connectTime = Instant.now(); EVENT_BUS.postAsync(new ClientStartConnectEvent()); MinecraftProtocol minecraftProtocol = this.logIn(); this.client = new ClientSession( address, port, CONFIG.client.bindAddress, minecraftProtocol, getClientProxyInfo(), tcpManager ); if (Objects.equals(address, "connect.2b2t.org")) { this.client.setFlag(BuiltinFlags.ATTEMPT_SRV_RESOLVE, false); } this.client.setReadTimeout( CONFIG.client.timeout.enable ? CONFIG.client.timeout.seconds : 0 ); this.client.setFlag( MinecraftConstants.CLIENT_CHANNEL_INITIALIZER, ZenithClientChannelInitializer.FACTORY ); this.client.connect(true); Wait.waitUntil(() -> this.client.isConnected() || this.client.isDisconnected(), 30); } ``` -------------------------------- ### Configure ZenithProxy Server Connection Settings Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages various aspects of the MC server hosted by Zenith and player connections. Options include setting the proxy IP, listening port, UPnP status, server list ping details (player info, counts, icons), connection timeouts, and chat signing modes. ```Bash serverConnection proxyIP serverConnection port serverConnection upnp on/off serverConnection ping on/off serverConnection ping onlinePlayers on/off serverConnection ping onlinePlayerCount on/off serverConnection ping maxPlayers serverConnection ping lanBroadcast on/off serverConnection ping log on/off serverConnection enforceMatchingConnectingAddress on/off serverConnection timeout on/off serverConnection timeout serverConnection autoConnectOnLogin on/off serverConnection updateServerIcon on/off serverConnection chatSigning mode ``` -------------------------------- ### Configure Client Connection Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages the connection configuration from ZenithProxy to the destination Minecraft server. This includes settings for auto-connecting, proxy usage (type, host, port, authentication), bind address, timeouts, and ping modes. ```bash clientConnection autoConnect on/off clientConnection proxy on/off clientConnection proxy type clientConnection proxy host clientConnection proxy port clientConnection proxy user clientConnection proxy password clientConnection proxy auth clear clientConnection bindAddress
clientConnection timeout on/off clientConnection timeout clientConnection ping mode clientConnection ping packetInterval ``` -------------------------------- ### Configure Authentication Settings (ZenithProxy) Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Configures the proxy's authentication settings, including clearing accounts, setting login attempt limits, and managing token refresh behavior. Supports various authentication types. ```plaintext auth clear ``` ```plaintext auth attempts ``` ```plaintext auth alwaysRefreshOnLogin on/off ``` ```plaintext auth type ``` ```plaintext auth email ``` ```plaintext auth password ``` ```plaintext auth mention on/off ``` ```plaintext auth openBrowser on/off ``` ```plaintext auth maxRefreshIntervalMins ``` ```plaintext auth useClientConnectionProxy on/off ``` ```plaintext auth chatSigning on/off ``` ```plaintext auth chatSigning force on/off ``` ```plaintext auth chatSigning whispers on/off ``` -------------------------------- ### Configure Discord Bot Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages the Discord bot's configuration, including enabling/disabling the bot, setting the channel ID, token, role ID, and relay channel. Also includes options for managing profile images, nicknames, descriptions, presence, and handling non-whitelisted IPs and other bots. ```bash discord on/off discord channel discord token discord role discord relayChannel discord manageProfileImage on/off discord manageNickname on/off discord manageDescription on/off discord managePresence on/off discord showNonWhitelistIP on/off discord ignoreOtherBots on/off ``` -------------------------------- ### Configure actionLimiter settings Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages player actions and movements, with options to enable/disable various restrictions like inventory access, block breaking, and item usage. Players logged in with the proxy account are immune. Movement limits can disconnect players, while others cancel actions. Supports item blacklisting. ```plaintext actionLimiter on/off actionLimiter allowMovement on/off actionLimiter movementDistance actionLimiter movementHome actionLimiter movementMinY actionLimiter allowInventory on/off actionLimiter allowBlockBreaking on/off actionLimiter allowInteract on/off actionLimiter allowEnderChest on/off actionLimiter allowUseItem on/off actionLimiter allowBookSigning on/off actionLimiter allowChat on/off actionLimiter allowServerCommands on/off actionLimiter allowRespawn on/off actionLimiter itemsBlacklist on/off actionLimiter itemsBlacklist add/del actionLimiter itemsBlacklist addAll ,... actionLimiter itemsBlacklist clear actionLimiter itemsBlacklist list ``` -------------------------------- ### Configure antiAFK module for inactivity Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Manages the AntiAFK module to prevent players from being kicked due to inactivity on servers like 2b2t. It supports actions like swinging, walking (with optional safe walk), jumping, and sneaking, each with configurable delays and distances. ```plaintext antiAFK on/off antiAFK rotate on/off antiAFK rotate delay antiAFK swing on/off antiAFK swing delay antiAFK walk on/off antiAFK walk delay antiAFK safeWalk on/off antiAFK walkDistance antiAFK jump on/off antiAFK jump onlyInWater on/off antiAFK jump delay antiAFK sneak on/off antiAFK sneak delay ``` -------------------------------- ### Configure Player Join/Leave Alerts Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Sets up alerts for when specific players join or leave the game. Users can toggle the feature on/off, list current tracked players, and add or delete players from the watch list. ```plaintext stalk on/off stalk list stalk add/del ``` -------------------------------- ### Configure Rate Limiter (ZenithProxy) Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Implements rate limiting for player logins and packet sending to prevent abuse. Users can configure the time interval between allowed logins per IP and the packet rate limit within a specified time interval per connection. ```Shell rateLimiter login on/off rateLimiter login rateLimit rateLimiter packet on/off rateLimiter packet interval rateLimiter packet rateLimit ``` -------------------------------- ### ZenithProxy Authentication Configuration (Terminal) Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Configures the proxy's authentication settings, including clearing accounts, setting login attempt limits, and managing token refresh behavior. It also allows selection of different authentication types and configuration of chat signing. ```text auth clear auth attempts auth alwaysRefreshOnLogin on/off auth type auth email auth password auth mention on/off auth openBrowser on/off auth maxRefreshIntervalMins auth useClientConnectionProxy on/off auth chatSigning on/off auth chatSigning force on/off auth chatSigning whispers on/off ``` -------------------------------- ### Connect to MC Server (ZenithProxy) Source: https://github.com/rfresh2/zenithproxy/blob/1.21.4/docs/wiki/Commands.md Connects ZenithProxy to the destination Minecraft server. Aliases include 'c'. This command is used to establish a connection. ```plaintext connect ``` -------------------------------- ### ZenithProxy Whitelist Management (Terminal) Source: https://github.com/rfresh2/zenithproxy/wiki/Commands Manages the list of players allowed to log in. This includes adding, deleting, and clearing players from both the main whitelist and the blacklist. It also includes options for auto-adding the logged-in account. ```text whitelist add/del whitelist addAll ,... whitelist list whitelist clear whitelist autoAddZenithAccount on/off whitelist blacklist add/del whitelist blacklist clear ```