diff --git a/paper-api/src/main/java/org/bukkit/Material.java b/paper-api/src/main/java/org/bukkit/Material.java index d114d042d0..f420a5bbe7 100644 --- a/paper-api/src/main/java/org/bukkit/Material.java +++ b/paper-api/src/main/java/org/bukkit/Material.java @@ -183,7 +183,8 @@ public enum Material { GreenRecord(2257); private final int id; - private static final Map lookup = new HashMap(); + private static final Map lookupId = new HashMap(); + private static final Map lookupName = new HashMap(); private Material(final int id) { this.id = id; @@ -194,12 +195,18 @@ public enum Material { } public static Material getMaterial(final int id) { - return lookup.get(id); + return lookupId.get(id); + } + + public static Material getMaterial(final String name) { + return lookupName.get(name); } static { for (Material material : values()) { - lookup.put(material.getID(), material); + lookupId.put(material.getID(), material); + lookupName.put(material.name(), material); } } + } diff --git a/paper-api/src/main/java/org/bukkit/Player.java b/paper-api/src/main/java/org/bukkit/Player.java index 7d4c5ed722..b20aad20ba 100644 --- a/paper-api/src/main/java/org/bukkit/Player.java +++ b/paper-api/src/main/java/org/bukkit/Player.java @@ -1,6 +1,8 @@ package org.bukkit; +import java.net.InetSocketAddress; + /** * Represents a player, connected or not * @@ -19,4 +21,10 @@ public interface Player extends HumanEntity { * @param message Message to be displayed */ public void sendMessage(String message); + + /** + * Gets the socket address of this player + * @return the player's address + */ + public InetSocketAddress getAddress(); }