Archiviert
13
0

Fixup AsyncPreLoginEvent patches

Fixes #10165
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-14 13:33:47 +01:00
Ursprung 8657cd91d7
Commit c151c956e0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
657 geänderte Dateien mit 315 neuen und 397 gelöschten Zeilen

Datei anzeigen

@ -24,6 +24,6 @@
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-commons</artifactId>
+--
+--
+2.43.0
+

Datei anzeigen

@ -1,12 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 18 Mar 2018 11:43:30 -0400
Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
Subject: [PATCH] Add more fields to AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
index 6aaeba3feb66462ce352dacabd845f8d8283f54b..e4afc428e9a8625bf6f5967cb659987c14f65ba6 100644
index 3432872303aa0df97b5d9090fe98b269ef3cb9f4..f8b69b52ec8efa103e4e78e1b5c6a015e73d2a75 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -2,6 +2,9 @@ package org.bukkit.event.player;
@ -19,27 +18,69 @@ index 6aaeba3feb66462ce352dacabd845f8d8283f54b..e4afc428e9a8625bf6f5967cb659987c
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
@@ -22,9 +25,9 @@ public class AsyncPlayerPreLoginEvent extends Event {
@@ -22,9 +25,10 @@ public class AsyncPlayerPreLoginEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private Result result;
private net.kyori.adventure.text.Component message; // Paper
- private final String name;
+ //private String name; // Paper - Not used anymore
private final InetAddress ipAddress;
- private final UUID uniqueId;
+ //private UUID uniqueId; // Paper - Not used anymore
+ private PlayerProfile profile; // Paper
+ private final InetAddress rawAddress; // Paper
+ private final String hostname; // Paper
@Deprecated
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
@@ -32,12 +35,37 @@ public class AsyncPlayerPreLoginEvent extends Event {
@@ -32,12 +36,29 @@ public class AsyncPlayerPreLoginEvent extends Event {
}
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
+ // Paper start
+ this(name, ipAddress, uniqueId, Bukkit.createProfile(uniqueId, name));
+ }
+ private PlayerProfile profile;
+
+ @Deprecated(forRemoval = true)
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
+ this(name, ipAddress, ipAddress, uniqueId, profile);
+ }
+
+ @Deprecated(forRemoval = true)
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
+ this(name, ipAddress, rawAddress, uniqueId, profile, "");
+ }
+
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile, @NotNull String hostname) {
super(true);
this.result = Result.ALLOWED;
this.message = net.kyori.adventure.text.Component.empty(); // Paper
- this.name = name;
+ this.profile = profile;
this.ipAddress = ipAddress;
- this.uniqueId = uniqueId;
+ this.rawAddress = rawAddress;
+ this.hostname = hostname;
+ // Paper end
}
/**
@@ -200,7 +221,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
*/
@NotNull
public String getName() {
- return name;
+ return profile.getName(); // Paper
}
/**
@@ -220,9 +241,48 @@ public class AsyncPlayerPreLoginEvent extends Event {
*/
@NotNull
public UUID getUniqueId() {
- return uniqueId;
+ return profile.getId(); // Paper
}
+ // Paper start
+ /**
+ * Gets the PlayerProfile of the player logging in
+ * @return The Profile
@ -57,35 +98,27 @@ index 6aaeba3feb66462ce352dacabd845f8d8283f54b..e4afc428e9a8625bf6f5967cb659987c
+ this.profile = profile;
+ }
+
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
super(true);
+ this.profile = profile;
+ // Paper end
this.result = Result.ALLOWED;
this.message = net.kyori.adventure.text.Component.empty(); // Paper
- this.name = name;
+ //this.name = name; // Paper - Not used anymore
this.ipAddress = ipAddress;
- this.uniqueId = uniqueId;
+ //this.uniqueId = uniqueId; // Paper - Not used anymore
}
/**
@@ -200,7 +228,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
*/
@NotNull
public String getName() {
- return name;
+ return profile.getName(); // Paper
}
/**
@@ -220,7 +248,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
*/
@NotNull
public UUID getUniqueId() {
- return uniqueId;
+ return profile.getId(); // Paper
}
+ /**
+ * Gets the raw address of the player logging in
+ * @return The address
+ */
+ @NotNull
+ public InetAddress getRawAddress() {
+ return rawAddress;
+ }
+
+ /**
+ * Gets the hostname that the player used to connect to the server, or
+ * blank if unknown
+ *
+ * @return The hostname
+ */
+ @NotNull
+ public String getHostname() {
+ return hostname;
+ }
+ // Paper end
+
@NotNull
@Override
public HandlerList getHandlers() {

Datei anzeigen

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Connor Linfoot <connorlinfoot@me.com>
Date: Wed, 12 May 2021 08:09:19 +0100
Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
index e4afc428e9a8625bf6f5967cb659987c14f65ba6..35176b16d208c9756bd00ac74b2a1dcc3fc9febb 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -27,6 +27,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
private net.kyori.adventure.text.Component message; // Paper
//private String name; // Paper - Not used anymore
private final InetAddress ipAddress;
+ private final InetAddress rawAddress; // Paper
//private UUID uniqueId; // Paper - Not used anymore
@Deprecated
@@ -57,7 +58,23 @@ public class AsyncPlayerPreLoginEvent extends Event {
this.profile = profile;
}
+ // Paper Start
+ /**
+ * Gets the raw address of the player logging in
+ * @return The address
+ */
+ @NotNull
+ public InetAddress getRawAddress() {
+ return rawAddress;
+ }
+ // Paper end
+
+ @Deprecated
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
+ this(name, ipAddress, ipAddress, uniqueId, profile);
+ }
+
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
super(true);
this.profile = profile;
// Paper end
@@ -65,6 +82,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
this.message = net.kyori.adventure.text.Component.empty(); // Paper
//this.name = name; // Paper - Not used anymore
this.ipAddress = ipAddress;
+ this.rawAddress = rawAddress; // Paper
//this.uniqueId = uniqueId; // Paper - Not used anymore
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b848ef1c207797b352c2ca97c574c4cd3fe6e43a..2a6879aa1b0497c485d127542ca4e526a23ecf85 100644
index 6e44845340f23a5b6ad8be46a1fa3dbb9dec5d67..a5e4b4447b5c68339d6b09749520048642a4eb83 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -275,6 +275,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add methods to find targets for lightning strikes
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 8735a0a359450a6cbea44c1b01c85a4135ba1f86..48b3df2c12b3f6640e6c54c89763929487f0506d 100644
index 39fd31cb24d16b8279f54e666bb5e7bccf32468c..21835fcc70c4dcffb2474caa7be3cd07bb54e2cd 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -735,6 +735,37 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient

