mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 11:42:55 +01:00
114 lines
5.5 KiB
Diff
114 lines
5.5 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 c229d3bc37c4e454a4b5a93eda1fe6466a4f4e8b..adeff14586351edad412a85a5797c28a43aaa9de 100644
|
||
|
--- a/src/main/java/org/bukkit/BanList.java
|
||
|
+++ b/src/main/java/org/bukkit/BanList.java
|
||
|
@@ -46,7 +46,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.
|
||
|
@@ -75,7 +75,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
|
||
|
@@ -108,7 +108,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 4d014215dce2c2ff09a2701accf2db144603c55a..08ae501e97ae2a3f22b1994c9616fc7134cfc0c3 100644
|
||
|
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||
|
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||
|
@@ -133,7 +133,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);
|
||
|
|
||
|
/**
|
||
|
* 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..429b6e3730118660585c84319ef09e2e5bb32fd5 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,35 @@ 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 3 methods below are added to maintain compat for the 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);
|
||
|
+ // Paper end
|
||
|
}
|
||
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||
|
index d0297f47f18cabf857cf4ce04c529b46525c0f75..06b2b925de745850816d9ce0cf6316412c8d2b49 100644
|
||
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
||
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||
|
@@ -296,7 +296,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
|
||
|
|
||
|
/**
|
||
|
* Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will
|