Skip to content

Commit

Permalink
Fix fakeplayer.always-send-data (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Sep 4, 2023
1 parent 5aa3aac commit 80e4535
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
22 changes: 18 additions & 4 deletions patches/server/0008-Fakeplayer-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ index b382da838acc04a1c5d89064b4fa43bcdd38ae71..0cc848a600fa0f8af4f5f991834dd1d0
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..5ec8999aa305f614b605d7e858d9e817b1830735 100644
index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..c64c53075efdefc5bb845f954de87c3f3f9d3fcf 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -81,6 +81,7 @@ import net.minecraft.server.ServerScoreboard;
Expand Down Expand Up @@ -187,7 +187,21 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..5ec8999aa305f614b605d7e858d9e817
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();

if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
@@ -1095,11 +1110,16 @@ public abstract class PlayerList {
@@ -985,6 +1000,13 @@ public abstract class PlayerList {
}
// Paper end

+ // Leaves start - bot support
+ if (top.leavesmc.leaves.LeavesConfig.fakeplayerSupport) {
+ top.leavesmc.leaves.bot.ServerBot.getBots().forEach(bot1 ->
+ bot1.render(entityplayer1, true)); // Leaves - render bot
+ }
+ // Leaves end - bot support
+
// CraftBukkit end
return entityplayer1;
}
@@ -1095,11 +1117,16 @@ public abstract class PlayerList {
}

public String[] getPlayerNamesArray() {
Expand All @@ -205,7 +219,7 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..5ec8999aa305f614b605d7e858d9e817

return astring;
}
@@ -1578,4 +1598,16 @@ public abstract class PlayerList {
@@ -1578,4 +1605,16 @@ public abstract class PlayerList {
public boolean isAllowCheatsForAllPlayers() {
return this.allowCheatsForAllPlayers;
}
Expand Down Expand Up @@ -361,7 +375,7 @@ index 2dbe8b870fd39b4d22e9725912f443757ae70761..8388c2a56cbe531cf5f60a18866c85fa
}
// Water Animals
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index c02c51f824be1173d24b20394b5855fc857fc0a4..8b19b4c7d3d14d57a2eb3674b63ff352b0fe83bd 100644
index d739f8b96caea228335543f412546d187c7f246c..904d1fe0bf325c09b67e43bdaa81c902d57b8e26 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -8,6 +8,9 @@ import org.bukkit.command.Command;
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0016-No-chat-sign.patch
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ index 3c0651fa5a5db880202c9a3805a6455269c5f16d..434e5e1fd280dc5b1bd29fc2a196ce0b
if (packet == null || this.processedDisconnect) { // Spigot
return;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5ec8999aa305f614b605d7e858d9e817b1830735..1cdf89c196f34b0036e14c3e445e67306cb026a5 100644
index c64c53075efdefc5bb845f954de87c3f3f9d3fcf..bdf17bce2b4c0a2c64abefcc82a6e9690f96d186 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1459,7 +1459,7 @@ public abstract class PlayerList {
@@ -1466,7 +1466,7 @@ public abstract class PlayerList {
}

public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0043-BBOR-Protocol.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] BBOR Protocol


diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8f2d2e27a4296d6cb5f1fe4ff83781d81b9331a2..9e68a0da8be6483319e070d4641eab85c75a38a1 100644
index 745ab8b97e6bf3e9a1621558883711eab25f8725..8150ac9c98a30afff5fc04fdec8af6d340c4b9f5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1602,6 +1602,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand All @@ -32,7 +32,7 @@ index 2ed3fba5de71bb36187b8a65f65673a4f426cfd0..4004b3d068b97efa835798b05aa424d0
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2fa9e5e6d513b47e613a7b8f0c9caf463fec2a40..0e7d232fc61fac147df01f17fa30102f35a22435 100644
index 0ca2aca30468ecce20970354b1faf24b3a58a00f..ecdf7bc56ad035881cbb0c36d7fbad7bb11ab442 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -357,6 +357,7 @@ public abstract class PlayerList {
Expand All @@ -51,7 +51,7 @@ index 2fa9e5e6d513b47e613a7b8f0c9caf463fec2a40..0e7d232fc61fac147df01f17fa30102f
// Paper end
ServerLevel worldserver = entityplayer.serverLevel();

@@ -1593,7 +1595,7 @@ public abstract class PlayerList {
@@ -1600,7 +1602,7 @@ public abstract class PlayerList {
entityplayer.connection.send(packetplayoutrecipeupdate);
entityplayer.getRecipeBook().sendInitialRecipeBook(entityplayer);
}
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0055-Xaero-Map-Protocol.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Xaero Map Protocol


diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 8b487c8dc7aee2dda7a20077b6dad50a5a29dbf4..fed72c6fef684758be756602f57393d088bac50d 100644
index d345dbbe76fdef80834bcacee7862d7115e12dd3..c81d0a6e534d54db00c5f4595df0478a8342dfaf 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1304,6 +1304,7 @@ public abstract class PlayerList {
@@ -1311,6 +1311,7 @@ public abstract class PlayerList {
player.connection.send(new ClientboundInitializeBorderPacket(worldborder));
player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle()));
Expand Down
8 changes: 4 additions & 4 deletions patches/server/0121-Delete-Timings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ index f8edbc95ffe7de0341e5724ad3efe69c74e95a07..2390788d6a472d900e1cf014e4c4a683
// Paper start
if (waitableArray[0] != null) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 0e0a987bf1baff5b0f907a3c0b4dfa444de6ba12..5887bca09af6c5a8b4d05258016309d5a96a7fc4 100644
index 7d0a532921ef6b18da235cbea3437ae554221c5c..975c18cf108b754f358942c81781a4717686f6bb 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,13 +1,10 @@
Expand Down Expand Up @@ -1712,7 +1712,7 @@ index 43dc38afc03323ebf4192f58a7703402f9379ade..e22cf5ed3c905d0536cad7ac23b7d94f
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f76142b61dc44ebf6312a3027fa9b66ff2a37653..916c159fdd3d9e7300d0a50adbc31ec839b44ad8 100644
index 383ed8f9962ea4b9c00aa3c8c4d877e42dd8ac16..0fb91e5180d49530ddf796ec5e69b2176ffc44d3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1,6 +1,5 @@
Expand All @@ -1722,15 +1722,15 @@ index f76142b61dc44ebf6312a3027fa9b66ff2a37653..916c159fdd3d9e7300d0a50adbc31ec8
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1418,7 +1417,6 @@ public abstract class PlayerList {
@@ -1425,7 +1424,6 @@ public abstract class PlayerList {

public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
- MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0;
long now = MinecraftServer.currentTick;
for (int i = 0; i < this.players.size(); ++i) {
@@ -1429,7 +1427,6 @@ public abstract class PlayerList {
@@ -1436,7 +1434,6 @@ public abstract class PlayerList {
}
// Paper end
}
Expand Down

0 comments on commit 80e4535

Please sign in to comment.