本文整理汇总了Java中org.bukkit.Material.BOW属性的典型用法代码示例。如果您正苦于以下问题:Java Material.BOW属性的具体用法?Java Material.BOW怎么用?Java Material.BOW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.BOW属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGrenadeLaunch
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onGrenadeLaunch(final ProjectileLaunchEvent event) {
if (event.getEntity().getShooter() instanceof Player) {
Player player = (Player) event.getEntity().getShooter();
ItemStack stack = player.getItemInHand();
if(stack != null) {
// special case for grenade arrows
if (stack.getType() == Material.BOW) {
int arrows = player.getInventory().first(Material.ARROW);
if (arrows == -1) return;
stack = player.getInventory().getItem(arrows);
}
Grenade grenade = Grenade.ITEM_TAG.get(stack);
if(grenade != null) {
grenade.set(plugin, event.getEntity());
}
}
}
}
示例2: isInteractableItem
/**
* checks if this item is interactable
*/
public static boolean isInteractableItem(ItemStack item) {
if (item == null || item.getType() == Material.AIR) {
return false;
}
if (item.getType().isBlock()) {
return true;
}
if (item.getType() == Material.REDSTONE || item.getType() == Material.WATER_BUCKET || item.getType() == Material.LAVA_BUCKET) {
return true;
}
if (item.getType() == Material.MONSTER_EGG) {
return true;
}
if (item.getType() == Material.EGG || item.getType() == Material.SNOW_BALL || item.getType() == Material.BOW || item.getType() == Material.ENDER_PEARL || item.getType() == Material.EYE_OF_ENDER || item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.EXP_BOTTLE || item.getType() == Material.FIREWORK_CHARGE) {
return true;
}
if (item.getType().isEdible()) {
return true;
}
return false;
}
示例3: onPlayerInteract2
@EventHandler
public void onPlayerInteract2(PlayerInteractEvent e) {
Player player = e.getPlayer();
PlayerInventory inventory = player.getInventory();
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
Material material = inventory.getItemInHand().getType();
if(material == Material.BOW) {
DynamicAC.getManager().getBackend().logBowWindUp(player, System.currentTimeMillis());
} else if(Utilities.isFood(material)) {
DynamicAC.getManager().getBackend().logEatingStart(player);
}
}
Block block = e.getClickedBlock();
if(block != null) {
Distance distance = new Distance(player.getLocation(), block.getLocation());
DynamicAC.getManager().getBackend().checkLongReachBlock(player,distance.getXDifference(),distance
.getYDifference(),distance.getZDifference());
}
}
示例4: enchantsGUI
static void enchantsGUI(Player player){
enchantsGUI = Bukkit.createInventory(null, 9, ChatColor.DARK_GRAY + "Enchantments");
ItemStack meleeCategory = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta meleeMeta = meleeCategory.getItemMeta();
meleeMeta.setDisplayName(ChatColor.RED + "Melee Enchantments");
meleeCategory.setItemMeta(meleeMeta);
ItemStack bowCategory = new ItemStack(Material.BOW);
ItemMeta bowMeta = bowCategory.getItemMeta();
bowMeta.setDisplayName(ChatColor.RED + "Bow Enchantments");
bowCategory.setItemMeta(bowMeta);
ItemStack armorCategory = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemMeta armorMeta = armorCategory.getItemMeta();
armorMeta.setDisplayName(ChatColor.RED + "Armor Enchantments");
armorCategory.setItemMeta(armorMeta);
ItemStack filler = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7);
ItemMeta fillerMeta = filler.getItemMeta();
fillerMeta.setDisplayName(ChatColor.GRAY + "");
filler.setItemMeta(fillerMeta);
enchantsGUI.setItem(0, filler);
enchantsGUI.setItem(1, meleeCategory);
enchantsGUI.setItem(2, filler);
enchantsGUI.setItem(3, filler);
enchantsGUI.setItem(4, bowCategory);
enchantsGUI.setItem(5, filler);
enchantsGUI.setItem(6, filler);
enchantsGUI.setItem(7, armorCategory);
enchantsGUI.setItem(8, filler);
player.openInventory(enchantsGUI);
}
示例5: onItemUse
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemUse(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!InventoryManager.playerIsLoaded(player) || !event.hasItem()) {
return;
}
if (!ItemManager.allowedForPlayer(player, event.getItem(), true)) {
event.setCancelled(true);
PlayerUtils.updateInventory(player);
return;
}
if (CustomItem.isCustomItem(event.getItem())) {
CustomItem customItem = ItemManager.getCustomItem(event.getItem());
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
customItem.onRightClick(player);
} else {
customItem.onLeftClick(player);
}
if (event.getItem().getType() != Material.BOW) {
event.setCancelled(true);
}
}
ItemManager.updateStats(player);
}
示例6: onInteract
@EventHandler
public void onInteract(PlayerInteractEvent e) {
final TOAUser u = TOA.getPlayer(e.getPlayer());
if (e.getItem() != null) {
Material m = e.getItem().getType();
if (m == Material.WRITTEN_BOOK || m == Material.BOW || m == Material.SHEARS || m == Material.DIAMOND_SWORD) return;
Ability.useAbility(u, e.getItem().getType());
e.setCancelled(true);
}
if (!u.isOnRank(PACmd.Grupo.Builder)) {
if (e.getClickedBlock() != null) {
if (e.getClickedBlock().getType().equals(Material.TRAP_DOOR) || e.getClickedBlock().getType().equals(Material.IRON_TRAPDOOR)
|| e.getClickedBlock().getType().equals(Material.FENCE_GATE) || e.getClickedBlock().getType().equals(Material.FIRE)
|| e.getClickedBlock().getType().equals(Material.CAULDRON) || e.getClickedBlock().getRelative(BlockFace.UP).getType().equals(Material.FIRE)
|| e.getClickedBlock().getType() == Material.CHEST || e.getClickedBlock().getType() == Material.TRAPPED_CHEST
|| e.getClickedBlock().getType() == Material.DROPPER || e.getClickedBlock().getType() == Material.DISPENSER
|| e.getClickedBlock().getType() == Material.BED_BLOCK || e.getClickedBlock().getType() == Material.BED
|| e.getClickedBlock().getType() == Material.WORKBENCH || e.getClickedBlock().getType() == Material.BREWING_STAND
|| e.getClickedBlock().getType() == Material.ANVIL || e.getClickedBlock().getType() == Material.DARK_OAK_FENCE_GATE
|| e.getClickedBlock().getType() == Material.SPRUCE_FENCE_GATE || e.getClickedBlock().getType() == Material.FURNACE
|| e.getClickedBlock().getType() == Material.BURNING_FURNACE || e.getClickedBlock().getType() == Material.HOPPER
|| e.getClickedBlock().getType() == Material.STONE_BUTTON || e.getClickedBlock().getType() == Material.WOOD_BUTTON) {
e.setCancelled(true);
}
}
}
}
示例7: register
public void register() {
ItemStack selector = new ItemStack(Material.BOW);
ItemMeta im = selector.getItemMeta();
im.setDisplayName("§a弓");
selector.setItemMeta(im);
this.setSelector(selector);
ItemStack show = new ItemStack(Material.BOW);
im = show.getItemMeta();
im.setDisplayName("§a弓§7(右键使用)");
show.setItemMeta(im);
this.setShow(show);
this.setSkillType(SkillType.ITEM);
Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
SkillManager.getInstance().register(this);
}
示例8: openJoinGUI
public static void openJoinGUI(Player p) {
inv = Bukkit.createInventory(null, 27, title);
List<String> WizardLore = new ArrayList<String>();
List<String> SwordsmanLore = new ArrayList<String>();
List<String> ArcherLore = new ArrayList<String>();
List<String> TopLore = new ArrayList<String>();
ItemStack WizardChoose = new ItemStack(Material.BLAZE_ROD);
ItemMeta WizardMeta = WizardChoose.getItemMeta();
ItemStack SwordsmanChoose = new ItemStack(Material.IRON_SWORD);
ItemMeta SwordsmanMeta = SwordsmanChoose.getItemMeta();
ItemStack ArcherChoose = new ItemStack(Material.BOW);
ItemMeta ArcherMeta = ArcherChoose.getItemMeta();
ItemStack Top = new ItemStack(Material.WRITTEN_BOOK);
ItemMeta TopMeta = Top.getItemMeta();
WizardMeta.setDisplayName(Main.colorThis("&9Wizard"));
WizardMeta.setLore(WizardLore);
WizardChoose.setItemMeta(WizardMeta);
TopMeta.setDisplayName(Main.colorThis("&c&lRealm of Mythos"));
SwordsmanMeta.setDisplayName(Main.colorThis("&4Swordsman"));
SwordsmanMeta.setLore(SwordsmanLore);
SwordsmanChoose.setItemMeta(SwordsmanMeta);
ArcherMeta.setDisplayName(Main.colorThis("&cArcher"));
ArcherMeta.setLore(ArcherLore);
ArcherChoose.setItemMeta(ArcherMeta);
TopMeta.setLore(TopLore);
Top.setItemMeta(TopMeta);
inv.setItem(4, Top);
inv.setItem(12, WizardChoose);
inv.setItem(13, SwordsmanChoose);
inv.setItem(14, ArcherChoose);
ItemStack block = new ItemStack(Material.STAINED_GLASS_PANE);
block.getItemMeta().setDisplayName("");
for(int i = 0; i < 27; i++){
if(i == 4 || i == 12 || i == 13 || i == 14){
}else{
inv.setItem(i, block);
}
}
p.openInventory(inv);
}
示例9: clearJunk
public void clearJunk(){
World world = Bukkit.getWorld("kaospvp");
List<Entity> list = world.getEntities();
for(Entity e : list){
if(e instanceof Item){
Item it = (Item) e;
if( it.getItemStack().getType() == Material.POTION &&
it.getItemStack().getDurability() == 16453){
e.remove();
}
if( it.getItemStack().getType() == Material.GOLDEN_APPLE &&
it.getItemStack().getDurability() == 0){
e.remove();
}
if( it.getItemStack().getType() == Material.ARROW){
e.remove();
}
if( it.getItemStack().getType() == Material.GLASS_BOTTLE){
e.remove();
}
if( it.getItemStack().getType() == Material.DIAMOND_BOOTS &&
it.getItemStack().getEnchantments().size() == 0){
e.remove();
}
if( it.getItemStack().getType() == Material.DIAMOND_LEGGINGS &&
it.getItemStack().getEnchantments().size() == 0){
e.remove();
}
if( it.getItemStack().getType() == Material.DIAMOND_CHESTPLATE &&
it.getItemStack().getEnchantments().size() == 0){
e.remove();
}
if( it.getItemStack().getType() == Material.DIAMOND_HELMET &&
it.getItemStack().getEnchantments().size() == 0){
e.remove();
}
if( it.getItemStack().getType() == Material.DIAMOND_SWORD &&
it.getItemStack().getEnchantments().size() == 0){
e.remove();
}
if( it.getItemStack().getType() == Material.BOW &&
it.getItemStack().getEnchantments().size() == 0){
e.remove();
}
if( it.getItemStack().getType() == Material.WOOD_AXE ||
it.getItemStack().getType() == Material.STONE_AXE ||
it.getItemStack().getType() == Material.GOLD_AXE ||
it.getItemStack().getType() == Material.IRON_AXE ||
it.getItemStack().getType() == Material.DIAMOND_AXE){
e.remove();
}
}
}
}
示例10: onCraftItem
private static void onCraftItem(Recipe recipe, CraftingInventory inventory)
{
if (recipe.getResult().getType() == Material.BOW)
inventory.setResult(new ItemStack(Material.AIR));
}
示例11: getMaterial
@Override public Material getMaterial() {
return Material.BOW;
}