mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-18 22:31:28 +01:00
added getAddress interface for Player
By: Tahg <tahgtahv@gmail.com>
This commit is contained in:
parent
6f77375dc5
commit
f3d9273819
@ -183,7 +183,8 @@ public enum Material {
|
|||||||
GreenRecord(2257);
|
GreenRecord(2257);
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private static final Map<Integer, Material> lookup = new HashMap<Integer, Material>();
|
private static final Map<Integer, Material> lookupId = new HashMap<Integer, Material>();
|
||||||
|
private static final Map<String, Material> lookupName = new HashMap<String, Material>();
|
||||||
|
|
||||||
private Material(final int id) {
|
private Material(final int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -194,12 +195,18 @@ public enum Material {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Material getMaterial(final int id) {
|
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 {
|
static {
|
||||||
for (Material material : values()) {
|
for (Material material : values()) {
|
||||||
lookup.put(material.getID(), material);
|
lookupId.put(material.getID(), material);
|
||||||
|
lookupName.put(material.name(), material);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a player, connected or not
|
* Represents a player, connected or not
|
||||||
*
|
*
|
||||||
@ -19,4 +21,10 @@ public interface Player extends HumanEntity {
|
|||||||
* @param message Message to be displayed
|
* @param message Message to be displayed
|
||||||
*/
|
*/
|
||||||
public void sendMessage(String message);
|
public void sendMessage(String message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the socket address of this player
|
||||||
|
* @return the player's address
|
||||||
|
*/
|
||||||
|
public InetSocketAddress getAddress();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user