!{@link #supports(int)} 9* * @since 2.0.0 + * @deprecated Use {@code !XMaterial.supports(9)} instead. */ + @Deprecated public static boolean isOneEight() { return !supports(9); } @@ -705,7 +675,6 @@ public enum XMaterial { * @return an optional that can be empty. * @since 5.1.0 */ - private static Optional
+ * Spigot added material ID support back in 1.16+ * * @return the ID of the material or -1 if it's not a legacy material or * the server doesn't support the material. @@ -1202,14 +1160,16 @@ public enum XMaterial { */ @SuppressWarnings("deprecation") public int getId() { - if (this.data != 0 || this.version >= 13) - return -1; + // https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/diff/src/main/java/org/bukkit/Material.java?until=1cb03826ebde4ef887519ce37b0a2a341494a183 + // Should start working again in 1.16+ Material material = this.parseMaterial(); if (material == null) return -1; - if (Data.ISFLAT && !material.isLegacy()) + try { + return material.getId(); + } catch (IllegalArgumentException ignored) { return -1; - return material.getId(); + } } /** @@ -1250,7 +1210,6 @@ public enum XMaterial { * @return the material related to this XMaterial based on the server version. * @since 1.0.0 */ - public Material parseMaterial() { return this.material; } @@ -1269,7 +1228,7 @@ public enum XMaterial { Objects.requireNonNull(item, "Cannot compare with null ItemStack"); if (item.getType() != this.parseMaterial()) return false; - return Data.ISFLAT || item.getDurability() == this.data || item.getType().getMaxDurability() <= 0; + return Data.ISFLAT || item.getDurability() == this.data || item.getType().getMaxDurability() > 0; } /** @@ -1286,17 +1245,6 @@ public enum XMaterial { return this.material != null; } - /** - * The version this material was added in. This will return the minor number in - * the version scheme. For example, if it was added in 1.16, it'll return 16 - * - * @return the version number of 0 if the version was not recorded. - * @since 7.0.0 - */ - public byte getMaterialVersion() { - return version; - } - /** * This method is needed due to Java enum initialization limitations. It's * really inefficient yes, but it's only used for initialization.