readd beacon effect cause

This commit is contained in:
Lulu13022002
2024-12-18 19:09:46 +01:00
parent dedc6b3394
commit 6126012369
102 changed files with 443 additions and 488 deletions

View File

@@ -1785,21 +1785,20 @@
}
public void sendDisguisedChatMessage(Component message, ChatType.Bound boundType) {
@@ -1579,6 +_,18 @@
@@ -1579,6 +_,17 @@
return this.connection.getRemoteAddress();
}
+ // Spigot Start
+ public SocketAddress getRawAddress()
+ {
+ // Spigot start
+ public SocketAddress getRawAddress() {
+ // Paper start - Unix domain socket support; this can be nullable in the case of a Unix domain socket, so if it is, fake something
+ if (connection.channel.remoteAddress() == null) {
+ if (this.connection.channel.remoteAddress() == null) {
+ return new java.net.InetSocketAddress(java.net.InetAddress.getLoopbackAddress(), 0);
+ }
+ // Paper end - Unix domain socket support
+ return this.connection.channel.remoteAddress();
+ }
+ // Spigot End
+ // Spigot end
+
public void switchToConfig() {
this.waitingForSwitchToConfig = true;
@@ -1812,12 +1811,12 @@
if (this.player.hasClientLoaded()) {
final ServerLevel serverLevel = this.player.serverLevel();
final Entity target = packet.getTarget(serverLevel);
+ // Spigot Start
+ // Spigot start
+ if (target == this.player && !this.player.isSpectator()) {
+ this.disconnect(Component.literal("Cannot interact with self!"), org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION); // Paper - kick event cause
+ return;
+ }
+ // Spigot End
+ // Spigot end
this.player.resetLastActionTime();
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
if (target != null) {

View File

@@ -107,9 +107,9 @@
+ if (event.callEvent()) {
+ // If we've failed somehow, let the client know so and go no further.
+ if (event.isFailed()) {
+ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage());
+ this.connection.send(new ClientboundLoginDisconnectPacket(component));
+ this.connection.disconnect(component);
+ Component message = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage());
+ this.connection.send(new ClientboundLoginDisconnectPacket(message));
+ this.connection.disconnect(message);
+ return;
+ }
+
@@ -129,7 +129,7 @@
+ }
+ }
+ // Paper end
+ // Spigot Start
+ // Spigot start
+ String[] split = packet.hostName().split("\00");
+ if (!handledByEvent && proxyLogicEnabled) { // Paper
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
@@ -141,20 +141,20 @@
+ // Paper end - Unix domain socket support
+ this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
+ } else {
+ Component chatmessage = Component.literal("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
+ this.connection.disconnect(chatmessage);
+ Component message = Component.literal("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
+ this.connection.send(new ClientboundLoginDisconnectPacket(message));
+ this.connection.disconnect(message);
+ return;
+ }
+ if (split.length == 4) {
+ this.connection.spoofedProfile = ServerHandshakePacketListenerImpl.gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class);
+ }
+ } else if ((split.length == 3 || split.length == 4) && (ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher(split[1]).matches())) {
+ Component chatmessage = Component.literal("Unknown data in login hostname, did you forget to enable BungeeCord in spigot.yml?");
+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
+ this.connection.disconnect(chatmessage);
+ Component message = Component.literal("Unknown data in login hostname, did you forget to enable BungeeCord in spigot.yml?");
+ this.connection.send(new ClientboundLoginDisconnectPacket(message));
+ this.connection.disconnect(message);
+ }
+ // Spigot End
+ // Spigot end
}
}