use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerPlayerRange method getPropertyString.
@Override
public String getPropertyString() {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
return String.valueOf(state.getRequiredPlayerRange());
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerPlayerRange method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("spawner_player_range") && mechanism.requireInteger()) {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
state.setRequiredPlayerRange(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 ItemSpawnerType method getPropertyString.
@Override
public String getPropertyString() {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
return state.getSpawnedType().name();
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerType method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("spawner_type") && mechanism.requireObject(EntityTag.class)) {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
state.setSpawnedType(mechanism.valueAsType(EntityTag.class).getBukkitEntityType());
meta.setBlockState(state);
item.setItemMeta(meta);
}
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemBaseColor method setBaseColor.
private void setBaseColor(DyeColor color) {
ItemStack itemStack = item.getItemStack();
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta instanceof BlockStateMeta) {
Banner banner = (Banner) ((BlockStateMeta) itemMeta).getBlockState();
banner.setBaseColor(color);
banner.update();
((BlockStateMeta) itemMeta).setBlockState(banner);
} else {
((BannerMeta) itemMeta).setBaseColor(color);
}
itemStack.setItemMeta(itemMeta);
}
Aggregations