9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-api/paper-patches/features/0006-Replay-Mod-API.patch
violetc d5c9306a7f 1.21.4 (#413)
* init 1.21.4, and boom!

* build change, but weight not work

* just work

* Build changes, and delete timings

* Fix API patches (#406)

* Fix API patches

* merge

---------

Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>

* 0006/0129

* 0009/0129

* 0011/0129

* 0018/0129

* 0030/0129

* 0035/0129

* 0043/0129

* 0048/0129

* 0049/0129

* 0057/0129

* 0065/0129

* 0086/0129 (#408)

* 0072/0129

* 0080/0129

* Readd patch infos

* 0086/0129

* Delete applied patches

* 0087/0129

* 0091/0129

* 0097/0129

* 0101/0129

* 102/129

* 0107/0129

* 0112/0129

* 0118/0129

* 0129/0129, 100% patched

* fix some

* server work

* Protocol... (#409)

* Jade v7

* Fix changed part for Jade

* Formatting imports, add Lms Paster protocol

* REI payloads 5/8

* Add REI support, remove unnecessary content in Jade

* Rename

* Make jade better

* Make action work

* fix action jar

* Fix some protocol

* Fix bot action, and entity tickCount

* Fix Warden GameEventListener register on load

* Fix extra Raider drop

* Fix grindstone overstacking

* Update Paper, and some doc

* Merge

* [ci skip] Update Action

---------

Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
2025-02-14 23:55:46 +08:00

139 lines
4.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Date: Sun, 26 Jan 2025 01:39:16 -0500
Subject: [PATCH] Replay Mod API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 8185c76052d7af4c2ea83805a9ee6c709148d3c3..9564d2e3f3126104f73a1942ea5c45a69ebb158a 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2990,6 +2990,11 @@ public final class Bukkit {
return server.getBotManager();
}
// Leaves end - Bot API
+ // Leaves start - Photographer API
+ public static @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager() {
+ return server.getPhotographerManager();
+ }
+ // Leaves end - Photographer API
@NotNull
public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 430fb104e3190ae0ef9a08627c7c0d0d636898c8..991ec55218da08377bb71272fd6bca9f3bed0582 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -67,6 +67,7 @@ import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.entity.BotManager;
+import org.leavesmc.leaves.entity.PhotographerManager;
/**
* Represents a server implementation.
@@ -2668,4 +2669,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull BotManager getBotManager();
// Leaves end - Bot API
+ // Leaves start - Photographer API
+ @NotNull PhotographerManager getPhotographerManager();
+ // Leaves end - Photographer API
}
diff --git a/src/main/java/org/leavesmc/leaves/entity/Photographer.java b/src/main/java/org/leavesmc/leaves/entity/Photographer.java
new file mode 100644
index 0000000000000000000000000000000000000000..cc4226c59aa9f5942bd90e270c5bcd8b354139dd
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/Photographer.java
@@ -0,0 +1,27 @@
+package org.leavesmc.leaves.entity;
+
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+
+public interface Photographer extends Player {
+
+ @NotNull
+ public String getId();
+
+ public void setRecordFile(@NotNull File file);
+
+ public void stopRecording();
+
+ public void stopRecording(boolean async);
+
+ public void stopRecording(boolean async, boolean save);
+
+ public void pauseRecording();
+
+ public void resumeRecording();
+
+ public void setFollowPlayer(@Nullable Player player);
+}
diff --git a/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java b/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..492414e9328b3a0cde2157068f00e60eb5e978c6
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java
@@ -0,0 +1,33 @@
+package org.leavesmc.leaves.entity;
+
+import org.bukkit.Location;
+import org.bukkit.util.Consumer;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.leavesmc.leaves.entity.botaction.CustomBotAction;
+import org.leavesmc.leaves.replay.BukkitRecorderOption;
+
+import java.util.Collection;
+import java.util.UUID;
+
+public interface PhotographerManager {
+ @Nullable
+ public Photographer getPhotographer(@NotNull UUID uuid);
+
+ @Nullable
+ public Photographer getPhotographer(@NotNull String id);
+
+ @Nullable
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location);
+
+ @Nullable
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location, @NotNull BukkitRecorderOption recorderOption);
+
+ public void removePhotographer(@NotNull String id);
+
+ public void removePhotographer(@NotNull UUID uuid);
+
+ public void removeAllPhotographers();
+
+ public Collection<Photographer> getPhotographers();
+}
diff --git a/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java b/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java
new file mode 100644
index 0000000000000000000000000000000000000000..320e8bc0516580d946fa43671bd71094eade0422
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java
@@ -0,0 +1,18 @@
+package org.leavesmc.leaves.replay;
+
+public class BukkitRecorderOption {
+
+ // public int recordDistance = -1;
+ public String serverName = "Leaves";
+ public BukkitRecordWeather forceWeather = BukkitRecordWeather.NULL;
+ public int forceDayTime = -1;
+ public boolean ignoreChat = false;
+ // public boolean ignoreItem = false;
+
+ public enum BukkitRecordWeather {
+ CLEAR,
+ RAIN,
+ THUNDER,
+ NULL
+ }
+}