diff --git a/patches/server/0106-Replay-Mod-API.patch b/patches/server/0106-Replay-Mod-API.patch index 3c25f290..8b3776a4 100644 --- a/patches/server/0106-Replay-Mod-API.patch +++ b/patches/server/0106-Replay-Mod-API.patch @@ -133,7 +133,7 @@ index 2e2a7c2cf3081187da817479a9da3eb10f662a6d..ee616fe98c98a345872c1eadf41c7852 }).map((player) -> { return player.getGameProfile().getName(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6745b01c324589ae14b4162729e087efb29116d8..a4883bb9d296fb068351f0bcc13c41a8bda95286 100644 +index 06f21b59c7a152c02d03508c1f9c6799ae3abb58..cb1b08063abf7cf2c1b44922b2d9f50ccf0effa7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -299,7 +299,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -410,7 +410,7 @@ index 79c10c26e9a27b120070b408e261a26bb66a5082..70b4f5dc96e285184bd3e676397c6bdd + // Leaves end - replay mod api } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 76e4d5b788e1049120e415906bb79e9f222148b2..50160da2fcc5658bc7db181075fa8e01dbd71aee 100644 +index 0c5a8bb69f4b0a3df29f7316a597fe4666cd5fcd..a303eb0aaf03f41f89a1dde75e3fcb701d96672b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -59,6 +59,8 @@ import top.leavesmc.leaves.bot.ServerBot; @@ -1261,7 +1261,7 @@ index 0000000000000000000000000000000000000000..852f2098d93d4437fe79af06e454d849 +} diff --git a/src/main/java/top/leavesmc/leaves/replay/ServerPhotographer.java b/src/main/java/top/leavesmc/leaves/replay/ServerPhotographer.java new file mode 100644 -index 0000000000000000000000000000000000000000..27005d997eb1e3f4a3b1a357f818586d55c5c88c +index 0000000000000000000000000000000000000000..7818db1ca51fd61c96a74bec3d31a0c1d5efe4cc --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/replay/ServerPhotographer.java @@ -0,0 +1,216 @@ @@ -1307,6 +1307,7 @@ index 0000000000000000000000000000000000000000..27005d997eb1e3f4a3b1a357f818586d + + private ServerPhotographer(MinecraftServer server, ServerLevel world, GameProfile profile) { + super(server, world, profile, ClientInformation.createDefault()); ++ this.gameMode = new ServerPhotographerGameMode(this); + this.followPlayer = null; + this.stats = new BotStatsCounter(server); + this.lastPos = this.position(); @@ -1329,7 +1330,6 @@ index 0000000000000000000000000000000000000000..27005d997eb1e3f4a3b1a357f818586d + + photographer.recorder.start(); + MinecraftServer.getServer().getPlayerList().placeNewPhotographer(photographer.recorder, photographer, world, state.loc); -+ photographer.setGameMode(GameType.SPECTATOR); + photographer.serverLevel().chunkSource.move(photographer); + photographer.setInvisible(true); + photographers.add(photographer); @@ -1481,6 +1481,47 @@ index 0000000000000000000000000000000000000000..27005d997eb1e3f4a3b1a357f818586d + } + } +} +diff --git a/src/main/java/top/leavesmc/leaves/replay/ServerPhotographerGameMode.java b/src/main/java/top/leavesmc/leaves/replay/ServerPhotographerGameMode.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8a1cd9b1fe9823d5a9f578ced54ec25e75d44208 +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/replay/ServerPhotographerGameMode.java +@@ -0,0 +1,35 @@ ++package top.leavesmc.leaves.replay; ++ ++import net.kyori.adventure.text.Component; ++import net.minecraft.server.level.ServerPlayerGameMode; ++import net.minecraft.world.level.GameType; ++import org.bukkit.event.player.PlayerGameModeChangeEvent; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public class ServerPhotographerGameMode extends ServerPlayerGameMode { ++ ++ public ServerPhotographerGameMode(ServerPhotographer photographer) { ++ super(photographer); ++ super.setGameModeForPlayer(GameType.SPECTATOR, null); ++ } ++ ++ @Override ++ public boolean changeGameModeForPlayer(@NotNull GameType gameMode) { ++ return false; ++ } ++ ++ @Nullable ++ @Override ++ public PlayerGameModeChangeEvent changeGameModeForPlayer(@NotNull GameType gameMode, PlayerGameModeChangeEvent.@NotNull Cause cause, @Nullable Component cancelMessage) { ++ return null; ++ } ++ ++ @Override ++ protected void setGameModeForPlayer(@NotNull GameType gameMode, @Nullable GameType previousGameMode) { ++ } ++ ++ @Override ++ public void tick() { ++ } ++} diff --git a/src/main/java/top/leavesmc/leaves/util/UUIDSerializer.java b/src/main/java/top/leavesmc/leaves/util/UUIDSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..1329a725a2bd03d3ef6d7131d8bc77f20bf2e566