mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
139 lines
4.9 KiB
Diff
139 lines
4.9 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 5f6078bc80e20c9482a96d2bf1095bb32fbfc28c..d0a9b96f4ab200892d589a68b27585a08780f7ac 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -2927,6 +2927,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 133ae299ba12e0da9c5fa252a06bbf4f2b7b9016..f752dbd0ed8a62cb2b7c812925dde645c3ecb85c 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -63,6 +63,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.
|
|
@@ -2572,4 +2573,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
|
|
+ }
|
|
+}
|