mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-20 07:19:35 +00:00
147 lines
5.2 KiB
Diff
147 lines
5.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MC_XiaoHei <xiaohei.xor7studio@foxmail.com>
|
|
Date: Sat, 5 Aug 2023 09:10:59 +0800
|
|
Subject: [PATCH] Replay Mod API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
index 824982037eb064d536ac09c303d3bdd225355a6a..7e92a652d47042dec050e4be08b57e2121ccd0bb 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -60,6 +60,7 @@ import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
import io.papermc.paper.util.JarManifests; // Paper
|
|
import top.leavesmc.leaves.entity.BotManager;
|
|
+import top.leavesmc.leaves.entity.PhotographerManager;
|
|
|
|
/**
|
|
* Represents the Bukkit core, for version and Server singleton handling
|
|
@@ -2891,6 +2892,11 @@ public final class Bukkit {
|
|
return server.getBotManager();
|
|
}
|
|
// Leaves end - Bot API
|
|
+ // Leaves start - Photographer API
|
|
+ public static @NotNull 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 34196590f64f1c65c691b305b402b888b524c1d7..d465633aab75def37a2b4a9f2a034071970c1dfa 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -60,6 +60,7 @@ import org.jetbrains.annotations.Contract;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
import top.leavesmc.leaves.entity.BotManager;
|
|
+import top.leavesmc.leaves.entity.PhotographerManager;
|
|
|
|
/**
|
|
* Represents a server implementation.
|
|
@@ -2536,4 +2537,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/top/leavesmc/leaves/entity/Photographer.java b/src/main/java/top/leavesmc/leaves/entity/Photographer.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..bfa6fe2a0ca095170aa5e073251402cf83a53ba0
|
|
--- /dev/null
|
|
+++ b/src/main/java/top/leavesmc/leaves/entity/Photographer.java
|
|
@@ -0,0 +1,27 @@
|
|
+package top.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/top/leavesmc/leaves/entity/PhotographerManager.java b/src/main/java/top/leavesmc/leaves/entity/PhotographerManager.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..4c2ef73e9668918d45d9e3ad250c7c20b1fb5dd1
|
|
--- /dev/null
|
|
+++ b/src/main/java/top/leavesmc/leaves/entity/PhotographerManager.java
|
|
@@ -0,0 +1,33 @@
|
|
+package top.leavesmc.leaves.entity;
|
|
+
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.util.Consumer;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+import top.leavesmc.leaves.entity.botaction.CustomBotAction;
|
|
+import top.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/top/leavesmc/leaves/replay/BukkitRecorderOption.java b/src/main/java/top/leavesmc/leaves/replay/BukkitRecorderOption.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..3df4a6055b91c28e273d6fb2697b608778f40a9c
|
|
--- /dev/null
|
|
+++ b/src/main/java/top/leavesmc/leaves/replay/BukkitRecorderOption.java
|
|
@@ -0,0 +1,18 @@
|
|
+package top.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
|
|
+ }
|
|
+}
|