diff --git a/README.md b/README.md new file mode 100644 index 0000000..ee76043 --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +# πŸ” XCraftAuth – Yggdrasil Authentication + +A powerful **custom session server** plugin for Spigot-based servers, allowing full **Yggdrasil authentication** support across **1.8-1.16.5 Minecraft versions**! This plugin enables true **online mode authentication** with a self-hosted session server, providing flexibility for your Minecraft network. + +**THIS PLUGIN ONLY WORKS ON SERVERS THAT RUN UNDER JAVA 8, NEWER VERSIONS OF JAVA WILL BREAK THIS PLUGIN** + +**🌟 No need for AuthMe!** This plugin completely replaces AuthMe by handling authentication through a custom session server. + +**🎨 Built-in skin & cape support!** Players can edit their skins and capes without needing Mojang's servers. + +--- + +## ✨ Features + +βœ… **Supports all modern Minecraft versions** – From 1.8 to the 1.16.5 release. +βœ… **Compatible with all Bukkit/Spigot-based server software**, including: +- **CraftBukkit** +- **Spigot** +- **Paper** +- **CatServer** (Forge + Bukkit) +- **Magma** (Forge + Bukkit) +- **Mohist** (Forge + Bukkit) + +βœ… **Full Yggdrasil authentication** – Works with your custom authentication system. +βœ… **Self-hosted session server** – No need for Mojang's authentication services. +βœ… **Seamless integration** – Works as a drop-in replacement for online mode. +βœ… **Replaces AuthMe** – No need for password-based authentication plugins. +βœ… **Custom skin & cape support** – Change your skin and cape at any time! +βœ… **Customizable** – Modify authentication endpoints to fit your needs. + +--- + +## πŸ“₯ Installation + +1. **Download the latest release** from Jenkins. +2. **Place the JAR file** in your `plugins` folder. +3. **Restart your server** to generate the configuration file. +4. **Configure your public domain and public port (for reverse proxy setup)** in the config file (`config.yml`). +5. **Restart your server** to apply changes. + +--- + +## 🎨 Skin & Cape Editing + +If you use this plugin, **players can change their skins and capes** freely! The skin system is independent of Mojang’s servers and fully integrated with the custom session server. The only thing you need is XCraft launcher + +--- + +## βš™οΈ Configuration + +Edit `plugins/XCraftAuth/config.yml`: + +```yaml +public_domain: "localhost" # Should be the same as the domain of your minecraft server +public_port: 8999 # Reverse proxy port (leave same if there's no reverse proxy) +internal_port: 8999 # Session server port +use_https: false # Set true if you're using reverse proxy setup +``` + +--- + +## πŸš€ Usage + +Once installed and configured, your server will authenticate players using your **custom session server**, just like Mojang’s online mode. Players must authenticate via your system before joining. + +--- + +## ❓ FAQ + +**Q: Can this replace Mojang's authentication system?** +A: Yes! This plugin enables **custom online mode authentication**, independent of Mojang’s servers. + +**Q: Does this work with cracked clients?** +A: Yes, but **only** when using the **XCraft launcher**, which integrates with the custom session system. + +**Q: Can players edit their skins and capes?** +A: Yes! With this plugin, players can change their skins and capes without Mojang’s servers. + +**Q: Can this replace AuthMe?** +A: Yes! Since this plugin uses a session server for authentication, you **do not need AuthMe**. + +--- + +## πŸ“œ License + +This project is **open-source** and licensed under the **MIT License**. + + diff --git a/src/main/java/com/alterdekim/xcraft/auth/SaltNic.java b/src/main/java/com/alterdekim/xcraft/auth/SaltNic.java index b77a720..c8e7f63 100644 --- a/src/main/java/com/alterdekim/xcraft/auth/SaltNic.java +++ b/src/main/java/com/alterdekim/xcraft/auth/SaltNic.java @@ -22,8 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.logging.Logger; -import static com.alterdekim.xcraft.auth.XCraft.PUBLIC_DOMAIN; -import static com.alterdekim.xcraft.auth.XCraft.SERVER_PORT; +import static com.alterdekim.xcraft.auth.XCraft.*; public class SaltNic extends NanoHTTPD { @@ -38,12 +37,12 @@ public class SaltNic extends NanoHTTPD { private static final int MAX_FILE_SIZE = 1024 * 1024; public SaltNic(Logger logger) throws IOException { - super(SERVER_PORT); + super(INTERNAL_PORT); this.logger = logger; this.storage = new UserStorage(); this.sessions = new ConcurrentHashMap<>(); start(NanoHTTPD.SOCKET_READ_TIMEOUT, false); - logger.info("SaltNic session server started on http://localhost:"+SERVER_PORT); + logger.info("SaltNic session server started on http://localhost:"+INTERNAL_PORT); } @Override @@ -223,7 +222,7 @@ public class SaltNic extends NanoHTTPD { Map textures = new HashMap<>(); if( new File(SKIN_DIRECTORY, uuid + ".png").exists() ) { - MinecraftProfileTexture texture = new MinecraftProfileTexture("http://"+PUBLIC_DOMAIN+":"+SERVER_PORT+"/api/skin/s" + uuid, new HashMap<>()); + MinecraftProfileTexture texture = new MinecraftProfileTexture("http" + (USE_HTTPS ? "s" : "") + "://"+PUBLIC_DOMAIN+":"+SERVER_PORT+"/api/skin/s" + uuid, new HashMap<>()); if( storage.getSkinModel(uuid) == User.SkinModel.Alex ) { texture.getMetadata().put("model", "slim"); } @@ -231,7 +230,7 @@ public class SaltNic extends NanoHTTPD { } if( new File(CAPE_DIRECTORY, uuid + ".png").exists() ) { - textures.put(MinecraftProfileTexture.Type.CAPE, new MinecraftProfileTexture("http://"+PUBLIC_DOMAIN+":"+SERVER_PORT+"/api/cape/a" + uuid, new HashMap<>())); + textures.put(MinecraftProfileTexture.Type.CAPE, new MinecraftProfileTexture("http"+(USE_HTTPS ? "s" : "")+"://"+PUBLIC_DOMAIN+":"+SERVER_PORT+"/api/cape/a" + uuid, new HashMap<>())); } MinecraftTexturesPayload minecraftTexturesPayload = new MinecraftTexturesPayload(System.currentTimeMillis(), uuid, this.storage.getUsername(uuid), textures); diff --git a/src/main/java/com/alterdekim/xcraft/auth/XCraft.java b/src/main/java/com/alterdekim/xcraft/auth/XCraft.java index 9e9dfc1..66fa104 100644 --- a/src/main/java/com/alterdekim/xcraft/auth/XCraft.java +++ b/src/main/java/com/alterdekim/xcraft/auth/XCraft.java @@ -13,6 +13,7 @@ public class XCraft extends JavaPlugin { private static SaltNic server = null; public static int SERVER_PORT = 8999; + public static int INTERNAL_PORT = 8999; public static String PUBLIC_DOMAIN = "localhost"; public static Boolean USE_HTTPS = false; @@ -23,6 +24,7 @@ public class XCraft extends JavaPlugin { try { getLogger().info("Starting SaltNic server..."); SERVER_PORT = getConfig().getInt("public_port"); + INTERNAL_PORT = getConfig().getInt("internal_port"); PUBLIC_DOMAIN = getConfig().getString("public_domain"); USE_HTTPS = getConfig().getBoolean("use_https"); server = new SaltNic(getLogger()); @@ -45,9 +47,9 @@ public class XCraft extends JavaPlugin { private void patchAuthLib() throws Exception { Class clazz = Class.forName("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService"); - modifyFinalField(clazz, "BASE_URL", "http://localhost:"+SERVER_PORT+"/api/"); - modifyFinalField(clazz, "JOIN_URL", new URL("http://localhost:"+SERVER_PORT+"/api/join")); - modifyFinalField(clazz, "CHECK_URL", new URL("http://localhost:"+SERVER_PORT+"/api/hasJoined")); + modifyFinalField(clazz, "BASE_URL", "http://localhost:"+INTERNAL_PORT+"/api/"); + modifyFinalField(clazz, "JOIN_URL", new URL("http://localhost:"+INTERNAL_PORT+"/api/join")); + modifyFinalField(clazz, "CHECK_URL", new URL("http://localhost:"+INTERNAL_PORT+"/api/hasJoined")); } private void modifyFinalField(Class clazz, String fieldName, Object newValue) throws Exception { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index f08c3d2..65b2ac3 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,3 +1,4 @@ public_domain: "localhost" public_port: 8999 +internal_port: 8999 use_https: false \ No newline at end of file