Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
ac554ad46d
Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: fa99e752 PR-1007: Add ItemMeta#getAsComponentString() 94a91782 Fix copy-pasted BlockType.Typed documentation 9b34ac8c Largely restore deprecated PotionData API 51a6449b PR-1008: Deprecate ITEMS_TOOLS, removed in 1.20.5 702d15fe Fix Javadoc reference 42f6cdf4 PR-919: Add internal ItemType and BlockType, delegate Material methods to them 237bb37b SPIGOT-1166, SPIGOT-7647: Expose Damager BlockState in EntityDamageByBlockEvent 035ea146 SPIGOT-6993: Allow #setVelocity to change the speed of a fireball and add a note to #setDirection about it 8c7880fb PR-1004: Improve field rename handling and centralize conversion between bukkit and string more 87c90e93 SPIGOT-7650: Add DamageSource for EntityDeathEvent and PlayerDeathEvent CraftBukkit Changes: 4af0f22e8 SPIGOT-7664: Item meta should prevail over block states c2ccc46ec SPIGOT-7666: Fix access to llama and horse special slot 124ac66d7 SPIGOT-7665: Fix ThrownPotion#getEffects() implementation only bringing custom effects 66f1f439a Restore null page behaviour of signed books even though not strictly allowed by API 6118e5398 Fix regression listening to minecraft:brand custom payloads c1a26b366 Fix unnecessary and potential not thread-safe chat visibility check 12360a7ec Remove unused imports 147b098b4 PR-1397: Add ItemMeta#getAsComponentString() 428aefe0e Largely restore deprecated PotionData API afe5b5ee9 PR-1275: Add internal ItemType and BlockType, delegate Material methods to them 8afeafa7d SPIGOT-1166, SPIGOT-7647: Expose Damager BlockState in EntityDamageByBlockEvent 4e7d749d4 SPIGOT-6993: Allow #setVelocity to change the speed of a fireball and add a note to #setDirection about it 441880757 Support both entity_data and bucket_entity_data on axolotl/fish buckets 0e22fdd1e Fix custom direct BlockState being not correctly set in DamageSource f2182ed47 SPIGOT-7659: TropicalFishBucketMeta should use BUCKET_ENTITY_DATA 2a6207fe1 PR-1393: Improve field rename handling and centralize conversion between bukkit and string more c024a5039 SPIGOT-7650: Add DamageSource for EntityDeathEvent and PlayerDeathEvent 741b84480 PR-1390: Improve internal handling of damage sources 0364df4e1 SPIGOT-7657: Error when loading angry entities
163 Zeilen
8.6 KiB
Diff
163 Zeilen
8.6 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 548f6d28c28d74bed8b58ee82875909354afe132..a77c0411a68a9bad33ddfb335b7a996a843e478c 100644
|
|
--- a/src/main/java/org/bukkit/BanList.java
|
|
+++ b/src/main/java/org/bukkit/BanList.java
|
|
@@ -48,7 +48,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.
|
|
@@ -77,7 +77,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
|
|
@@ -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
|
|
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
|
index f5d3e5c5d79910580b6202e7aee01341d09f6225..6a84c3d0d15251694bb7a05393b9ff7a4d8e0617 100644
|
|
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
|
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
|
@@ -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
|
|
diff --git a/src/main/java/org/bukkit/ban/ProfileBanList.java b/src/main/java/org/bukkit/ban/ProfileBanList.java
|
|
index e805e629cede1c4c0674282c930cb67852718c3e..5248cf08ef83c7304dd76c42a2f646bb81e0efae 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,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
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
|
index 6dc9a93811d143ed266f0f6235358d58b1e00523..463521dc80254cab673c5203ee263948081219e9 100644
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
|
@@ -345,7 +345,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
|
|
@@ -361,7 +361,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
|
|
@@ -377,7 +377,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
|