Update to Minecraft 1.16.1

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-06-25 10:00:00 +10:00
parent 3862d2811e
commit 50503fd516
424 changed files with 5960 additions and 5636 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/HandshakeListener.java
+++ b/net/minecraft/server/HandshakeListener.java
@@ -1,7 +1,17 @@
@@ -1,7 +1,16 @@
package net.minecraft.server;
+// CraftBukkit start
@@ -14,26 +14,25 @@
+ private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
+ private static int throttleCounter = 0;
+ // CraftBukkit end
+
private final MinecraftServer a;
private final NetworkManager b;
@@ -17,6 +27,41 @@
this.b.setProtocol(EnumProtocol.LOGIN);
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
private final MinecraftServer b;
private final NetworkManager c;
@@ -18,6 +27,41 @@
this.c.setProtocol(EnumProtocol.LOGIN);
ChatMessage chatmessage;
+ // CraftBukkit start - Connection throttle
+ try {
+ long currentTime = System.currentTimeMillis();
+ long connectionThrottle = MinecraftServer.getServer().server.getConnectionThrottle();
+ InetAddress address = ((java.net.InetSocketAddress) this.b.getSocketAddress()).getAddress();
+ long connectionThrottle = this.b.server.getConnectionThrottle();
+ InetAddress address = ((java.net.InetSocketAddress) this.c.getSocketAddress()).getAddress();
+
+ synchronized (throttleTracker) {
+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
+ throttleTracker.put(address, currentTime);
+ chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
+ this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage));
+ this.b.close(chatmessage);
+ this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
+ this.c.close(chatmessage);
+ return;
+ }
+
@@ -59,12 +58,12 @@
+
if (packethandshakinginsetprotocol.c() > SharedConstants.getGameVersion().getProtocolVersion()) {
chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[]{SharedConstants.getGameVersion().getName()});
this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage));
@@ -27,6 +72,7 @@
this.b.close(chatmessage);
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
@@ -28,6 +72,7 @@
this.c.close(chatmessage);
} else {
this.b.setPacketListener(new LoginListener(this.a, this.b));
+ ((LoginListener) this.b.i()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
this.c.setPacketListener(new LoginListener(this.b, this.c));
+ ((LoginListener) this.c.i()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
}
break;
case STATUS: