yLR111 Postado Janeiro 3, 2018 Denunciar Postado Janeiro 3, 2018 Como faço para reparar o item da mão do jogador quando clicar no villager?
Caique1394 Postado Janeiro 3, 2018 Denunciar Postado Janeiro 3, 2018 public void villagerClick(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof Villager) { ItemStack item = e.getPlayer().getItemInHand(); if ((item != null) && (item.getDurability() != 0) && (!item.getType().isBlock()) && (item.getType().getMaxDurability() >= 1)) { item.setDurability((short) 0); } } } Isso deve funcionar, não testei, qualquer coisa fala ae.
LeoT Postado Janeiro 3, 2018 Denunciar Postado Janeiro 3, 2018 Não testei @EventHandler private void clicar(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof Villager) { if (e.getRightClicked().getCustomName() != null && e.getRightClicked().getCustomName().equals("§cNomeVillager")) { Player p = e.getPlayer(); if (p.getItemInHand() != null && p.getItemInHand().getType() != Material.AIR) { if (p.getItemInHand().getDurability() != 0) { p.getItemInHand().setDurability((short) 0); } else { p.sendMessage("§cEsse item não precisa de reparos!"); } } } } }
yLR111 Postado Janeiro 3, 2018 Autor Denunciar Postado Janeiro 3, 2018 Não testei @EventHandler private void clicar(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof Villager) { if (e.getRightClicked().getCustomName() != null && e.getRightClicked().getCustomName().equals("§cNomeVillager")) { Player p = e.getPlayer(); if (p.getItemInHand() != null && p.getItemInHand().getType() != Material.AIR) { if (p.getItemInHand().getDurability() != 0) { p.getItemInHand().setDurability((short) 0); } else { p.sendMessage("§cEsse item não precisa de reparos!"); } } } } } Tem como coloca texto em baixo do nome do villager:? Olhe
LeoT Postado Janeiro 3, 2018 Denunciar Postado Janeiro 3, 2018 Tem como coloca texto em baixo do nome do villager:? Olhe Só com plugin á parte, se você quiser fazer igual o lobby do sky faz o seguinte: Nome do villager com alguma cor aleátoria, exemplo: '§1' Depois cria os hologramas com o HolograpichDisplays e move eles pra cima do villager Nos eventos do villager cheque se ele tem o customName como '§1'
zDarkFG Postado Janeiro 3, 2018 Denunciar Postado Janeiro 3, 2018 Sua dúvida foi marcada como [Resolvido] e movido à área de dúvidas resolvidas.Atenciosamente,Gamer's Board
Pergunta
yLR111
Como faço para reparar o item da mão do jogador quando clicar no villager?
5 respostass a esta questão
Posts Recomendados