mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
parent
db0dd75a20
commit
b856bf08b9
4 changed files with 11 additions and 10 deletions
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated // Paper
|
||||
+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) {
|
||||
super(who);
|
||||
this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : net.kyori.adventure.text.Component.empty(); // Paper
|
||||
this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper
|
||||
+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason;
|
||||
}
|
||||
// Paper start
|
||||
|
|
|
@ -1594,7 +1594,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated // Paper end
|
||||
public PlayerJoinEvent(@NotNull final Player playerJoined, @Nullable final String joinMessage) {
|
||||
super(playerJoined);
|
||||
+ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : net.kyori.adventure.text.Component.empty(); // Paper end
|
||||
+ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null; // Paper end
|
||||
+ }
|
||||
+
|
||||
+ // Paper start
|
||||
|
@ -1639,7 +1639,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated // Paper
|
||||
public void setJoinMessage(@Nullable String joinMessage) {
|
||||
- this.joinMessage = joinMessage;
|
||||
+ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : net.kyori.adventure.text.Component.empty(); // Paper
|
||||
+ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null; // Paper
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -2042,7 +2042,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated // Paper
|
||||
public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) {
|
||||
super(who);
|
||||
+ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : net.kyori.adventure.text.Component.empty(); // Paper
|
||||
+ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper
|
||||
+ }
|
||||
+ // Paper start
|
||||
+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) {
|
||||
|
@ -2091,7 +2091,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated // Paper
|
||||
public void setQuitMessage(@Nullable String quitMessage) {
|
||||
- this.quitMessage = quitMessage;
|
||||
+ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : net.kyori.adventure.text.Component.empty(); // Paper
|
||||
+ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
|
|
@ -1156,7 +1156,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage));
|
||||
+ // Paper start - Adventure
|
||||
+ net.kyori.adventure.text.Component quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player);
|
||||
+ if ((quitMessage != null) && (quitMessage.equals(net.kyori.adventure.text.Component.empty()))) {
|
||||
+ if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) {
|
||||
+ this.minecraftServer.getPlayerList().sendMessage(PaperAdventure.asVanilla(quitMessage));
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -1284,13 +1284,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
- joinMessage = playerJoinEvent.getJoinMessage();
|
||||
+ joinMessage = PaperAdventure.asVanilla(playerJoinEvent.joinMessage()); // Paper - Adventure
|
||||
+ final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
- if (joinMessage != null && joinMessage.length() > 0) {
|
||||
- for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) {
|
||||
- server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.b));
|
||||
- }
|
||||
+ if (playerJoinEvent.joinMessage() != net.kyori.adventure.text.Component.empty()) { // Paper - Adventure
|
||||
+ if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
|
||||
+ joinMessage = PaperAdventure.asVanilla(playerJoinEvent.joinMessage()); // Paper - Adventure
|
||||
+ server.getPlayerList().sendAll(new PacketPlayOutChat(joinMessage, ChatMessageType.SYSTEM, SystemUtils.b)); // Paper - Adventure
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
|
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
joinMessage = PaperAdventure.asVanilla(playerJoinEvent.joinMessage()); // Paper - Adventure
|
||||
|
||||
if (playerJoinEvent.joinMessage() != net.kyori.adventure.text.Component.empty()) { // Paper - Adventure
|
||||
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
|
||||
joinMessage = PaperAdventure.asVanilla(playerJoinEvent.joinMessage()); // Paper - Adventure
|
||||
- server.getPlayerList().sendAll(new PacketPlayOutChat(joinMessage, ChatMessageType.SYSTEM, SystemUtils.b)); // Paper - Adventure
|
||||
+ // Paper start - Removed sendAll for loop and broadcasted to console also
|
||||
+ server.getPlayerList().sendMessage(joinMessage); // Paper - Adventure
|
||||
|
|
Loading…
Reference in a new issue