本文整理匯總了Java中org.bukkit.Material.MONSTER_EGGS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.MONSTER_EGGS屬性的具體用法?Java Material.MONSTER_EGGS怎麽用?Java Material.MONSTER_EGGS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.Material
的用法示例。
在下文中一共展示了Material.MONSTER_EGGS屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
}
}