本文整理汇总了Java中org.bukkit.Material.MOB_SPAWNER属性的典型用法代码示例。如果您正苦于以下问题:Java Material.MOB_SPAWNER属性的具体用法?Java Material.MOB_SPAWNER怎么用?Java Material.MOB_SPAWNER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.MOB_SPAWNER属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerInteract
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent e) {
if (!cm.isDisableChangeSpawnerType) {
return;
}
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (e.getClickedBlock().getType() == Material.MOB_SPAWNER) {
if (e.getItem() == null) {
return;
}
if (e.getPlayer().isOp()) {
return;
}
if (e.getItem().getType() == Material.MONSTER_EGG || e.getItem().getType() == Material.MONSTER_EGGS) {
e.setCancelled(true);
}
}
}
}
示例2: onModify
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onModify(PlayerInteractEvent evt) {
if (!preventSpawnerModify || evt.getItem() == null || evt.getAction() != Action.RIGHT_CLICK_BLOCK) return;
Player player = evt.getPlayer();
if (Perms.has(player)) return;
if (evt.getClickedBlock().getType() == Material.MOB_SPAWNER) {
Material type = evt.getItem().getType();
if (type == Material.MONSTER_EGG || type == Material.MONSTER_EGGS) {
evt.setCancelled(true);
AzureAPI.log(player, messagePreventSpawnerModify);
}
}
}
示例3: onBlockPlace
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if (event.getItemInHand().getType() != Material.MOB_SPAWNER)
return;
ItemStack is = event.getItemInHand();
if (!is.hasItemMeta())
return;
ItemMeta im = is.getItemMeta();
if (!im.hasLore())
return;
String lore = im.getLore().toString();
if (!lore.contains("Spawner:"))
return;
EntityType entity = getEntity(lore);
if (entity == EntityType.AREA_EFFECT_CLOUD) {
event.setCancelled(true);
return;
}
setSpawner(event.getBlock(), entity);
}
示例4: ShopItem
public ShopItem(Material material, short value, int amount, int buyPrice, int sellPrice, String displayName,
List<String> lore, boolean useDisplayName, String enchantments, String enchantmentLevels, int limit,
String extraData) {
this.amount = amount;
ItemStack item = new ItemStack(material, amount, value);
ItemMeta itemMeta = item.getItemMeta();
if (useDisplayName) {
itemMeta.setDisplayName(displayName);
}
if (!extraData.equalsIgnoreCase("") && !extraData.equalsIgnoreCase(" ") && material == Material.MOB_SPAWNER) {
itemMeta.setLore(Arrays.asList("Spawner: " + extraData));
}
item.setItemMeta(itemMeta);
addEnchantments(enchantments, enchantmentLevels, item);
this.item = item;
lore.addAll(Arrays.asList("Linker muis knop - kopen " + buyPrice + " coins"));
if (sellPrice > 0)
lore.addAll(Arrays.asList("Rechter muis knop - verkopen " + sellPrice + " coins"));
if (!extraData.equalsIgnoreCase("") && !extraData.equalsIgnoreCase(" ") && material == Material.MOB_SPAWNER) {
lore.addAll(Arrays.asList(" ", "Spawner: " + extraData));
}
this.limit = limit;
if (isLimited()) {
lore.addAll(Arrays.asList("Jouw faction kan dit item maximaal " + limit + "X kopen"));
}
ItemStack shopItem = new ItemStack(material, amount, value);
ItemMeta shopItemMeta = shopItem.getItemMeta();
shopItemMeta.setDisplayName(displayName);
shopItemMeta.setLore(lore);
shopItem.setItemMeta(shopItemMeta);
addEnchantments(enchantments, enchantmentLevels, shopItem);
this.displayItem = shopItem;
this.sellPrice = sellPrice;
this.buyPrice = buyPrice;
this.itemID = ShopsModule.getInstance().getItemID(item);
}