mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Fix BanList API
This commit is contained in:
parent
3a91b864bb
commit
1ce71b513e
4 changed files with 51 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue