本文整理汇总了Java中org.bukkit.Material.EMERALD属性的典型用法代码示例。如果您正苦于以下问题:Java Material.EMERALD属性的具体用法?Java Material.EMERALD怎么用?Java Material.EMERALD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.EMERALD属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setVale
public static void setVale(Player player, int amount) throws SQLException {
UUID uuid = player.getUniqueId();
PreparedStatement stmt = plugin.getDb().getConnection().prepareStatement("UPDATE vale_eco SET amount = "+amount+" WHERE uuid = '"+uuid.toString()+"'");
stmt.executeUpdate();
ItemStack item = new ItemStack(Material.EMERALD, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GREEN.toString() + getVale(player) + (getVale(player)==1?" Vale":" Vales"));
meta.addEnchant(Enchantment.LUCK, 1, true);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(meta);
if(plugin.getConfig().getString("valeitemininv").equals("true")){
player.getInventory().setItem(8, item);
}
}
示例2: testisSpaceAvailabletrue
@Test
public void testisSpaceAvailabletrue()
{
PlayerInventory pi = mock(PlayerInventory.class);
doReturn(pi).when(player).getInventory();
ItemStack itemStack = new ItemStack(Material.EMERALD);
assertTrue(Util.isSpaceAvailable(player, itemStack));
}
示例3: testisSpaceAvailablefalse
@Test
public void testisSpaceAvailablefalse()
{
Player player = spy(Player.class);
PlayerInventory pi = mock(PlayerInventory.class);
when(player.getInventory()).thenReturn(pi);
when(pi.getItem(anyInt())).thenReturn(new ItemStack(Material.GRASS));
ItemStack itemStack = new ItemStack(Material.EMERALD);
assertFalse(Util.isSpaceAvailable(player, itemStack));
}
示例4: load
public void load() {
// Power Crystal
ItemStack pcrys = new ItemStack(Material.DIAMOND);
ItemMeta pcrysm = pcrys.getItemMeta();
pcrysm.setDisplayName("&b&lPower Crystal".replace('&', '�'));
ArrayList<String> pcrysl = new ArrayList<String>();
pcrysl.add("&b&l0 / 100,000 RF".replace('&', '�'));
pcrysm.setLore(pcrysl);
pcrys.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 100);
pcrys.setItemMeta(pcrysm);
CustomItem pc = new PowerCrystal(pcrys, "superiorcraft:power_crystal");
SuperiorCraft.plugin.getServer().getPluginManager().registerEvents(pc, SuperiorCraft.plugin);
// Uranium Ingot
ItemStack uing = new ItemStack(Material.EMERALD);
ItemMeta uingm = uing.getItemMeta();
uingm.setDisplayName("&2Uranium Ingot".replace('&', '�'));
ArrayList<String> uingl = new ArrayList<String>();
uingl.add("&2A radioactive material".replace('&', '�'));
uingm.setLore(uingl);
uing.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 100);
uing.setItemMeta(uingm);
CustomItem ui = new UraniumIngot(uing, "more:uranium_ingot");
SuperiorCraft.plugin.getServer().getPluginManager().registerEvents(ui, SuperiorCraft.plugin);
}
示例5: getBackIcon
protected static ItemStack getBackIcon()
{
ItemStack stack = new ItemStack(Material.EMERALD, 1);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.GREEN + "« Retour");
stack.setItemMeta(meta);
return stack;
}
示例6: onBlockDispense
@EventHandler(priority = EventPriority.HIGH)
public void onBlockDispense(final BlockDispenseEvent event) {
if (!event.isCancelled()) {
if (PermissionInterface.CheckEnabledWorld(event.getBlock().getLocation()) && (event.getItem().getType() == Material.EMERALD)) {
event.setCancelled(true);
}
}
if(!event.isCancelled())
AimCannonPlayerListener.onBlockDispense(event);
}
示例7: getPlaceholder7
/**
* l.add("��9��һҳ");
* @return ��һҳ
*/
public static ItemStack getPlaceholder7(){
ItemStack sw=new ItemStack(Material.EMERALD);
ItemMeta im = sw.getItemMeta();
im.setDisplayName("��9��l��һҳ");
List<String> l=new LinkedList<String>();
l.add("��9��һ������");
im.setLore(l);
sw.setItemMeta(im);
return sw;
}
示例8: onCompassClick
@EventHandler
public void onCompassClick(PlayerInteractEvent event) {
if (event.getItem() == null || event.getItem().getType() != Material.EMERALD)
return;
Player p = event.getPlayer();
ItemStack stack = event.getItem();
if (stack.getItemMeta().hasDisplayName()) {
String display = Chat.stripColor(stack.getItemMeta().getDisplayName());
if (display.equalsIgnoreCase("voting panel")) {
new VotePanel(p).show();
}
}
}
示例9: addMetaIfNeeded
private ItemStack addMetaIfNeeded(ItemStack stack)
{
Material material = stack.getType();
if (material == Material.COAL || material == Material.IRON_INGOT || material == Material.GOLD_INGOT || material == Material.DIAMOND || material == Material.EMERALD || material == Material.QUARTZ)
return Meta.addMeta(stack);
else
return stack;
}
示例10: customDeath
@EventHandler(priority=EventPriority.HIGHEST)
public void customDeath(EntityDamageByEntityEvent e){
if(e.isCancelled())return;
if(e.getEntity() instanceof Player && e.getDamager() instanceof Player){
Player p = (Player) e.getEntity();
if(e.getFinalDamage() >= p.getHealth()){
Player killer = (Player) e.getDamager();
String uuid2 = killer.getUniqueId().toString();
e.setCancelled(true);
if(! p.getName().equals(killer.getName())){ // if they were killed by someone else, not themselves
setTokens(uuid2, getTokens(uuid2)+2);
killer.sendMessage(tag + ChatColor.BLUE + "You have received " + ChatColor.GOLD + "2" +
ChatColor.BLUE + " tokens for killing " + p.getName());
}
Bukkit.getServer().broadcastMessage(ChatColor.GRAY + killer.getName() + " destroyed " + p.getName());
// Set statistics
//killer.setStatistic(Statistic.KILL_ENTITY, killer.getStatistic(Statistic.KILL_ENTITY) + 1);
//p.setStatistic(Statistic.DEATHS, p.getStatistic(Statistic.DEATHS) + 1);
// Reset health, so they dont die
p.setHealth(p.getMaxHealth());
// Inventory clearing
p.getInventory().clear();
ItemStack air = new ItemStack(Material.AIR);
p.getInventory().setHelmet(air);
p.getInventory().setChestplate(air);
p.getInventory().setLeggings(air);
p.getInventory().setBoots(air);
// Drop emerald at death location
ItemStack reward = new ItemStack(Material.EMERALD);
p.getWorld().dropItemNaturally(p.getLocation(), reward);
// Clear potion effects
for(PotionEffect pe : p.getActivePotionEffects()){
p.removePotionEffect(pe.getType());
}
// Stop infinite kill glitch
p.setGameMode(GameMode.SPECTATOR);
p.setGameMode(GameMode.ADVENTURE);
// Send them to the SPAWN of the world
p.teleport(p.getWorld().getSpawnLocation());
p.setFireTicks(0);
}
}
}