spigot/Bukkit-Patches/0013-Remove-deprecation-on-some-player-lookup-methods.patch
2019-04-30 21:46:22 +10:00

95 lines
3.9 KiB
Diff

From 7a3a73c561b8d0247480be275afcad457f50fbbc Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 30 Mar 2014 15:58:22 +1100
Subject: [PATCH] Remove deprecation on some player lookup methods
Most of these methods still have plenty of use given that only one player with each name can exist at a time. Deprecating these methods renders even basic functionality such as /msg <name> impossible without causing compiler warnings. We will maintain this API and it should be considered safe and appropriate for most use cases.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index c6ac40b3..1c1f650d 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -358,12 +358,9 @@ public final class Bukkit {
* <p>
* This method may not return objects for offline players.
*
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
- * guaranteed to be unique
* @param name the name to look up
* @return a player if one was found, null otherwise
*/
- @Deprecated
@Nullable
public static Player getPlayer(@NotNull String name) {
return server.getPlayer(name);
@@ -372,12 +369,9 @@ public final class Bukkit {
/**
* Gets the player with the exact given name, case insensitive.
*
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
- * guaranteed to be unique
* @param name Exact name of the player to retrieve
* @return a player object if one was found, null otherwise
*/
- @Deprecated
@Nullable
public static Player getPlayerExact(@NotNull String name) {
return server.getPlayerExact(name);
@@ -390,12 +384,9 @@ public final class Bukkit {
* This list is not sorted in any particular order. If an exact match is
* found, the returned list will only contain a single result.
*
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
- * guaranteed to be unique
* @param name the (partial) name to match
* @return list of all possible players
*/
- @Deprecated
@NotNull
public static List<Player> matchPlayer(@NotNull String name) {
return server.matchPlayer(name);
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 11f0393f..3db93f6c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -299,24 +299,18 @@ public interface Server extends PluginMessageRecipient {
* <p>
* This method may not return objects for offline players.
*
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
- * guaranteed to be unique
* @param name the name to look up
* @return a player if one was found, null otherwise
*/
- @Deprecated
@Nullable
public Player getPlayer(@NotNull String name);
/**
* Gets the player with the exact given name, case insensitive.
*
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
- * guaranteed to be unique
* @param name Exact name of the player to retrieve
* @return a player object if one was found, null otherwise
*/
- @Deprecated
@Nullable
public Player getPlayerExact(@NotNull String name);
@@ -327,12 +321,9 @@ public interface Server extends PluginMessageRecipient {
* This list is not sorted in any particular order. If an exact match is
* found, the returned list will only contain a single result.
*
- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer
- * guaranteed to be unique
* @param name the (partial) name to match
* @return list of all possible players
*/
- @Deprecated
@NotNull
public List<Player> matchPlayer(@NotNull String name);
--
2.20.1