mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
Convert Material enum, midpoint push, it compiles and runs
This commit is contained in:
parent
4771132c0e
commit
7a58144d35
3 changed files with 17 additions and 2 deletions
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.TestServer;
|
|||
public abstract class AbstractTestingBase {
|
||||
|
||||
static {
|
||||
System.out.println("Beginning");
|
||||
TestServer.setup();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue