diff options
Diffstat (limited to 'patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch')
-rw-r--r-- | patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch b/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch index 02815e865b..dca2c8b86c 100644 --- a/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch +++ b/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch @@ -11,19 +11,20 @@ diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/buk index abbf3d6f11350ab2dd47a277771d9f46221036bd..d8a3b6cb2d0cb035b2ab09e0327bc4f0be457ff7 100644 --- a/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -67,6 +67,61 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio +@@ -67,6 +67,73 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio * @return true if banned, otherwise false */ public boolean isBanned(); + // Paper start -+ + /** + * Permanently Bans this player from the server + * + * @param reason Reason for Ban + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} + */ + @NotNull ++ @Deprecated + public default BanEntry banPlayer(@Nullable String reason) { + return banPlayer(reason, null, null); + } @@ -33,8 +34,10 @@ index abbf3d6f11350ab2dd47a277771d9f46221036bd..d8a3b6cb2d0cb035b2ab09e0327bc4f0 + * @param reason Reason for Ban + * @param source Source of the ban, or null for default + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} + */ + @NotNull ++ @Deprecated + public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) { + return banPlayer(reason, null, source); + } @@ -44,8 +47,10 @@ index abbf3d6f11350ab2dd47a277771d9f46221036bd..d8a3b6cb2d0cb035b2ab09e0327bc4f0 + * @param reason Reason for Ban + * @param expires When to expire the ban + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} + */ + @NotNull ++ @Deprecated + public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires) { + return banPlayer(reason, expires, null); + } @@ -56,12 +61,19 @@ index abbf3d6f11350ab2dd47a277771d9f46221036bd..d8a3b6cb2d0cb035b2ab09e0327bc4f0 + * @param expires When to expire the ban + * @param source Source of the ban or null for default + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} + */ + @NotNull ++ @Deprecated + public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) { + return banPlayer(reason, expires, source, true); + } ++ ++ /** ++ * @deprecated use {@link #ban(String, Date, String)} ++ */ + @NotNull ++ @Deprecated + public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickIfOnline) { + BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source); + if (kickIfOnline && isOnline()) { @@ -74,10 +86,10 @@ index abbf3d6f11350ab2dd47a277771d9f46221036bd..d8a3b6cb2d0cb035b2ab09e0327bc4f0 /** * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb4ee4a128 100644 +index b1d93f16c55d3fa9a157cf26286936a799ca8025..0c13a41b442b441cba322e03a6cd4da7efb40902 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1173,6 +1173,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1173,6 +1173,186 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendMap(@NotNull MapView map); // Paper start @@ -86,9 +98,11 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * + * @param reason Reason for ban + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + // For reference, Bukkit defines this as nullable, while they impl isn't, we'll follow API. + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason) { + return banPlayerFull(reason, null, null); + } @@ -99,8 +113,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param reason Reason for ban + * @param source Source of ban, or null for default + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable String source) { + return banPlayerFull(reason, null, source); + } @@ -111,8 +127,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param reason Reason for Ban + * @param expires When to expire the ban + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable java.util.Date expires) { + return banPlayerFull(reason, expires, null); + } @@ -124,8 +142,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param expires When to expire the ban + * @param source Source of the ban, or null for default + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) { + banPlayer(reason, expires, source); + return banPlayerIP(reason, expires, source, true); @@ -138,8 +158,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param reason Reason for ban + * @param kickPlayer Whether or not to kick the player afterwards + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, boolean kickPlayer) { + return banPlayerIP(reason, null, null, kickPlayer); + } @@ -151,8 +173,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param source Source of ban, or null for default + * @param kickPlayer Whether or not to kick the player afterwards + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable String source, boolean kickPlayer) { + return banPlayerIP(reason, null, source, kickPlayer); + } @@ -164,8 +188,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param expires When to expire the ban + * @param kickPlayer Whether or not to kick the player afterwards + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, boolean kickPlayer) { + return banPlayerIP(reason, expires, null, kickPlayer); + } @@ -176,8 +202,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * + * @param reason Reason for ban + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason) { + return banPlayerIP(reason, null, null); + } @@ -188,8 +216,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param reason Reason for ban + * @param source Source of ban, or null for default + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable String source) { + return banPlayerIP(reason, null, source); + } @@ -200,8 +230,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param reason Reason for Ban + * @param expires When to expire the ban + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires) { + return banPlayerIP(reason, expires, null); + } @@ -213,8 +245,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param expires When to expire the ban + * @param source Source of the ban or null for default + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) { + return banPlayerIP(reason, expires, source, true); + } @@ -227,8 +261,10 @@ index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..07dde016220eef654901e3d78e2d37fb + * @param source Source of the ban or null for default + * @param kickPlayer if the targeted player should be kicked + * @return Ban Entry ++ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} + */ + @Nullable ++ @Deprecated + public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickPlayer) { + org.bukkit.BanEntry banEntry = org.bukkit.Bukkit.getServer().getBanList(org.bukkit.BanList.Type.IP).addBan(getAddress().getAddress().getHostAddress(), reason, expires, source); + if (kickPlayer && isOnline()) { |