mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-04 16:43:53 +01:00
985b5655f5
This has been in work for a bunch of time. Zoe ( duplexsystem or budgidiere, whatever ) has put a ton of work into this. We now have a bugfree build system that works flawlessly. Co-authored-by: Ivan Pekov <ivan@mrivanplays.com> Co-authored-by: Simon Gardling <titaniumtown@gmail.com> Co-authored-by: toinouH <toinouh2003@gmail.com> P.s the one who merged this is ivan and not bud.
97 lines
5.8 KiB
Diff
97 lines
5.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
Date: Wed, 9 Sep 2020 16:15:22 +0300
|
|
Subject: [PATCH] ProxyForwardDataEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
index 79f726ef43e70b8882890007146df199824d14e3..edb7a9de55718d9c860c82580aca78c3d254ad57 100644
|
|
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
@@ -92,6 +92,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
if (event.getSocketAddressHostname() != null) this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.getNetworkManager().getSocketAddress()).getPort());
|
|
this.getNetworkManager().spoofedUUID = event.getUniqueId();
|
|
this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
|
+ if (proxyLogicEnabled) c.proxyProfileSpoof = true; // Yatopia
|
|
handledByEvent = true; // Hooray, we did it!
|
|
}
|
|
}
|
|
@@ -105,6 +106,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
packethandshakinginsetprotocol.hostname = split[0];
|
|
c.socketAddress = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) c.getSocketAddress()).getPort());
|
|
c.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
|
|
+ c.proxyProfileSpoof = true; // Yatopia
|
|
} else
|
|
{
|
|
ChatMessage chatmessage = new ChatMessage("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
|
|
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
|
index d987483255195c0bde713a92676baced1eaff2b3..bb45fc83d81948c84bc721961474e5e806ab404a 100644
|
|
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
|
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
|
@@ -125,6 +125,23 @@ public class LoginListener implements PacketLoginInListener {
|
|
|
|
this.i = new GameProfile( uuid, this.i.getName() );
|
|
|
|
+ // Yatopia start - situate this around an event
|
|
+ if (networkManager.proxyProfileSpoof) {
|
|
+ java.util.List<com.mojang.authlib.properties.Property> properties;
|
|
+ if (networkManager.spoofedProfile != null) {
|
|
+ properties = new java.util.ArrayList<>(Arrays.asList(networkManager.spoofedProfile));
|
|
+ } else {
|
|
+ properties = java.util.Collections.emptyList();
|
|
+ }
|
|
+ net.yatopia.api.event.ProxyForwardDataEvent event = new net.yatopia.api.event.ProxyForwardDataEvent(
|
|
+ !org.bukkit.Bukkit.isPrimaryThread(), uuid, i.getName(), properties
|
|
+ );
|
|
+ if (event.callEvent()) {
|
|
+ for (com.mojang.authlib.properties.Property property : event.getProperties()) {
|
|
+ i.getProperties().put(property.getName(), property);
|
|
+ }
|
|
+ }
|
|
+ } else {
|
|
if (networkManager.spoofedProfile != null)
|
|
{
|
|
for ( com.mojang.authlib.properties.Property property : networkManager.spoofedProfile )
|
|
@@ -132,6 +149,7 @@ public class LoginListener implements PacketLoginInListener {
|
|
this.i.getProperties().put( property.getName(), property );
|
|
}
|
|
}
|
|
+ } // Yatopia end
|
|
}
|
|
// Spigot end
|
|
|
|
@@ -365,11 +383,20 @@ public class LoginListener implements PacketLoginInListener {
|
|
|
|
this.networkManager.socketAddress = new java.net.InetSocketAddress(com.destroystokyo.paper.proxy.VelocityProxy.readAddress(buf), ((java.net.InetSocketAddress) this.networkManager.getSocketAddress()).getPort());
|
|
|
|
- this.setGameProfile(com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf));
|
|
+ // Yatopia start - how about spoofed uuid and profile
|
|
+ //this.setGameProfile(com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf));
|
|
+ com.mojang.authlib.GameProfile profile = com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf);
|
|
+ networkManager.spoofedUUID = profile.getId();
|
|
+ if (!profile.getProperties().isEmpty()) {
|
|
+ networkManager.spoofedProfile = profile.getProperties().values().toArray(new com.mojang.authlib.properties.Property[0]);
|
|
+ }
|
|
+ networkManager.proxyProfileSpoof = true;
|
|
+ // Yatopia end
|
|
|
|
// Proceed with login
|
|
authenticatorPool.execute(() -> {
|
|
try {
|
|
+ initUUID(); // Yatopia
|
|
new LoginHandler().fireEvents();
|
|
} catch (Exception ex) {
|
|
disconnect("Failed to verify username!");
|
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
index 548c62a838848a9183e14f91b21a9dc309d8a3b2..08227ab446d6332af76491a063653f7f13f43560 100644
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
@@ -51,6 +51,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
|
// Spigot Start
|
|
public java.util.UUID spoofedUUID;
|
|
public com.mojang.authlib.properties.Property[] spoofedProfile;
|
|
+ public boolean proxyProfileSpoof = false; // Yatopia
|
|
public boolean preparing = true;
|
|
// Spigot End
|
|
private PacketListener packetListener;
|