Java Code Examples for org.bukkit.entity.Entity#getName()

The following examples show how to use org.bukkit.entity.Entity#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: I18n11601.java    From TabooLib with MIT License 5 votes vote down vote up
@Override
public String getName(Player player, Entity entity) {
    JsonObject locale = cache.get(player == null ? "zh_cn" : player.getLocale());
    if (locale == null) {
        locale = cache.get("en_gb");
    }
    if (locale == null) {
        return "[ERROR LOCALE]";
    }
    JsonElement element = locale.get(NMS.handle().getName(entity));
    return element == null ? entity.getName() : element.getAsString();
}
 
Example 2
Source File: I18n20w14a.java    From TabooLib with MIT License 5 votes vote down vote up
@Override
public String getName(Player player, Entity entity) {
    JsonObject locale = cache.get(player == null ? "zh_cn" : player.getLocale());
    if (locale == null) {
        locale = cache.get("en_gb");
    }
    if (locale == null) {
        return "[ERROR LOCALE]";
    }
    JsonElement element = locale.get(NMS.handle().getName(entity));
    return element == null ? entity.getName() : element.getAsString();
}
 
Example 3
Source File: HoverAction.java    From ProtocolSupport with GNU Affero General Public License v3.0 4 votes vote down vote up
public EntityInfo(Entity entity) {
	this(entity.getType(), entity.getUniqueId(), entity.getName());
}