-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33abe33
commit b5fc674
Showing
2 changed files
with
241 additions
and
26 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,102 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: MC_XiaoHei <[email protected]> | ||
Date: Sat, 3 Aug 2024 12:24:14 +0800 | ||
Subject: [PATCH] FakePlayer API | ||
|
||
|
||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java | ||
index 15049641b8123abf03edcbb49257fb4f3db0a5ec..7e3c30ac8dfda0453949dff00f8f0428dfb19b6d 100644 | ||
--- a/src/main/java/org/bukkit/Bukkit.java | ||
+++ b/src/main/java/org/bukkit/Bukkit.java | ||
@@ -202,6 +202,21 @@ public final class Bukkit { | ||
return server.getOnlinePlayers(); | ||
} | ||
|
||
+ // Lumina start - player type | ||
+ | ||
+ /** | ||
+ * Same as {@link #getOnlinePlayers()} but with a player type filter | ||
+ * | ||
+ * @param playerType the type of player to get | ||
+ * | ||
+ * @return a view of currently online players. | ||
+ */ | ||
+ @NotNull | ||
+ public Collection<? extends Player> getOnlinePlayers(@NotNull org.leavesmc.lumina.utils.PlayerType playerType) { | ||
+ return server.getOnlinePlayers(playerType); | ||
+ } | ||
+ // Lumina end - player type | ||
+ | ||
/** | ||
* Get the maximum amount of players which can login to this server. | ||
* | ||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java | ||
index 1f51f80e8516cfac7ed4078ed96e535389a31f25..0dab1de3c3869a5c23a995f804c826d42ffaa40f 100644 | ||
--- a/src/main/java/org/bukkit/Server.java | ||
+++ b/src/main/java/org/bukkit/Server.java | ||
@@ -159,6 +159,19 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi | ||
@NotNull | ||
public Collection<? extends Player> getOnlinePlayers(); | ||
|
||
+ // Lumina start - player type | ||
+ | ||
+ /** | ||
+ * Same as {@link #getOnlinePlayers()} but with a player type filter | ||
+ * | ||
+ * @param playerType the type of player to get | ||
+ * | ||
+ * @return a view of currently online players. | ||
+ */ | ||
+ @NotNull | ||
+ public Collection<? extends Player> getOnlinePlayers(@NotNull org.leavesmc.lumina.utils.PlayerType playerType); | ||
+ // Lumina end - player type | ||
+ | ||
/** | ||
* Get the maximum amount of players which can login to this server. | ||
* | ||
diff --git a/src/main/java/org/leavesmc/lumina/entity/FakePlayer.java b/src/main/java/org/leavesmc/lumina/entity/FakePlayer.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..d79a3be1e73317641121e2a2edc7abbfb0929d82 | ||
--- /dev/null | ||
+++ b/src/main/java/org/leavesmc/lumina/entity/FakePlayer.java | ||
@@ -0,0 +1,26 @@ | ||
+package org.leavesmc.lumina.entity; | ||
+ | ||
+public interface FakePlayer { | ||
+ | ||
+ void startAction(ActionType actionType, int limit, int interval, boolean continuous); | ||
+ | ||
+ default void startActionOnce(ActionType actionType) { | ||
+ startAction(actionType, 1, 1, false); | ||
+ } | ||
+ | ||
+ default void startActionTimes(ActionType actionType, int times) { | ||
+ startAction(actionType, times, 1, false); | ||
+ } | ||
+ | ||
+ default void startActionContinuous(ActionType actionType) { | ||
+ startAction(actionType, -1, 1, true); | ||
+ } | ||
+ | ||
+ default void startActionInterval(ActionType actionType, int interval) { | ||
+ startAction(actionType, -1, interval, false); | ||
+ } | ||
+ | ||
+ enum ActionType { | ||
+ USE, ATTACK, JUMP, DROP_ITEM, DROP_STACK, SWAP_HANDS | ||
+ } | ||
+} | ||
diff --git a/src/main/java/org/leavesmc/lumina/utils/PlayerType.java b/src/main/java/org/leavesmc/lumina/utils/PlayerType.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..c8f8f3ab26bbfe9c52f02659d642281e59ed7b48 | ||
--- /dev/null | ||
+++ b/src/main/java/org/leavesmc/lumina/utils/PlayerType.java | ||
@@ -0,0 +1,7 @@ | ||
+package org.leavesmc.lumina.utils; | ||
+ | ||
+public enum PlayerType { | ||
+ REAL, | ||
+ FAKE, | ||
+ GHOST | ||
+} | ||
\ No newline at end of file |
Oops, something went wrong.