mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 03:43:28 +01:00
52a05907c7
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: 97c59261 PR-1073: Make Biome an interface a38581aa Fix further javadoc errors 8271c490 Fix javadoc error 8a9ecf29 PR-1072: Fix bad naming for Vault State methods 6dd58108 PR-1071: Make Fluid an interface and add missing entry ed2cdfc3 PR-1070: Make Attribute an interface and align names with the new minecraft ones 63472efb PR-1069: Add missing winter drop experimental annotation to pale boats CraftBukkit Changes: 7235ad7b0 PR-1501: Make Biome an interface 602904003 PR-1500: Rename implementation for Vault State methods 75f26f79f PR-1499: Make Fluid an interface and add missing entry 4cfd87adc PR-1498: Make Attribute an interface and align names with the new minecraft ones 6bb0db5cb SPIGOT-7928: ExactChoice acts as MaterialChoice 3eaf3a13c SPIGOT-7929: Error when setting EquippableComponent abbf57bac SPIGOT-7930: Fix spawning entities with SummonEntityEffect 92d6ab6cf PR-1497: Move boat field rename entries to below key renaming, so that keys are also renamed abfe292aa PR-1496: Use correct Fluid class on Tags type check c7aab7fa7 SPIGOT-7923: Fix Dispenser logic to avoid firing empty projectiles
163 lines
8.6 KiB
Diff
163 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 548f6d28c28d74bed8b58ee82875909354afe132..a77c0411a68a9bad33ddfb335b7a996a843e478c 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
|
|
@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
|
|
@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 d81701f0128bdeca180ff9957621f695c787f334..299d1cc510d24541c6bb47d02db0b6a86fb1d0eb 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 dd4ce1d68962ec668db7c687c1e4764db52bc04f..baf7ff3b23be8dd80d2e59299a6ec8f9ce1053df 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
|