Commits
md_5 authored 72d90babbd2
1 - | From 612e8c63e87900f18d444b754fc6f853be9ba1eb Mon Sep 17 00:00:00 2001 |
1 + | From 41af8b8aae1aef3fb46454947406c9c0c8c257cf Mon Sep 17 00:00:00 2001 |
2 2 | From: md_5 <git@md-5.net> |
3 3 | Date: Sat, 12 Apr 2014 21:23:58 +1000 |
4 4 | Subject: [PATCH] BungeeCord Support |
5 5 | |
6 6 | * Provides support for IP forwarding via BungeeCord. |
7 7 | * Treats Bungee as Online Mode. |
8 8 | |
9 9 | diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java |
10 10 | index 64e65b037..96d675528 100644 |
11 11 | --- a/src/main/java/net/minecraft/network/NetworkManager.java |
97 97 | + IChatBaseComponent chatmessage = IChatBaseComponent.literal("Unknown data in login hostname, did you forget to enable BungeeCord in spigot.yml?"); |
98 98 | + this.connection.send(new PacketLoginOutDisconnect(chatmessage)); |
99 99 | + this.connection.disconnect(chatmessage); |
100 100 | + return; |
101 101 | + } |
102 102 | + // Spigot End |
103 103 | } |
104 104 | |
105 105 | } |
106 106 | diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java |
107 - | index b96ecd31b..5c5c53ed9 100644 |
107 + | index aaf68153d..bfd49a7e1 100644 |
108 108 | --- a/src/main/java/net/minecraft/server/network/LoginListener.java |
109 109 | +++ b/src/main/java/net/minecraft/server/network/LoginListener.java |
110 - | |
110 + | |
111 111 | @Override |
112 112 | public void run() { |
113 113 | try { |
114 114 | - GameProfile gameprofile = UUIDUtil.createOfflineProfile(LoginListener.this.requestedUsername); |
115 115 | + GameProfile gameprofile = createOfflineProfile(LoginListener.this.requestedUsername); // Spigot |
116 116 | |
117 117 | LoginListener.this.callPlayerPreLoginEvents(gameprofile); |
118 118 | LoginListener.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); |
119 - | |
119 + | |
120 120 | LoginListener.this.startClientVerification(gameprofile); |
121 121 | } else if (LoginListener.this.server.isSingleplayer()) { |
122 122 | LoginListener.LOGGER.warn("Failed to verify username but will let them in anyway!"); |
123 123 | - LoginListener.this.startClientVerification(UUIDUtil.createOfflineProfile(s1)); |
124 124 | + LoginListener.this.startClientVerification(LoginListener.this.createOfflineProfile(s1)); // Spigot |
125 125 | } else { |
126 126 | LoginListener.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.unverified_username")); |
127 127 | LoginListener.LOGGER.error("Username '{}' tried to join with an invalid session", s1); |
128 - | |
128 + | |
129 129 | } catch (AuthenticationUnavailableException authenticationunavailableexception) { |
130 130 | if (LoginListener.this.server.isSingleplayer()) { |
131 131 | LoginListener.LOGGER.warn("Authentication servers are down but will let them in anyway!"); |
132 132 | - LoginListener.this.startClientVerification(UUIDUtil.createOfflineProfile(s1)); |
133 133 | + LoginListener.this.startClientVerification(LoginListener.this.createOfflineProfile(s1)); // Spigot |
134 134 | } else { |
135 135 | LoginListener.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.authservers_down")); |
136 136 | LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); |
137 - | |
137 + | |
138 138 | this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); |
139 139 | } |
140 140 | |
141 141 | + // Spigot start |
142 142 | + protected GameProfile createOfflineProfile(String s) { |
143 143 | + java.util.UUID uuid; |
144 144 | + if ( connection.spoofedUUID != null ) |
145 145 | + { |
146 146 | + uuid = connection.spoofedUUID; |
147 147 | + } else |
159 159 | + gameProfile.getProperties().put( property.name(), property ); |
160 160 | + } |
161 161 | + } |
162 162 | + |
163 163 | + return gameProfile; |
164 164 | + } |
165 165 | + // Spigot end |
166 166 | + |
167 167 | private static enum EnumProtocolState { |
168 168 | |
169 - | HELLO, KEY, AUTHENTICATING, NEGOTIATING, VERIFYING, WAITING_FOR_COOKIES, WAITING_FOR_DUPE_DISCONNECT, PROTOCOL_SWITCHING, ACCEPTED; // CraftBukkit |
169 + | HELLO, KEY, AUTHENTICATING, NEGOTIATING, VERIFYING, WAITING_FOR_DUPE_DISCONNECT, PROTOCOL_SWITCHING, ACCEPTED, WAITING_FOR_COOKIES, DISCONNECTED; // CraftBukkit |
170 170 | diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java |
171 171 | index a4ad817e2..8a4da5a1b 100644 |
172 172 | --- a/src/main/java/net/minecraft/server/network/PlayerConnection.java |
173 173 | +++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java |
174 174 | |
175 175 | |
176 176 | String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), queueEvent.getMessage()); |
177 177 | if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) { |
178 178 | - if (originalFormat.equals(queueEvent.getFormat()) && originalMessage.equals(queueEvent.getMessage()) && queueEvent.getPlayer().getName().equalsIgnoreCase(queueEvent.getPlayer().getDisplayName())) { |
179 179 | + if (!org.spigotmc.SpigotConfig.bungee && originalFormat.equals(queueEvent.getFormat()) && originalMessage.equals(queueEvent.getMessage()) && queueEvent.getPlayer().getName().equalsIgnoreCase(queueEvent.getPlayer().getDisplayName())) { // Spigot |