Convert Material enum, midpoint push, it compiles and runs

This commit is contained in:
DerFrZocker 2021-11-16 21:16:23 +01:00
parent 4771132c0e
commit 7a58144d35
No known key found for this signature in database
GPG key ID: 713F71FFFE1DDF91
3 changed files with 17 additions and 2 deletions

View file

@ -2277,6 +2277,22 @@ public interface Material extends Keyed, Comparable<Material> {
return getMaterial(filtered, legacyName);
}
/**
* @param name of the material.
* @return the material with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated
public static Material valueOf(@NotNull String name) {
Material material = Registry.MATERIAL.get(NamespacedKey.fromString(name.toLowerCase()));
if (material == null) {
material = Bukkit.getUnsafe().getLegacyMaterial(name);
}
Preconditions.checkArgument(material != null, "No Material found with the name %s", name);
return material;
}
/**
* Do not use for any reason.
*

View file

@ -455,7 +455,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
Map<String, Object> result = new LinkedHashMap<String, Object>();
result.put("v", Bukkit.getUnsafe().getDataVersion()); // Include version to indicate we are using modern material names (or LEGACY prefix)
result.put("type", getType().getKey());
result.put("type", getType().getKey().toString());
if (getAmount() != 1) {
result.put("amount", getAmount());

View file

@ -10,7 +10,6 @@ import org.bukkit.TestServer;
public abstract class AbstractTestingBase {
static {
System.out.println("Beginning");
TestServer.setup();
}
}