mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-22 16:39:22 +00:00
140
patches/api/0011-add-replay-api.patch
Normal file
140
patches/api/0011-add-replay-api.patch
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: alazeprt <nono135246@126.com>
|
||||||
|
Date: Sun, 15 Sep 2024 19:48:42 +0800
|
||||||
|
Subject: [PATCH] add replay api
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
index ebf04da015cfe394e9c5d3a3c432674df979f93c..54e5190af7f4eed4a82dd4f6b3fa9554c074dec2 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
@@ -3111,4 +3111,10 @@ public final class Bukkit {
|
||||||
|
server.clearBlockHighlights();
|
||||||
|
}
|
||||||
|
// Purpur end
|
||||||
|
+
|
||||||
|
+ // Leaves start - Photographer API
|
||||||
|
+ public static @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager() {
|
||||||
|
+ return server.getPhotographerManager();
|
||||||
|
+ }
|
||||||
|
+ // Leaves end - Photographer API
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
|
index ab6e3eb18b9c36fdd8f56f491332085aa2ec0c37..7de6a91ef573e0a944207242518785d11381c640 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
|
@@ -62,6 +62,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.Contract;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
+import org.leavesmc.leaves.entity.PhotographerManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a server implementation.
|
||||||
|
@@ -2753,4 +2754,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
*/
|
||||||
|
void clearBlockHighlights();
|
||||||
|
// Purpur end
|
||||||
|
+
|
||||||
|
+ // 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..5b564dfd8aa882d0dc8b1833a4b46e1bba699876
|
||||||
|
--- /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);
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
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..ccb19e75748803eb9ad356ffcd0ccfd5145ed776
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java
|
||||||
|
@@ -0,0 +1,32 @@
|
||||||
|
+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.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();
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
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..c985721bdf6be0b8a154e7abfd50e0168965a8d1
|
||||||
|
--- /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 = "Leaf";
|
||||||
|
+ public BukkitRecordWeather forceWeather = BukkitRecordWeather.NULL;
|
||||||
|
+ public int forceDayTime = -1;
|
||||||
|
+ public boolean ignoreChat = false;
|
||||||
|
+ // public boolean ignoreItem = false;
|
||||||
|
+
|
||||||
|
+ public enum BukkitRecordWeather {
|
||||||
|
+ CLEAR,
|
||||||
|
+ RAIN,
|
||||||
|
+ THUNDER,
|
||||||
|
+ NULL
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
1694
patches/server/0102-add-replay-api.patch
Normal file
1694
patches/server/0102-add-replay-api.patch
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user