本文整理匯總了Java中org.bukkit.entity.EntityType.values方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityType.values方法的具體用法?Java EntityType.values怎麽用?Java EntityType.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.EntityType
的用法示例。
在下文中一共展示了EntityType.values方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: MatchEntityState
import org.bukkit.entity.EntityType; //導入方法依賴的package包/類
protected MatchEntityState(Match match, Class<? extends Entity> entityClass, UUID uuid, EntityLocation location, @Nullable String customName) {
this.uuid = checkNotNull(uuid);
this.match = checkNotNull(match);
this.entityClass = checkNotNull(entityClass);
this.location = checkNotNull(location);
this.customName = customName;
EntityType type = null;
for(EntityType t : EntityType.values()) {
if(t.getEntityClass().isAssignableFrom(entityClass)) {
type = t;
break;
}
}
checkArgument(type != null, "Unknown entity class " + entityClass);
this.entityType = type;
}
示例2: getEntity
import org.bukkit.entity.EntityType; //導入方法依賴的package包/類
private EntityType getEntity(String lore) {
String lores = lore.toUpperCase();
if (lores.contains("[SPAWNER: "))
lores = lores.replace("[SPAWNER: ", "");
if (lores.contains("]"))
lores = lores.replace("]", "");
Logger.DEBUG.log("LORE: " + lores);
for (EntityType type : EntityType.values()) {
String name = type + "";
if (lores.equalsIgnoreCase(name)) {
return type;
}
}
return EntityType.AREA_EFFECT_CLOUD;
}
示例3: load
import org.bukkit.entity.EntityType; //導入方法依賴的package包/類
/**
* Load the plugin's settings.
*
* @author HomieDion
* @since 1.1.0
*/
public void load() {
// Variables
final Sunscreen plugin = Sunscreen.getInstance();
final CustomConfig config = new CustomConfig("config.yml", plugin);
final Logger log = plugin.getLogger();
// Add the disabled worlds
for (final String world : config.getStringList("disabled_worlds")) {
worlds.add(world);
log.info(String.format("%s will not use this plugin.", world));
}
// Loop all entities
for (final EntityType type : EntityType.values()) {
// Loop all values of the list
for (final String line : config.getStringList("mobs")) {
// If the names match
if (type.name().equalsIgnoreCase(line)) {
mobs.add(type);
log.info(String.format("%s will not burn in the sun.", type.name()));
break;
}
}
}
}