Datei anzeigen

@ -1,61 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MCMDEV <john-m.1@gmx.de>
Date: Fri, 24 Sep 2021 17:59:23 +0200
Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
index 35176b16d208c9756bd00ac74b2a1dcc3fc9febb..da07fc4ab0c299c1bb06ede36e7230626bbc28c9 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -29,6 +29,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
private final InetAddress ipAddress;
private final InetAddress rawAddress; // Paper
//private UUID uniqueId; // Paper - Not used anymore
+ private final String hostname; // Paper
@Deprecated
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
@@ -74,7 +75,14 @@ public class AsyncPlayerPreLoginEvent extends Event {
this(name, ipAddress, ipAddress, uniqueId, profile);
}
+ @Deprecated // Paper - Add hostname
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
+ // Paper start - Add hostname
+ this(name, ipAddress, rawAddress, uniqueId, profile, "");
+ }
+
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile, @NotNull String hostname) {
+ // Paper end - Add hostname
super(true);
this.profile = profile;
// Paper end
@@ -84,6 +92,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
this.ipAddress = ipAddress;
this.rawAddress = rawAddress; // Paper
//this.uniqueId = uniqueId; // Paper - Not used anymore
+ this.hostname = hostname; // Paper - Add hostname
}
/**
@@ -269,6 +278,19 @@ public class AsyncPlayerPreLoginEvent extends Event {
return profile.getId(); // Paper
}
+ // Paper start
+ /**
+ * Gets the hostname that the player used to connect to the server, or
+ * blank if unknown
+ *
+ * @return The hostname
+ */
+ @NotNull
+ public String getHostname() {
+ return hostname;
+ }
+ // Paper end
+
@NotNull
@Override
public HandlerList getHandlers() {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Multi Block Change API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7ce512072f242632f17db55224488f18c1cddcc4..a6053648464d903d1f9501bbeae688240fbfd754 100644
index a5e4b4447b5c68339d6b09749520048642a4eb83..e2333a5f8e357ada69ff8857d3b1c666f51ac909 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -852,6 +852,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Implement regenerateChunk
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 48b3df2c12b3f6640e6c54c89763929487f0506d..b191d304832fe3475b76fdce131db51e5042ac01 100644
index 21835fcc70c4dcffb2474caa7be3cd07bb54e2cd..86c7b4ba676f826344056b24b204b748cfce1580 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -484,8 +484,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient

Datei anzeigen

@ -10,7 +10,7 @@ Subject: [PATCH] Expand FallingBlock API
Co-authored-by: Lukas Planz <lukas.planz@web.de>
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index b191d304832fe3475b76fdce131db51e5042ac01..298e63e0ca9d4cbac3172fd93a217af79fad91df 100644
index 86c7b4ba676f826344056b24b204b748cfce1580..0f60823426898974b7d61123fb848006fdc7bfcf 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2220,8 +2220,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient

Datei anzeigen

@ -158,7 +158,7 @@ index 953bb49b7079647450d3453356d1c8a91be94c01..2ea66188468cf32bcaedc5167d4b9b0c
* Teleports this entity to the given location. If this entity is riding a
* vehicle, it will be dismounted prior to teleportation.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d0eeb2c6b0f3f56d8c3c9608991091750a3bd607..aeaed639ba3a0b91501d1da837adfc6bf5517ffa 100644
index e2333a5f8e357ada69ff8857d3b1c666f51ac909..da4d8d36fdf8006e308220cb7665c9e0302e5879 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3287,6 +3287,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Custom Chat Completion Suggestions API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index aeaed639ba3a0b91501d1da837adfc6bf5517ffa..450ec166b8faf08de52b30844315a5ed29006784 100644
index da4d8d36fdf8006e308220cb7665c9e0302e5879..541ac9cf8f4af2386a5c2930cbd8fa81a48d8445 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3171,6 +3171,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Added byte array serialization/deserialization for
diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
index 6c156faf0148da13a44dabba7a807f68b3d50a36..da59e75267f43581bec6df73dda9f889347617d4 100644
index 18fc4f1c7151bfdeed32a52cf5050a76ebc391d6..decf3b1949d4653a9fb01684b93ff91048137076 100644
--- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
+++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
@@ -184,4 +184,39 @@ public interface PersistentDataContainer {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen