4ae1989c4f
Some of these were wrong (scoreboard manager), others are counter to everything everyone expects (Locations world being null, which wasnt ever safe EVER) others are just too noisy. Replace some with Contract to get rid of the nullability constraint and go back to the old days of IDE not considering it strictly one way or the other. Also, stop requiring annotations on package-private. Introduces the next Developer Perk for Paper-API: Your plugin isn't yellow anymore. Also fixed random dupe code in ensureServerConversions that got mistakenly set in the update.
56 Zeilen
2.1 KiB
Diff
56 Zeilen
2.1 KiB
Diff
From 35bbd72e452d3c31afe5217706a2a60df856117f Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 4 May 2016 23:55:48 -0400
|
|
Subject: [PATCH] Add getI18NDisplayName API
|
|
|
|
Gets the Display name as seen in the Client.
|
|
Currently the server only supports the English language. To override this,
|
|
You must replace the language file embedded in the server jar.
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
index 8e602cf51..dca77bbaf 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
@@ -153,5 +153,16 @@ public interface ItemFactory {
|
|
*/
|
|
@NotNull
|
|
ItemStack ensureServerConversions(@NotNull ItemStack item);
|
|
+
|
|
+ /**
|
|
+ * Gets the Display name as seen in the Client.
|
|
+ * Currently the server only supports the English language. To override this,
|
|
+ * You must replace the language file embedded in the server jar.
|
|
+ *
|
|
+ * @param item Item to return Display name of
|
|
+ * @return Display name of Item
|
|
+ */
|
|
+ @Nullable
|
|
+ String getI18NDisplayName(@Nullable ItemStack item);
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
index 4ee01be5f..3ff3458e7 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
@@ -590,5 +590,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
|
public ItemStack ensureServerConversions() {
|
|
return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
|
|
}
|
|
+
|
|
+ /**
|
|
+ * Gets the Display name as seen in the Client.
|
|
+ * Currently the server only supports the English language. To override this,
|
|
+ * You must replace the language file embedded in the server jar.
|
|
+ *
|
|
+ * @return Display name of Item
|
|
+ */
|
|
+ @Nullable
|
|
+ public String getI18NDisplayName() {
|
|
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
|
|
+ }
|
|
// Paper end
|
|
}
|
|
--
|
|
2.21.0
|
|
|