mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
API patches done
This commit is contained in:
146
patches/api/0010-Leaves-Replay-Mod-API.patch
Normal file
146
patches/api/0010-Leaves-Replay-Mod-API.patch
Normal file
@@ -0,0 +1,146 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 3 Aug 2023 20:36:38 +0800
|
||||
Subject: [PATCH] Leaves: Replay Mod API
|
||||
|
||||
Co-authored-by: alazeprt <nono135246@126.com>
|
||||
|
||||
Original license: GPLv3
|
||||
Original project: https://github.com/LeavesMC/Leaves
|
||||
|
||||
This patch is Powered by ReplayMod(https://github.com/ReplayMod)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 2477a560ed345116cd9d4e90f98694b84a1faf28..17d3f7839de56821d51a3008c73e78f1bedc98ad 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -3158,4 +3158,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 582c1f053020dff2cde8a1a7a1a760a84e856b7c..b3f3e70382f0c1e497d71c4490ee06740d7fa27a 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.
|
||||
@@ -2806,4 +2807,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
|
||||
Reference in New Issue
Block a user