use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerCount method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("spawner_count") && mechanism.requireInteger()) {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
state.setSpawnCount(mechanism.getValue().asInt());
meta.setBlockState(state);
item.setItemMeta(meta);
}
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerCount method getObjectAttribute.
@Override
public ObjectTag getObjectAttribute(Attribute attribute) {
if (attribute == null) {
return null;
}
// -->
if (attribute.startsWith("spawner_count")) {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
return new ElementTag(state.getSpawnCount()).getObjectAttribute(attribute.fulfill(1));
}
return null;
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerMaxNearbyEntities method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("spawner_max_nearby_entities") && mechanism.requireInteger()) {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
state.setMaxNearbyEntities(mechanism.getValue().asInt());
meta.setBlockState(state);
item.setItemMeta(meta);
}
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerRange method getPropertyString.
@Override
public String getPropertyString() {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
return String.valueOf(state.getSpawnRange());
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerRange method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("spawner_range") && mechanism.requireInteger()) {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
state.setSpawnRange(mechanism.getValue().asInt());
meta.setBlockState(state);
item.setItemMeta(meta);
}
}
Aggregations