本文整理匯總了Java中org.bukkit.Material.IRON_BLOCK屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.IRON_BLOCK屬性的具體用法?Java Material.IRON_BLOCK怎麽用?Java Material.IRON_BLOCK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.Material
的用法示例。
在下文中一共展示了Material.IRON_BLOCK屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onInteract
public void onInteract(PlayerInteractEvent e, Entity ent) {
//e.getPlayer().sendMessage("A");
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
for (Entity en : e.getPlayer().getWorld().getEntities()) {
if (en.getCustomName() != null && en.getCustomName().equals(getName()) && en.getLocation().add(-0.5, 0, -0.5).equals(e.getClickedBlock().getLocation())) {
Menu m;
if (e.getPlayer().getInventory().getItemInHand().getType() == Material.TRIPWIRE_HOOK) {
m = new Menu("Keycode2", 27);
}
else {
m = new Menu("Keycode", 27);
}
ItemStack code = new ItemStack(Material.PAPER, 1);
ItemMeta codem = code.getItemMeta();
codem.setDisplayName("&f&l".replace('&', '�'));
code.setItemMeta(codem);
m.inv.setItem(15, code);
ItemStack res = new ItemStack(Material.BUCKET, 1);
ItemMeta resm = res.getItemMeta();
resm.setDisplayName("&f&lReset".replace('&', '�'));
res.setItemMeta(resm);
m.inv.setItem(13, res);
for (int i = 0; i < 27; i++) {
ItemStack it = new ItemStack(Material.IRON_BLOCK, 1);
HashMap<Integer, Integer> id = new HashMap<Integer, Integer>();
id.put(0, 1);
id.put(1, 2);
id.put(2, 3);
id.put(9, 4);
id.put(10, 5);
id.put(11, 6);
id.put(18, 7);
id.put(19, 8);
id.put(20, 9);
id.put(12, 0);
if (id.containsKey(i)) {
ItemMeta itm = it.getItemMeta();
itm.setDisplayName(("&f&l" + String.valueOf(id.get(i))).replace('&', '�'));
it.setItemMeta(itm);
m.inv.setItem(i, it);
}
}
if (plu.containsKey(e.getPlayer())) {plu.remove(e.getPlayer());}
if (plr.containsKey(e.getPlayer())) {plr.remove(e.getPlayer());}
if (plrs.contains(e.getPlayer())) {plrs.remove(e.getPlayer());}
if (e.getPlayer().getInventory().getItemInHand().getType() == Material.TRIPWIRE_HOOK) {
m.show(e.getPlayer());
e.getPlayer().sendMessage(ChatColor.GREEN + "Please enter the keycode to then reset");
plr.put(e.getPlayer(), en);
}
else {
m.show(e.getPlayer());
e.getPlayer().sendMessage(ChatColor.GREEN + "Please enter the keycode");
plu.put(e.getPlayer(), en);
}
e.setCancelled(true);
}
}
}
}