-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: MC_XiaoHei <[email protected]>
- Loading branch information
1 parent
9be1301
commit c8c4bc3
Showing
2 changed files
with
1,462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: MC_XiaoHei <[email protected]> | ||
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 99a096e52775a58a38540dfd736b0f57236fd488..b27286fbeb4ce148d2c4d890a07d14c221ef7886 100644 | ||
--- a/src/main/java/org/bukkit/Bukkit.java | ||
+++ b/src/main/java/org/bukkit/Bukkit.java | ||
@@ -58,6 +58,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 | ||
@@ -2669,6 +2670,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 0bfe5628c8327e9cd5728cea7ae6c2ce1ec9541d..b61151a99ec9d62bc8cf3fa39c71d452dc9964ed 100644 | ||
--- a/src/main/java/org/bukkit/Server.java | ||
+++ b/src/main/java/org/bukkit/Server.java | ||
@@ -58,6 +58,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. | ||
@@ -2331,4 +2332,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..fbc57438293210fa4ee30327e01261db447c9de2 | ||
--- /dev/null | ||
+++ b/src/main/java/top/leavesmc/leaves/entity/Photographer.java | ||
@@ -0,0 +1,23 @@ | ||
+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 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..0b4e41f9e2b04d1acf79a89b471528e50cd59a5d | ||
--- /dev/null | ||
+++ b/src/main/java/top/leavesmc/leaves/replay/BukkitRecorderOption.java | ||
@@ -0,0 +1,16 @@ | ||
+package top.leavesmc.leaves.replay; | ||
+ | ||
+public class BukkitRecorderOption { | ||
+ | ||
+ // public int recordDistance = -1; | ||
+ public BukkitRecordWeather forceWeather = null; | ||
+ public int forceDayTime = -1; | ||
+ public boolean ignoreChat = false; | ||
+ // public boolean ignoreItem = false; | ||
+ | ||
+ public enum BukkitRecordWeather { | ||
+ CLEAR, | ||
+ RAIN, | ||
+ THUNDER | ||
+ } | ||
+} |
Oops, something went wrong.