Skip to content

Commit

Permalink
use deprecated instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumine1909 committed Jul 3, 2024
1 parent ee22317 commit 6af5a65
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
20 changes: 18 additions & 2 deletions patches/api/0003-Add-fakeplayer-api.patch
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ index 0000000000000000000000000000000000000000..922ca5b27bc0dd443d635646f37f8795
+}
diff --git a/src/main/java/org/leavesmc/leaves/entity/BotManager.java b/src/main/java/org/leavesmc/leaves/entity/BotManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..c9dbe0b350057c9e256009f1a2651c24da2d9071
index 0000000000000000000000000000000000000000..ee6848b8990c516aa5c5490546dd16ae5c909740
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/BotManager.java
@@ -0,0 +1,108 @@
@@ -0,0 +1,124 @@
+package org.leavesmc.leaves.entity;
+
+import org.bukkit.Location;
Expand Down Expand Up @@ -168,6 +168,22 @@ index 0000000000000000000000000000000000000000..c9dbe0b350057c9e256009f1a2651c24
+ * @param skin fakeplayer skin arr
+ * @param skinName fakeplayer skin name
+ * @param location a location will create fakeplayer
+ * @return a fakeplayer if success, null otherwise
+ */
+ @Deprecated(since = "1.21")
+ @Nullable
+ public Bot createBot(@NotNull String name, @NotNull String realName, @Nullable String[] skin, @Nullable String skinName, @NotNull Location location);
+
+ /**
+ * Creates a fakeplayer with given param.
+ * <p>
+ * prefix and suffix will not be added.
+ *
+ * @param name fakeplayer name
+ * @param realName fakeplayer real name
+ * @param skin fakeplayer skin arr
+ * @param skinName fakeplayer skin name
+ * @param location a location will create fakeplayer
+ * @param consumer a consumer after create fakeplayer success
+ * @return a fakeplayer if you support skin arr and the creation is success, null otherwise
+ */
Expand Down
11 changes: 8 additions & 3 deletions patches/server/0010-Fakeplayer-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3289,10 +3289,10 @@ index 0000000000000000000000000000000000000000..fe1df01906f15e130cf947bbecb5df4b
+}
diff --git a/src/main/java/org/leavesmc/leaves/entity/CraftBotManager.java b/src/main/java/org/leavesmc/leaves/entity/CraftBotManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..473991896337afeb41b391e0c845c88ea995e614
index 0000000000000000000000000000000000000000..badd1d78398fc154254cd465c0a59c64b3fa500c
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/CraftBotManager.java
@@ -0,0 +1,97 @@
@@ -0,0 +1,102 @@
+package org.leavesmc.leaves.entity;
+
+import com.google.common.base.Function;
Expand Down Expand Up @@ -3332,7 +3332,12 @@ index 0000000000000000000000000000000000000000..473991896337afeb41b391e0c845c88e
+ }
+
+ @Override
+ public @Nullable Bot createBot(@NotNull String name, @NotNull String realName, @Nullable String[] skin, @Nullable String skinName, @NotNull Location location, @Nullable Consumer<Bot> consumer) {
+ public @Nullable Bot createBot(@NotNull String name, @NotNull String realName, @Nullable String[] skin, @Nullable String skinName, @NotNull Location location) {
+ return this.createBot(name, realName, skin, skinName, location, null);
+ }
+
+ @Override
+ public @Nullable Bot createBot(@NotNull String name, @NotNull String realName, @NotNull String[] skin, @Nullable String skinName, @NotNull Location location, @Nullable Consumer<Bot> consumer) {
+ return new ServerBot.BotCreateState(location, name, realName, skinName, skin, BotCreateEvent.CreateReason.PLUGIN, null).create((serverBot -> {
+ if (consumer != null) {
+ consumer.accept(serverBot.getBukkitPlayer());
Expand Down

0 comments on commit 6af5a65

Please sign in to comment.