config update

This commit is contained in:
Michael Wain 2025-03-19 21:09:51 +03:00
parent 63d68114e7
commit 3bb679c28f
4 changed files with 99 additions and 9 deletions

88
README.md Normal file
View File

@ -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 Mojangs 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 Mojangs 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 Mojangs 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 Mojangs 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**.

View File

@ -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<MinecraftProfileTexture.Type, MinecraftProfileTexture> 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);

View File

@ -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 {

View File

@ -1,3 +1,4 @@
public_domain: "localhost"
public_port: 8999
internal_port: 8999
use_https: false