mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 12:48:53 +01:00
da7138233f
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: ed0ec489 SPIGOT-7965: Unknown TransformReason for Hoglins 9db03457 SPIGOT-7964: Fix typo in Deprecation annotation d14119af PR-1082: Add "since" to Deprecation annotations e8a318d4 PR-1067: Add method to get Advancement requirements CraftBukkit Changes: 40dd796db SPIGOT-7971: NotSerializableException on serialize CraftUseCooldownComponent fa85c5e0a SPIGOT-7968: ProjectileHitEvent not trigerred when arrow hits entity b75b792ec SPIGOT-7970: World#getMaxHeight() returning incorrect value 2b9a094bb SPIGOT-7965: Unknown TransformReason for Hoglins fd3f5a380 SPIGOT-7966: Some trees do not generate with #generateTree f2822317c PR-1515: Add a Class reader and Class node argument provider 07abf6852 PR-1514: Add a test case for ClassTraverser a7577cb24 Fix Inventory#addItem not respecting max stack size 066a74e74 PR-1490: Add method to get Advancement requirements 4a1df30e4 PR-1512: Test Art class based on specific values instead of the implementation, to better catch implementation changes 53254c56f PR-1503: Simplify CAS loop to getAndSet e9447dc5e Make BlockDataMeta#setBlockData hide unspecified states dd08a7120 SPIGOT-7960: Fix inconsistency between natural item drop coordinates e9e8ed753 SPIGOT-7960: Improve natural item drop methods Spigot Changes: 60c9969b Rebuild patches
162 lines
8.6 KiB
Diff
162 lines
8.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Tue, 4 Jul 2023 11:27:18 -0700
|
|
Subject: [PATCH] Fix BanList API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/BanList.java
|
|
index 5829aca9e5aa700bd95f19db3ae032100f74d5a3..60aea29d51a8ad499401f94a7c326d9b415b6a3a 100644
|
|
--- a/src/main/java/org/bukkit/BanList.java
|
|
+++ b/src/main/java/org/bukkit/BanList.java
|
|
@@ -48,7 +48,7 @@ public interface BanList<T> {
|
|
*/
|
|
@Deprecated(since = "1.20.1")
|
|
@Nullable
|
|
- public BanEntry<T> getBanEntry(@NotNull String target);
|
|
+ public <E extends BanEntry<? super T>> E getBanEntry(@NotNull String target); // Paper
|
|
|
|
/**
|
|
* Gets a {@link BanEntry} by target.
|
|
@@ -77,7 +77,7 @@ public interface BanList<T> {
|
|
*/
|
|
@Deprecated(since = "1.20.1")
|
|
@Nullable
|
|
- public BanEntry<T> addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
|
|
+ public <E extends BanEntry<? super T>> E addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source); // Paper
|
|
|
|
/**
|
|
* Adds a ban to this list. If a previous ban exists, this will
|
|
@@ -140,7 +140,7 @@ public interface BanList<T> {
|
|
* @return an immutable set containing every entry tracked by this list
|
|
*/
|
|
@NotNull
|
|
- public Set<BanEntry<T>> getEntries();
|
|
+ public <E extends BanEntry<? super T>> Set<E> getEntries(); // Paper
|
|
|
|
/**
|
|
* Gets if a {@link BanEntry} exists for the target, indicating an active
|
|
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
|
index 9facde856fa9b1b8f2a6198a1b541b819ea12518..a8003b4796b3f80986043a9dbc2e6ad08a1bb4d7 100644
|
|
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
|
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
|
@@ -147,7 +147,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|
* (updated) previous ban
|
|
*/
|
|
@Nullable
|
|
- public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Date expires, @Nullable String source);
|
|
+ public <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E ban(@Nullable String reason, @Nullable Date expires, @Nullable String source); // Paper - fix ban list API
|
|
|
|
/**
|
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
|
@@ -161,7 +161,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|
* (updated) previous ban
|
|
*/
|
|
@Nullable
|
|
- public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source);
|
|
+ public <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source); // Paper - fix ban list API
|
|
|
|
/**
|
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
|
@@ -175,7 +175,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|
* (updated) previous ban
|
|
*/
|
|
@Nullable
|
|
- public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source);
|
|
+ public <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source); // Paper - fix ban list API
|
|
|
|
/**
|
|
* Checks if this player is whitelisted or not
|
|
diff --git a/src/main/java/org/bukkit/ban/ProfileBanList.java b/src/main/java/org/bukkit/ban/ProfileBanList.java
|
|
index e805e629cede1c4c0674282c930cb67852718c3e..5248cf08ef83c7304dd76c42a2f646bb81e0efae 100644
|
|
--- a/src/main/java/org/bukkit/ban/ProfileBanList.java
|
|
+++ b/src/main/java/org/bukkit/ban/ProfileBanList.java
|
|
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
|
|
/**
|
|
* A {@link BanList} targeting player profile bans.
|
|
*/
|
|
-public interface ProfileBanList extends BanList<PlayerProfile> {
|
|
+public interface ProfileBanList extends BanList<com.destroystokyo.paper.profile.PlayerProfile> { // Paper
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
@@ -23,8 +23,48 @@ public interface ProfileBanList extends BanList<PlayerProfile> {
|
|
* @return the entry for the newly created ban, or the entry for the
|
|
* (updated) previous ban
|
|
* @throws IllegalArgumentException if ProfilePlayer has an invalid UUID
|
|
+ * @deprecated use {@link #addBan(com.destroystokyo.paper.profile.PlayerProfile, String, Date, String)}
|
|
*/
|
|
@Nullable
|
|
- public BanEntry<PlayerProfile> addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
|
|
+ // Paper start
|
|
+ @Deprecated
|
|
+ public <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
|
|
|
|
+ /**
|
|
+ * @throws IllegalArgumentException if ProfilePlayer has an invalid UUID
|
|
+ */
|
|
+ @Nullable BanEntry<com.destroystokyo.paper.profile.PlayerProfile> addBan(com.destroystokyo.paper.profile.@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
|
|
+
|
|
+ // the 5 methods below are added to maintain compat for the bukkit.PlayerProfile parameter type
|
|
+ /**
|
|
+ * @deprecated use {@link #getBanEntry(Object)}
|
|
+ */
|
|
+ @Deprecated
|
|
+ @Nullable <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E getBanEntry(@NotNull PlayerProfile target);
|
|
+
|
|
+ /**
|
|
+ * @deprecated use {@link #isBanned(Object)}
|
|
+ */
|
|
+ @Deprecated
|
|
+ boolean isBanned(@NotNull PlayerProfile target);
|
|
+
|
|
+ /**
|
|
+ * @deprecated use {@link #pardon(Object)}
|
|
+ */
|
|
+ @Deprecated
|
|
+ void pardon(@NotNull PlayerProfile target);
|
|
+
|
|
+ /**
|
|
+ * @deprecated use {@link #addBan(Object, String, java.time.Instant, String)}
|
|
+ */
|
|
+ @Deprecated
|
|
+ @Nullable <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable java.time.Instant expires, @Nullable String source);
|
|
+
|
|
+ /**
|
|
+ * @deprecated use {@link #addBan(Object, String, java.time.Duration, String)}
|
|
+ */
|
|
+ @Deprecated
|
|
+ @Nullable <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable java.time.Duration duration, @Nullable String source);
|
|
+
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
|
index c2d49ff3aee971598451734f95144ac5dbbf131a..ad8e53bc528f6a078c85962fb85956bd97d67703 100644
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
|
@@ -359,7 +359,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|
* (updated) previous ban
|
|
*/
|
|
@Nullable
|
|
- public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer);
|
|
+ public <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API
|
|
|
|
/**
|
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
|
@@ -375,7 +375,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|
* (updated) previous ban
|
|
*/
|
|
@Nullable
|
|
- public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer);
|
|
+ public <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API
|
|
|
|
/**
|
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
|
@@ -391,7 +391,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|
* (updated) previous ban
|
|
*/
|
|
@Nullable
|
|
- public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer);
|
|
+ public <E extends BanEntry<? super com.destroystokyo.paper.profile.PlayerProfile>> E ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API
|
|
|
|
/**
|
|
* Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will
|