Skip to content

Commit

Permalink
#20240603.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonCaramel committed Jun 2, 2024
1 parent 8610d97 commit a7355b9
Show file tree
Hide file tree
Showing 3 changed files with 456 additions and 126 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version = 1.20.4-R0.1-SNAPSHOT

mcVersion = 1.20.4

paperCommit = 7ac24a18940da12beb39a030113f6e459f348e2f
paperCommit = ba31f4128208e954d6648001724887352f71ece9

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
84 changes: 83 additions & 1 deletion patches/0004-Add-more-Player-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,90 @@ index 7411f58f9f36beaadcc47c2264a4af313956ee03..201fe24d393beb8d0be4c4212aff5643
@NotNull
@Override
public HandlerList getHandlers() {
diff --git a/src/main/java/moe/caramel/daydream/event/player/AsyncPlayerDataPreLoadEvent.java b/src/main/java/moe/caramel/daydream/event/player/AsyncPlayerDataPreLoadEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..96b35864b50695c27f22005aa5581e5c2bc38735
--- /dev/null
+++ b/src/main/java/moe/caramel/daydream/event/player/AsyncPlayerDataPreLoadEvent.java
@@ -0,0 +1,76 @@
+package moe.caramel.daydream.event.player;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
+import com.mojang.authlib.GameProfile;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import java.net.InetAddress;
+import java.util.UUID;
+
+/**
+ * 비동기 플레이어 데이터 사전 로드 이벤트
+ * <p>
+ * {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} 호출 이후에
+ * 플레이어의 {@link GameProfile}이 완성되면 호출됩니다.
+ * </p>
+ */
+public abstract class AsyncPlayerDataPreLoadEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+ public @NotNull HandlerList getHandlers() { return HANDLER_LIST; }
+ public static @NotNull HandlerList getHandlerList() { return HANDLER_LIST; }
+
+ @ApiStatus.Internal
+ public AsyncPlayerDataPreLoadEvent() {
+ super(true);
+ }
+
+ /**
+ * 플레이어의 프로필을 가져옵니다.
+ *
+ * @return 플레이어의 프로필
+ */
+ @NotNull
+ public abstract GameProfile getGameProfile();
+
+ /**
+ * 플레이어의 프로필을 가져옵니다.
+ *
+ * @deprecated 메서드를 호출할 때마다 새로운 프로필 미러가 생성됩니다.
+ * {@link #getGameProfile()}를 사용하세요.
+ * @return 플레이어의 프로필
+ */
+ @NotNull
+ @Deprecated
+ public abstract PlayerProfile getProfile();
+
+ /**
+ * 플레이어의 이름을 가져옵니다.
+ *
+ * @return 플레이어의 이름
+ */
+ @NotNull
+ public final String getName() {
+ return getGameProfile().getName();
+ }
+
+ /**
+ * 플레이어의 UUID를 가져옵니다.
+ *
+ * @return 플레이어의 UUID
+ */
+ @NotNull
+ public final UUID getUniqueId() {
+ return getGameProfile().getId();
+ }
+
+ /**
+ * 플레이어의 IP 주소를 가져옵니다.
+ *
+ * @return 플레이어의 IP 주소
+ */
+ @NotNull
+ public abstract InetAddress getAddress();
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c6cb4f17469a8f2e60dd3e28d41402851ce5fb21..e95cb88e22b607e193bade4eadf635b4704d14e0 100644
index d048ae07cc33fd77d128cc1ebf88b0804969fa3c..ecdef5d7376668f15cd5ef778cc86ba860748f6a 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1939,6 +1939,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
Expand Down
Loading

0 comments on commit a7355b9

Please sign in to comment.