fix: bind packetListenerImpl to Connection when place new photographer (#160)
This commit is contained in:
@@ -5,7 +5,7 @@ Subject: [PATCH] Server I18n
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/locale/Language.java b/net/minecraft/locale/Language.java
|
diff --git a/net/minecraft/locale/Language.java b/net/minecraft/locale/Language.java
|
||||||
index 47cd33bce908744e64356b585853d6a8ecf82443..9e6f89ac7cf730bfc3c15d5a4f648c550cf72e22 100644
|
index 47cd33bce908744e64356b585853d6a8ecf82443..bb4011d3c6a1d2a5aa66e68fe719cd5eea2c0dd2 100644
|
||||||
--- a/net/minecraft/locale/Language.java
|
--- a/net/minecraft/locale/Language.java
|
||||||
+++ b/net/minecraft/locale/Language.java
|
+++ b/net/minecraft/locale/Language.java
|
||||||
@@ -37,6 +37,7 @@ public abstract class Language {
|
@@ -37,6 +37,7 @@ public abstract class Language {
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ index 1c4c67410849f844946e4883585910fc8fe97048..08a6fc0e58d61b1765e704c500b3aec6
|
|||||||
}
|
}
|
||||||
// Leaves end - skip
|
// Leaves end - skip
|
||||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||||
index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f8501255adc 100644
|
index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..575b4eabcaac48ae87b69dd037493ebfe0a1212c 100644
|
||||||
--- a/net/minecraft/server/players/PlayerList.java
|
--- a/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/net/minecraft/server/players/PlayerList.java
|
+++ b/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -129,6 +129,7 @@ public abstract class PlayerList {
|
@@ -129,6 +129,7 @@ public abstract class PlayerList {
|
||||||
@@ -330,12 +330,12 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
|
|||||||
int count = this.usersCountedAgainstLimit.size();
|
int count = this.usersCountedAgainstLimit.size();
|
||||||
if (count >= limit) {
|
if (count >= limit) {
|
||||||
return false;
|
return false;
|
||||||
@@ -221,6 +223,123 @@ public abstract class PlayerList {
|
@@ -221,6 +223,124 @@ public abstract class PlayerList {
|
||||||
|
|
||||||
abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
|
abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
|
||||||
|
|
||||||
+ // Leaves start - replay mod api
|
+ // Leaves start - replay mod api
|
||||||
+ public void placeNewPhotographer(Connection connection, org.leavesmc.leaves.replay.ServerPhotographer player, ServerLevel worldserver) {
|
+ public void placeNewPhotographer(org.leavesmc.leaves.replay.Recorder connection, org.leavesmc.leaves.replay.ServerPhotographer player, ServerLevel worldserver) {
|
||||||
+ player.isRealPlayer = true; // Paper
|
+ player.isRealPlayer = true; // Paper
|
||||||
+ player.loginTime = System.currentTimeMillis(); // Paper
|
+ player.loginTime = System.currentTimeMillis(); // Paper
|
||||||
+
|
+
|
||||||
@@ -347,6 +347,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
|
|||||||
+ LevelData worlddata = worldserver1.getLevelData();
|
+ LevelData worlddata = worldserver1.getLevelData();
|
||||||
+
|
+
|
||||||
+ ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, CommonListenerCookie.createInitial(player.gameProfile, false));
|
+ ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, CommonListenerCookie.createInitial(player.gameProfile, false));
|
||||||
|
+ connection.bind(playerconnection);
|
||||||
+ GameRules gamerules = worldserver1.getGameRules();
|
+ GameRules gamerules = worldserver1.getGameRules();
|
||||||
+ boolean flag = gamerules.get(GameRules.IMMEDIATE_RESPAWN);
|
+ boolean flag = gamerules.get(GameRules.IMMEDIATE_RESPAWN);
|
||||||
+ boolean flag1 = gamerules.get(GameRules.REDUCED_DEBUG_INFO);
|
+ boolean flag1 = gamerules.get(GameRules.REDUCED_DEBUG_INFO);
|
||||||
@@ -454,7 +455,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
|
|||||||
public void placeNewPlayer(final Connection connection, final ServerPlayer player, final CommonListenerCookie cookie) {
|
public void placeNewPlayer(final Connection connection, final ServerPlayer player, final CommonListenerCookie cookie) {
|
||||||
player.isRealPlayer = true; // Paper
|
player.isRealPlayer = true; // Paper
|
||||||
player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
|
player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
|
||||||
@@ -295,6 +414,7 @@ public abstract class PlayerList {
|
@@ -295,6 +415,7 @@ public abstract class PlayerList {
|
||||||
|
|
||||||
// player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below
|
// player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below
|
||||||
this.players.add(player);
|
this.players.add(player);
|
||||||
@@ -462,7 +463,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
|
|||||||
this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot
|
this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot
|
||||||
this.playersByUUID.put(player.getUUID(), player);
|
this.playersByUUID.put(player.getUUID(), player);
|
||||||
// this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); // CraftBukkit - replaced with loop below
|
// this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); // CraftBukkit - replaced with loop below
|
||||||
@@ -510,6 +630,7 @@ public abstract class PlayerList {
|
@@ -510,6 +631,7 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void save(final ServerPlayer player) {
|
protected void save(final ServerPlayer player) {
|
||||||
@@ -470,7 +471,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
|
|||||||
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
|
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
|
||||||
player.lastSave = System.nanoTime(); // Folia - region threading - changed to nanoTime tracking
|
player.lastSave = System.nanoTime(); // Folia - region threading - changed to nanoTime tracking
|
||||||
this.playerIo.save(player);
|
this.playerIo.save(player);
|
||||||
@@ -524,6 +645,48 @@ public abstract class PlayerList {
|
@@ -524,6 +646,48 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +520,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
|
|||||||
public net.kyori.adventure.text.@Nullable Component remove(final ServerPlayer player) { // CraftBukkit - return string // Paper - return Component
|
public net.kyori.adventure.text.@Nullable Component remove(final ServerPlayer player) { // CraftBukkit - return string // Paper - return Component
|
||||||
// Paper start - Fix kick event leave message not being sent
|
// Paper start - Fix kick event leave message not being sent
|
||||||
return this.remove(player, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? player.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(player.getDisplayName())));
|
return this.remove(player, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? player.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(player.getDisplayName())));
|
||||||
@@ -597,6 +760,7 @@ public abstract class PlayerList {
|
@@ -597,6 +761,7 @@ public abstract class PlayerList {
|
||||||
player.getBukkitEntity().packetProcessor.close(); // Folia - region threading
|
player.getBukkitEntity().packetProcessor.close(); // Folia - region threading
|
||||||
player.getAdvancements().clearTriggers();
|
player.getAdvancements().clearTriggers();
|
||||||
this.players.remove(player);
|
this.players.remove(player);
|
||||||
@@ -527,7 +528,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
|
|||||||
this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
||||||
if (me.earthme.luminol.config.modules.misc.UsernameCheckConfig.allowOldPlayersJoin) this.playedPlayers.remove(player.getGameProfile().name()); // Leaf - Configurable vanilla username check
|
if (me.earthme.luminol.config.modules.misc.UsernameCheckConfig.allowOldPlayersJoin) this.playedPlayers.remove(player.getGameProfile().name()); // Leaf - Configurable vanilla username check
|
||||||
this.server.getCustomBossEvents().onPlayerDisconnect(player);
|
this.server.getCustomBossEvents().onPlayerDisconnect(player);
|
||||||
@@ -910,15 +1074,15 @@ public abstract class PlayerList {
|
@@ -910,15 +1075,15 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPlayerNamesArray() {
|
public String[] getPlayerNamesArray() {
|
||||||
|
|||||||
@@ -268,10 +268,10 @@ index 77b9cd3d14eddc735d9131597916405fde4230ec..b23a47380fb1178696dc49e35d2c3d7d
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Player {} was dropping items too fast in creative mode, ignoring.", this.player.getPlainTextName());
|
LOGGER.warn("Player {} was dropping items too fast in creative mode, ignoring.", this.player.getPlainTextName());
|
||||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||||
index 64a87785048e103c10f6453e97a37f8501255adc..432a6dfff8e45eccea653b0d4cf04956edec6d98 100644
|
index 575b4eabcaac48ae87b69dd037493ebfe0a1212c..516561a25d28f2c7bcc3e71c5f2f9da99c2899c3 100644
|
||||||
--- a/net/minecraft/server/players/PlayerList.java
|
--- a/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/net/minecraft/server/players/PlayerList.java
|
+++ b/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -279,7 +279,7 @@ public abstract class PlayerList {
|
@@ -280,7 +280,7 @@ public abstract class PlayerList {
|
||||||
// org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
|
// org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
|
||||||
|
|
||||||
// Leaves start - bot support
|
// Leaves start - bot support
|
||||||
@@ -280,7 +280,7 @@ index 64a87785048e103c10f6453e97a37f8501255adc..432a6dfff8e45eccea653b0d4cf04956
|
|||||||
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
|
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
|
||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
|
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
|
||||||
@@ -441,7 +441,7 @@ public abstract class PlayerList {
|
@@ -442,7 +442,7 @@ public abstract class PlayerList {
|
||||||
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
|
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
|
||||||
|
|
||||||
// Leaves start - bot support
|
// Leaves start - bot support
|
||||||
@@ -289,7 +289,7 @@ index 64a87785048e103c10f6453e97a37f8501255adc..432a6dfff8e45eccea653b0d4cf04956
|
|||||||
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
|
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
|
||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
|
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
|
||||||
@@ -969,7 +969,7 @@ public abstract class PlayerList {
|
@@ -970,7 +970,7 @@ public abstract class PlayerList {
|
||||||
).callEvent();
|
).callEvent();
|
||||||
// Paper end
|
// Paper end
|
||||||
// Leaves start - bot support
|
// Leaves start - bot support
|
||||||
|
|||||||
+2
-2
@@ -66,10 +66,10 @@ index cef9c7887332b91e2466a97a5250db81f7af0dcf..a17212c1910ce9490fe8df8c4ef507e2
|
|||||||
|
|
||||||
public Set<ThrownEnderpearl> getEnderPearls() {
|
public Set<ThrownEnderpearl> getEnderPearls() {
|
||||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||||
index 432a6dfff8e45eccea653b0d4cf04956edec6d98..835c13ff69592951261f917ad999d9a7689e802c 100644
|
index 516561a25d28f2c7bcc3e71c5f2f9da99c2899c3..eb652157ef25e83b897f52aff3c49c09c6f656c8 100644
|
||||||
--- a/net/minecraft/server/players/PlayerList.java
|
--- a/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/net/minecraft/server/players/PlayerList.java
|
+++ b/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -748,11 +748,13 @@ public abstract class PlayerList {
|
@@ -749,11 +749,13 @@ public abstract class PlayerList {
|
||||||
player.unRide();
|
player.unRide();
|
||||||
|
|
||||||
for (ThrownEnderpearl enderpearl : player.getEnderPearls()) {
|
for (ThrownEnderpearl enderpearl : player.getEnderPearls()) {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import net.minecraft.network.protocol.game.*;
|
|||||||
import net.minecraft.network.protocol.login.ClientboundLoginFinishedPacket;
|
import net.minecraft.network.protocol.login.ClientboundLoginFinishedPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.RegistryLayer;
|
import net.minecraft.server.RegistryLayer;
|
||||||
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import net.minecraft.server.packs.repository.KnownPack;
|
import net.minecraft.server.packs.repository.KnownPack;
|
||||||
import net.minecraft.tags.TagNetworkSerialization;
|
import net.minecraft.tags.TagNetworkSerialization;
|
||||||
import net.minecraft.world.entity.EntityTypes;
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
@@ -94,6 +95,11 @@ public class Recorder extends Connection {
|
|||||||
this.channel = new LocalChannel();
|
this.channel = new LocalChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void bind(ServerGamePacketListenerImpl listener) {
|
||||||
|
this.packetListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user