Guest Alomax Postado Junho 27, 2016 Denunciar Postado Junho 27, 2016 Tenho esse codigo @SuppressWarnings("deprecation") @EventHandler public void minerar(BlockBreakEvent e) { Block bloco = e.getBlock(); Player p = e.getPlayer(); if (p.getItemInHand().getType() == Material.WOOD_PICKAXE || p.getItemInHand().getType() == Material.STONE_PICKAXE || p.getItemInHand().getType() == Material.IRON_PICKAXE || p.getItemInHand().getType() == Material.GOLD_PICKAXE || p.getItemInHand().getType() == Material.DIAMOND_PICKAXE) { if (p.getItemInHand().getItemMeta().getEnchants().get(Enchantment.SILK_TOUCH) != null) { if (bloco.getType().getId() == 52) { p.getInventory().addItem(new ItemStack(Material.MOB_SPAWNER)); } } } } Como faço pra ele verificar se o chão ta claimado?Porque mesmo quebrando um local claimado, ele manda o item pro inventário. Plugin que eu uso: https://www.spigotmc.org/resources/griefprevention.1884/ Talvez isso aqui seja a API n sei ;-;: https://github.com/ryanhamshire/GriefPrevention/blob/master/src/me/ryanhamshire/GriefPrevention
leonardosc Postado Junho 28, 2016 Denunciar Postado Junho 28, 2016 Deu erro no no erro !canBreak The method canBreak(Location, Player, Material) is undefined for the type Main Muda pra canBreakAt
_Kurimatzu_ Postado Junho 27, 2016 Denunciar Postado Junho 27, 2016 Claim.allowEdit(Player p); https://github.com/ryanhamshire/GriefPrevention/blob/master/src/me/ryanhamshire/GriefPrevention/Claim.java
Guest Alomax Postado Junho 27, 2016 Denunciar Postado Junho 27, 2016 Claim.allowEdit(Player p); https://github.com/ryanhamshire/GriefPrevention/blob/master/src/me/ryanhamshire/GriefPrevention/Claim.java Não rola um codigo não? ;-;
MrPowerGamerBR Postado Junho 27, 2016 Denunciar Postado Junho 27, 2016 // Verificar se player pode quebrar bloco em public static boolean canBreakAt(Location loc, Player p, Material m) { // WorldGuard & GriefPrevention Claim claim = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null); String canBuildClaim = null; if (claim != null) { canBuildClaim = claim.allowBreak(p, m); } if (getWorldGuard().canBuild(p, loc) && canBuildClaim == null) { return true; } return false; } public static WorldGuardPlugin getWorldGuard() { Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard"); // WorldGuard may not be loaded if (plugin == null || !(plugin instanceof WorldGuardPlugin)) { return null; // Maybe you want throw an exception instead } return (WorldGuardPlugin) plugin; }
leonardosc Postado Junho 28, 2016 Denunciar Postado Junho 28, 2016 Tenho esse codigo @SuppressWarnings("deprecation") @EventHandler public void minerar(BlockBreakEvent e) { Block bloco = e.getBlock(); Player p = e.getPlayer(); if (p.getItemInHand().getType() == Material.WOOD_PICKAXE || p.getItemInHand().getType() == Material.STONE_PICKAXE || p.getItemInHand().getType() == Material.IRON_PICKAXE || p.getItemInHand().getType() == Material.GOLD_PICKAXE || p.getItemInHand().getType() == Material.DIAMOND_PICKAXE) { if (p.getItemInHand().getItemMeta().getEnchants().get(Enchantment.SILK_TOUCH) != null) { if (bloco.getType().getId() == 52) { p.getInventory().addItem(new ItemStack(Material.MOB_SPAWNER)); } } } } Como faço pra ele verificar se o chão ta claimado? Porque mesmo quebrando um local claimado, ele manda o item pro inventário. Plugin que eu uso: https://www.spigotmc.org/resources/griefprevention.1884/ Talvez isso aqui seja a API n sei ;-;: https://github.com/ryanhamshire/GriefPrevention/blob/master/src/me/ryanhamshire/GriefPrevention Testa o do MrPower...
Guest Alomax Postado Junho 28, 2016 Denunciar Postado Junho 28, 2016 Testa o do MrPower... eu nao seii
leonardosc Postado Junho 28, 2016 Denunciar Postado Junho 28, 2016 (editado) eu nao seii poura vei Adiciona akeles métodos... @SuppressWarnings("deprecation") @EventHandler public void minerar(BlockBreakEvent e) { Block bloco = e.getBlock(); Player p = e.getPlayer(); if (p.getItemInHand().getType() == Material.WOOD_PICKAXE || p.getItemInHand().getType() == Material.STONE_PICKAXE || p.getItemInHand().getType() == Material.IRON_PICKAXE || p.getItemInHand().getType() == Material.GOLD_PICKAXE || p.getItemInHand().getType() == Material.DIAMOND_PICKAXE) { if (p.getItemInHand().getItemMeta().getEnchants().get(Enchantment.SILK_TOUCH) != null) { if (!canBreak(bloco.getLocation(), p, p.getItemInHand().getType())) { // voce n pode kebra essa budega;... return; } if (bloco.getType().getId() == 52) { p.getInventory().addItem(new ItemStack(Material.MOB_SPAWNER)); } } } } Editado Junho 28, 2016 por leonardosc
Guest Alomax Postado Junho 28, 2016 Denunciar Postado Junho 28, 2016 poura vei Adiciona akeles métodos... @SuppressWarnings("deprecation") @EventHandler public void minerar(BlockBreakEvent e) { Block bloco = e.getBlock(); Player p = e.getPlayer(); if (p.getItemInHand().getType() == Material.WOOD_PICKAXE || p.getItemInHand().getType() == Material.STONE_PICKAXE || p.getItemInHand().getType() == Material.IRON_PICKAXE || p.getItemInHand().getType() == Material.GOLD_PICKAXE || p.getItemInHand().getType() == Material.DIAMOND_PICKAXE) { if (p.getItemInHand().getItemMeta().getEnchants().get(Enchantment.SILK_TOUCH) != null) { if (!canBreak(bloco.getLocation(), p, p.getItemInHand().getType())) { // voce n pode kebra essa budega;... return; } if (bloco.getType().getId() == 52) { p.getInventory().addItem(new ItemStack(Material.MOB_SPAWNER)); } } } } Deu erro no no erro !canBreak The method canBreak(Location, Player, Material) is undefined for the type Main
leonardosc Postado Junho 28, 2016 Denunciar Postado Junho 28, 2016 Sua dúvida foi marcada como [Resolvido] e movido à área de dúvidas resolvidas. Atenciosamente, Gamer's Board
Pergunta
Guest Alomax
Tenho esse codigo
@SuppressWarnings("deprecation") @EventHandler public void minerar(BlockBreakEvent e) { Block bloco = e.getBlock(); Player p = e.getPlayer(); if (p.getItemInHand().getType() == Material.WOOD_PICKAXE || p.getItemInHand().getType() == Material.STONE_PICKAXE || p.getItemInHand().getType() == Material.IRON_PICKAXE || p.getItemInHand().getType() == Material.GOLD_PICKAXE || p.getItemInHand().getType() == Material.DIAMOND_PICKAXE) { if (p.getItemInHand().getItemMeta().getEnchants().get(Enchantment.SILK_TOUCH) != null) { if (bloco.getType().getId() == 52) { p.getInventory().addItem(new ItemStack(Material.MOB_SPAWNER)); } } } }Como faço pra ele verificar se o chão ta claimado?
Porque mesmo quebrando um local claimado, ele manda o item pro inventário.
Plugin que eu uso: https://www.spigotmc.org/resources/griefprevention.1884/
Talvez isso aqui seja a API n sei ;-;: https://github.com/ryanhamshire/GriefPrevention/blob/master/src/me/ryanhamshire/GriefPrevention
9 respostass a esta questão
Posts Recomendados