8000 Proxy support by webhead1104 · Pull Request #31 · CytonicMC/Cytosis · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy support #31

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main/java/net/cytonic/cytosis/Cytosis.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minestom.server.command.ConsoleSender;
import net.minestom.server.entity.Player;
import net.minestom.server.extras.MojangAuth;
import net.minestom.server.extras.velocity.VelocityProxy;
import net.minestom.server.instance.InstanceContainer;
import net.minestom.server.instance.InstanceManager;
import net.minestom.server.instance.LightingChunk;
Expand Down Expand Up @@ -80,8 +81,10 @@ public static void main(String[] args) {
Logger.error("An error occurred whilst initializing the file manager!", throwable);
} else {
Logger.info("File manager initialized!");
if (CytosisSettings.SERVER_ONLINE_MODE)
mojangAuth();
if (CytosisSettings.SERVER_PROXY_MODE) {
Logger.info("Enabling velocity!");
VelocityProxy.enable(CytosisSettings.SERVER_SECRET);
} else mojangAuth();
Logger.info("Completing nonessential startup tasks.");
completeNonEssentialTasks(start);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.cytonic.cytosis.config;

import net.cytonic.cytosis.logging.Logger;

import java.util.Map;

/**
Expand All @@ -22,7 +21,9 @@ public class CytosisSettings {
public static int DATABASE_PORT = 3306;
public static String DATABASE_NAME = "";
public static boolean DATABASE_USE_SSL = false;
public static boolean SERVER_ONLINE_MODE = true;
// server
public static boolean SERVER_PROXY_MODE = false;
public static String SERVER_SECRET = "";
public static int SERVER_PORT = 25565;

// RabbitMQ
Expand Down Expand Up @@ -53,7 +54,8 @@ public static void inportConfig(Map<String, Object> config) {
case "database.use_ssl" -> DATABASE_USE_SSL = (boolean) value;

// server
case "server.online_mode" -> SERVER_ONLINE_MODE = (boolean) value;
case "server.proxy_mode" -> SERVER_PROXY_MODE = (boolean) value;
case "server.secret" -> SERVER_SECRET = (String) value;
case "server.port" -> SERVER_PORT = toInt(value);

// RabbitMQ
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use_ssl = false # Whether to use SSL

# server stuff
[server]
online_mode = true
proxy_mode = true
secret = "hi i am the secret" # this can NOT be empty
port = 25565

# Logging Configuration
Expand Down
0