Mark Player.sendSignChange as deprecated (#9382)

This commit is contained in:
Infynyty 2023-07-22 21:38:40 +02:00 committed by GitHub
parent c016e039a5
commit b1334b5105
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 95 additions and 73 deletions

View file

@ -2111,7 +2111,7 @@ index f3afe67f0832cb828d25be3654518ff73a80b0e1..598abaa82c634178043a29f6caa6ac52
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc1d7a8ef1 100644
index 7591d6de16694467b0fa5ab7ee746f3efdafad82..513e48de04a78268d16c924717d64896a23b437f 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -49,7 +49,41 @@ import org.jetbrains.annotations.Nullable;
@ -2302,7 +2302,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
/**
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
* update the entry.
@@ -671,6 +770,90 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -671,6 +770,106 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull Map<EquipmentSlot, ItemStack> items);
@ -2321,7 +2321,11 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
+ * @param lines the new text on the sign or null to clear it
+ * @throws IllegalArgumentException if location is null
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual
+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()}
+ * (constructed e.g. via {@link Material#createBlockData()})
+ */
+ @Deprecated
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines) throws IllegalArgumentException {
+ this.sendSignChange(loc, lines, DyeColor.BLACK);
+ }
@ -2342,7 +2346,11 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
+ * @throws IllegalArgumentException if location is null
+ * @throws IllegalArgumentException if dyeColor is null
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual
+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()}
+ * (constructed e.g. via {@link Material#createBlockData()})
+ */
+ @Deprecated
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException {
+ this.sendSignChange(loc, lines, dyeColor, false);
+ }
@ -2363,7 +2371,11 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
+ * @throws IllegalArgumentException if location is null
+ * @throws IllegalArgumentException if dyeColor is null
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual
+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()}
+ * (constructed e.g. via {@link Material#createBlockData()})
+ */
+ @Deprecated
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines, boolean hasGlowingText) throws IllegalArgumentException {
+ this.sendSignChange(loc, lines, DyeColor.BLACK, hasGlowingText);
+ }
@ -2385,7 +2397,11 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
+ * @throws IllegalArgumentException if location is null
+ * @throws IllegalArgumentException if dyeColor is null
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual
+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()}
+ * (constructed e.g. via {@link Material#createBlockData()})
+ */
+ @Deprecated
+ void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor, boolean hasGlowingText)
+ throws IllegalArgumentException;
+ // Paper end
@ -2393,37 +2409,43 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
/**
* Send a sign change. This fakes a sign change packet for a user at
* a certain location. This will not actually change the world in any way.
@@ -688,7 +871,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -688,7 +887,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param lines the new text on the sign or null to clear it
* @throws IllegalArgumentException if location is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated in favour of {@link #sendSignChange(org.bukkit.Location, java.util.List)}
+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual
+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()}
+ * (constructed e.g. via {@link Material#createBlockData()})
*/
+ @Deprecated // Paper
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException;
/**
@@ -710,7 +895,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -710,7 +913,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException if location is null
* @throws IllegalArgumentException if dyeColor is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated in favour of {@link #sendSignChange(org.bukkit.Location, java.util.List, org.bukkit.DyeColor)}
+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual
+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()}
+ * (constructed e.g. via {@link Material#createBlockData()})
*/
+ @Deprecated // Paper
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException;
/**
@@ -733,7 +920,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -733,7 +940,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException if location is null
* @throws IllegalArgumentException if dyeColor is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated Deprecated in favour of {@link #sendSignChange(Location, java.util.List, DyeColor, boolean)}
+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual
+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()}
+ * (constructed e.g. via {@link Material#createBlockData()})
*/
+ @Deprecated // Paper
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException;
/**
@@ -1249,6 +1438,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1249,6 +1460,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* pack correctly.
* </ul>
*
@ -2431,7 +2453,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
* @param url The URL from which the client will download the resource
* pack. The string must contain only US-ASCII characters and should
* be encoded as per RFC 1738.
@@ -1305,8 +1495,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1305,8 +1517,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long.
*/
@ -2489,7 +2511,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
/**
* Request that the player's client download and switch resource packs.
* <p>
@@ -1336,6 +1575,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1336,6 +1597,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* pack correctly.
* </ul>
*
@ -2497,7 +2519,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
* @param url The URL from which the client will download the resource
* pack. The string must contain only US-ASCII characters and should
* be encoded as per RFC 1738.
@@ -1396,8 +1636,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1396,8 +1658,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long.
*/
@ -2555,7 +2577,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
/**
* Gets the Scoreboard displayed to this player
*
@@ -1532,7 +1821,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1532,7 +1843,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param title Title text
* @param subtitle Subtitle text
@ -2564,7 +2586,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
*/
@Deprecated
public void sendTitle(@Nullable String title, @Nullable String subtitle);
@@ -1551,7 +1840,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1551,7 +1862,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param fadeIn time in ticks for titles to fade in. Defaults to 10.
* @param stay time in ticks for titles to stay. Defaults to 70.
* @param fadeOut time in ticks for titles to fade out. Defaults to 20.
@ -2574,7 +2596,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut);
/**
@@ -1778,6 +2069,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1778,6 +2091,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public int getClientViewDistance();
@ -2589,7 +2611,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
/**
* Gets the player's estimated ping in milliseconds.
*
@@ -1803,8 +2102,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1803,8 +2124,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* they wish.
*
* @return the player's locale
@ -2600,7 +2622,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
public String getLocale();
/**
@@ -1856,6 +2157,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1856,6 +2179,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public boolean isAllowingServerListings();
@ -2615,7 +2637,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
// Spigot start
public class Spigot extends Entity.Spigot {
@@ -1887,11 +2196,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1887,11 +2218,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
throw new UnsupportedOperationException("Not supported yet.");
}
@ -2629,7 +2651,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
@Override
public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -1902,7 +2213,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1902,7 +2235,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param component the components to send
@ -2639,7 +2661,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1912,7 +2225,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1912,7 +2247,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param components the components to send
@ -2649,7 +2671,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1923,7 +2238,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1923,7 +2260,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position
* @param sender the sender of the message
* @param component the components to send
@ -2659,7 +2681,7 @@ index 7591d6de16694467b0fa5ab7ee746f3efdafad82..72b014ebf1a88bf0bf583f570b339ecc
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1934,7 +2251,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1934,7 +2273,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position
* @param sender the sender of the message
* @param components the components to send