mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 21:01:24 +01:00
#882: Add modern time API methods to ban API
By: Yannick Lamprecht <yannicklamprecht@live.de>
This commit is contained in:
parent
17ec8e03e0
commit
4e61eca624
@ -1,5 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -86,6 +88,36 @@ public interface BanList<T> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public BanEntry<T> addBan(@NotNull T target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
|
public BanEntry<T> addBan(@NotNull T target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a ban to this list. If a previous ban exists, this will
|
||||||
|
* update the previous entry.
|
||||||
|
*
|
||||||
|
* @param target the target of the ban
|
||||||
|
* @param reason reason for the ban, null indicates implementation default
|
||||||
|
* @param expires instant 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
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<T> addBan(@NotNull T target, @Nullable String reason, @Nullable Instant expires, @Nullable String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a ban to this list. If a previous ban exists, this will
|
||||||
|
* update the previous entry.
|
||||||
|
*
|
||||||
|
* @param target the target of the ban
|
||||||
|
* @param reason reason for the ban, null indicates implementation default
|
||||||
|
* @param duration the duration of the ban, 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
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<T> addBan(@NotNull T target, @Nullable String reason, @Nullable Duration duration, @Nullable String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a set containing every {@link BanEntry} in this list.
|
* Gets a set containing every {@link BanEntry} in this list.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.bukkit.ban.ProfileBanList;
|
import org.bukkit.ban.ProfileBanList;
|
||||||
@ -80,6 +82,34 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|||||||
@Nullable
|
@Nullable
|
||||||
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Date expires, @Nullable String source);
|
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Date expires, @Nullable String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
||||||
|
* update the entry.
|
||||||
|
*
|
||||||
|
* @param reason reason for the ban, null indicates implementation default
|
||||||
|
* @param expires instant 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
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
||||||
|
* update the entry.
|
||||||
|
*
|
||||||
|
* @param reason reason for the ban, null indicates implementation default
|
||||||
|
* @param duration how long the ban last, 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
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this player is whitelisted or not
|
* Checks if this player is whitelisted or not
|
||||||
*
|
*
|
||||||
|
@ -2,6 +2,8 @@ package org.bukkit.entity;
|
|||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -191,6 +193,38 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|||||||
@Nullable
|
@Nullable
|
||||||
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer);
|
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
||||||
|
* update the entry.
|
||||||
|
*
|
||||||
|
* @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
|
||||||
|
* @param kickPlayer if the player need to be kick
|
||||||
|
*
|
||||||
|
* @return the entry for the newly created ban, or the entry for the
|
||||||
|
* (updated) previous ban
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
||||||
|
* update the entry.
|
||||||
|
*
|
||||||
|
* @param reason reason for the ban, null indicates implementation default
|
||||||
|
* @param duration the duration how long the ban lasts, or null to imply
|
||||||
|
* forever
|
||||||
|
* @param source source of the ban, null indicates implementation default
|
||||||
|
* @param kickPlayer if the player need to be kick
|
||||||
|
*
|
||||||
|
* @return the entry for the newly created ban, or the entry for the
|
||||||
|
* (updated) previous ban
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<PlayerProfile> ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will
|
* Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will
|
||||||
* update the entry. If {@link #getAddress()} is null this method will throw an exception.
|
* update the entry. If {@link #getAddress()} is null this method will throw an exception.
|
||||||
@ -207,6 +241,38 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|||||||
@Nullable
|
@Nullable
|
||||||
public BanEntry<InetAddress> banIp(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer);
|
public BanEntry<InetAddress> banIp(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will
|
||||||
|
* update the entry. If {@link #getAddress()} is null this method will throw an exception.
|
||||||
|
*
|
||||||
|
* @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
|
||||||
|
* @param kickPlayer if the player need to be kick
|
||||||
|
*
|
||||||
|
* @return the entry for the newly created ban, or the entry for the
|
||||||
|
* (updated) previous ban
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<InetAddress> banIp(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will
|
||||||
|
* update the entry. If {@link #getAddress()} is null this method will throw an exception.
|
||||||
|
*
|
||||||
|
* @param reason reason for the ban, null indicates implementation default
|
||||||
|
* @param duration the duration how long the ban lasts, or null to imply
|
||||||
|
* forever
|
||||||
|
* @param source source of the ban, null indicates implementation default
|
||||||
|
* @param kickPlayer if the player need to be kick
|
||||||
|
*
|
||||||
|
* @return the entry for the newly created ban, or the entry for the
|
||||||
|
* (updated) previous ban
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public BanEntry<InetAddress> banIp(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Says a message (or runs a command).
|
* Says a message (or runs a command).
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user