Compare commits

...

3 Commits

Author SHA1 Message Date
Nassim Jahnke b5cd56aa23
Merge e7ca4d001d into 1231b4d27c 2024-05-02 22:01:54 +02:00
Shane Freeder 1231b4d27c
Updated Upstream (BungeeCord)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
6e175173 #3608, #3676: Close connection if HAProxy 2.0 message is a health check
6335af84 SPIGOT-7638: Library loader does not seem to resolve every dependency
2024-04-29 14:30:31 +01:00
KennyTV e7ca4d001d
Reset max health attribute on server switch 2020-06-06 20:25:31 +02:00
3 changed files with 194 additions and 4 deletions

@ -1 +1 @@
Subproject commit 336333acb1e6140556271545c71f784083559dcc
Subproject commit 6e1751733f6b3dafe824dcd7f00d5ed86572ba37

View File

@ -0,0 +1,190 @@
From 37e73a01d236c2436cc615778fd1393fa2d9f57d Mon Sep 17 00:00:00 2001
From: KennyTV <kennytv@t-online.de>
Date: Sat, 6 Jun 2020 20:23:18 +0200
Subject: [PATCH] Reset max health on server switch
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
index 252389bd..9f1d56dc 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
@@ -7,6 +7,7 @@ import net.md_5.bungee.protocol.packet.ClientStatus;
import net.md_5.bungee.protocol.packet.Commands;
import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.EncryptionResponse;
+import net.md_5.bungee.protocol.packet.EntityAttributes; // Waterfall
import net.md_5.bungee.protocol.packet.EntityEffect; // Waterfall
import net.md_5.bungee.protocol.packet.EntityRemoveEffect; // Waterfall
import net.md_5.bungee.protocol.packet.EntityStatus;
@@ -189,5 +190,9 @@ public abstract class AbstractPacketHandler
public void handle(EntityRemoveEffect removeEffect) throws Exception
{
}
+
+ public void handle(EntityAttributes removeEffect) throws Exception
+ {
+ }
// Waterfall end
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
index aa1515f4..6b838527 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
@@ -15,6 +15,7 @@ import net.md_5.bungee.protocol.packet.ClientSettings;
import net.md_5.bungee.protocol.packet.Commands;
import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.EncryptionResponse;
+import net.md_5.bungee.protocol.packet.EntityAttributes; // Waterfall
import net.md_5.bungee.protocol.packet.EntityStatus;
import net.md_5.bungee.protocol.packet.GameState;
import net.md_5.bungee.protocol.packet.EntityEffect;
@@ -130,6 +131,18 @@ public enum Protocol
map(ProtocolConstants.MINECRAFT_1_14, 0x38),
map(ProtocolConstants.MINECRAFT_1_15, 0x39)
);
+ TO_CLIENT.registerPacket(
+ EntityAttributes.class,
+ EntityAttributes::new,
+ map( ProtocolConstants.MINECRAFT_1_8, 0x20 ),
+ map( ProtocolConstants.MINECRAFT_1_9, 0x4B ),
+ map( ProtocolConstants.MINECRAFT_1_9_4, 0x4A ),
+ map( ProtocolConstants.MINECRAFT_1_12, 0x4D ),
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x4E ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x52 ),
+ map( ProtocolConstants.MINECRAFT_1_14, 0x58 ),
+ map( ProtocolConstants.MINECRAFT_1_15, 0x59 )
+ );
// Waterfall end
TO_CLIENT.registerPacket(
PlayerListItem.class, // PlayerInfo
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EntityAttributes.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EntityAttributes.java
new file mode 100644
index 00000000..487444bb
--- /dev/null
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EntityAttributes.java
@@ -0,0 +1,109 @@
+package net.md_5.bungee.protocol.packet;
+
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import net.md_5.bungee.protocol.AbstractPacketHandler;
+import net.md_5.bungee.protocol.DefinedPacket;
+import net.md_5.bungee.protocol.ProtocolConstants;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+public class EntityAttributes extends DefinedPacket
+{
+
+ private int entityId;
+ private List<Attribute> attributes;
+
+ public EntityAttributes(int entityId)
+ {
+ this.entityId = entityId;
+ }
+
+ @Override
+ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
+ {
+ entityId = readVarInt( buf );
+ int count = buf.readInt();
+ attributes = new ArrayList<>( count );
+ for ( int i = 0; i < count; i++ )
+ {
+ Attribute attribute = new Attribute();
+ attribute.key = readString( buf );
+ attribute.value = buf.readDouble();
+ int modifierCount = readVarInt( buf );
+ attribute.modifierList = new ArrayList<>( modifierCount );
+ for ( int j = 0; j < modifierCount; j++ )
+ {
+ AttributeModifier modifier = new AttributeModifier();
+ modifier.uuid = readUUID( buf );
+ modifier.amount = buf.readDouble();
+ modifier.operation = buf.readByte();
+ attribute.modifierList.add( modifier );
+ }
+ attributes.add( attribute );
+ }
+ }
+
+ @Override
+ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
+ {
+ writeVarInt( entityId, buf );
+ buf.writeInt( attributes.size() );
+ for ( Attribute attribute : attributes )
+ {
+ writeString( attribute.key, buf );
+ buf.writeDouble( attribute.value );
+ writeVarInt( attribute.modifierList.size(), buf );
+ for ( AttributeModifier modifier : attribute.modifierList )
+ {
+ writeUUID( modifier.uuid, buf );
+ buf.writeDouble( modifier.amount );
+ buf.writeByte( modifier.operation );
+ }
+ }
+ }
+
+ @Override
+ public void handle(AbstractPacketHandler handler) throws Exception
+ {
+ handler.handle( this );
+ }
+
+ @Data
+ @NoArgsConstructor
+ @AllArgsConstructor
+ public static class Attribute
+ {
+
+ private String key;
+ private double value;
+ private List<AttributeModifier> modifierList;
+ }
+
+ @Data
+ public static class AttributeModifier
+ {
+
+ private UUID uuid;
+ private double amount;
+ private byte operation;
+ }
+
+ public static EntityAttributes createDefaultHealth(int entityId, int protocolVersion)
+ {
+ EntityAttributes packet = new EntityAttributes( entityId );
+ String key = "generic.maxHealth"; //TODO Differentiate for 1.16: minecraft:generic.max_health
+ packet.attributes = Collections.singletonList( new Attribute( key, 20, Collections.emptyList() ) );
+ return packet;
+ }
+}
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
index 35a19224..fdb48892 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -285,6 +285,8 @@ public class ServerConnector extends PacketHandler
}
user.getSentBossBars().clear();
+ user.unsafe().sendPacket( net.md_5.bungee.protocol.packet.EntityAttributes.createDefaultHealth( user.getClientEntityId(), user.getPendingConnection().getVersion() ) ); // Waterfall - Reset max health attribute
+
// Update debug info from login packet
user.unsafe().sendPacket( new EntityStatus( user.getClientEntityId(), login.isReducedDebugInfo() ? EntityStatus.DEBUG_INFO_REDUCED : EntityStatus.DEBUG_INFO_NORMAL ) );
// And immediate respawn
--
2.26.2.windows.1

View File

@ -1,14 +1,14 @@
From 76c901d6879fc774867b51da71abb31c10bdc8ab Mon Sep 17 00:00:00 2001
From 46bb2e2fc11e4133b45c1c6af6e1e5d20043f9f1 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 19 Jun 2022 10:31:51 +0100
Subject: [PATCH] Expand packet-decode-logging usage
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
index 206f4227..954ffbc9 100644
index 6caf30cd..75e802d2 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
@@ -152,6 +152,14 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
@@ -155,6 +155,14 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - read timed out", handler );
} else if ( cause instanceof DecoderException )
{