SPIGOT-6455, SPIGOT-7030, #750: Improve ban API

By: Doc <nachito94@msn.com>
This commit is contained in:
Bukkit/Spigot
2023-07-01 13:55:59 +10:00
parent ea46ef7a62
commit ba835793ed
9 changed files with 238 additions and 19 deletions

View File

@@ -0,0 +1,11 @@
package org.bukkit.ban;
import java.net.InetSocketAddress;
import org.bukkit.BanList;
/**
* A {@link BanList} targeting IP bans.
*/
public interface IpBanList extends BanList<InetSocketAddress> {
}

View File

@@ -0,0 +1,30 @@
package org.bukkit.ban;
import java.util.Date;
import org.bukkit.BanEntry;
import org.bukkit.BanList;
import org.bukkit.profile.PlayerProfile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A {@link BanList} targeting player profile bans.
*/
public interface ProfileBanList extends BanList<PlayerProfile> {
/**
* {@inheritDoc}
*
* @param target the target of the ban
* @param reason reason for the ban, null indicates implementation default
* @param expires date for the ban's expiration (unban), or null to imply
* forever
* @param source source of the ban, null indicates implementation default
* @return the entry for the newly created ban, or the entry for the
* (updated) previous ban
* @throws IllegalArgumentException if ProfilePlayer has an invalid UUID
*/
@Nullable
public BanEntry<PlayerProfile> addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
}

View File

@@ -0,0 +1,4 @@
/**
* Classes relevant to bans.
*/
package org.bukkit.ban;