Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PicaretaEvento implements Listener {
- private static List<String> MUNDOS = Main.getPlugin().getConfig().getStringList("Blacklist.Mundos");
- private static int CAMADA = Main.getPlugin().getConfig().getInt("Config.Camada");
- @EventHandler
- public static void aoQuebrar(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- MPlayer mp = MPlayer.get(p);
- if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
- if (e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)) {
- int dura = 25;
- if (p.getItemInHand() != null) {
- if (!p.getItemInHand().getType().equals(Material.AIR)) {
- if (p.getItemInHand().hasItemMeta()) {
- if (p.getItemInHand().getType().equals(Material.DIAMOND_PICKAXE)) {
- if (p.getItemInHand().getItemMeta().getLore().contains("§7Força bruta I§2§2§3§4§7§1§r")) {
- if (p.getItemInHand().getItemMeta().getLore().contains("§7Força bruta I§2§2§3§4§7§1§r")) {
- if (e.getClickedBlock() == null) {
- return;
- }
- for (String mundos : MUNDOS) {
- if (p.getWorld().getName().equalsIgnoreCase(mundos)) {
- return;
- }
- }
- if (e.getClickedBlock().getType().equals(Material.AIR)) {
- return;
- }
- if (e.getClickedBlock().getType().equals(Material.BEDROCK)) {
- if (e.getClickedBlock().getLocation().getBlockY() <= CAMADA) {
- p.sendMessage(Main.getPlugin().getConfig().getString("Mensagens.CamadaInvalida").replace("&", "§").replace("{camada}", "" + e.getClickedBlock().getY()));
- return;
- }
- FactionUtil fu = new FactionUtil();
- if (p.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) {
- int lvl = p.getItemInHand().getEnchantmentLevel(Enchantment.DURABILITY);
- if (lvl == 1) {
- dura = 23;
- }
- if (lvl == 2) {
- dura = 21;
- }
- if (lvl == 3) {
- dura = 19;
- }
- if (lvl == 4) {
- dura = 17;
- }
- if (lvl == 5){
- dura = 15;
- }
- }
- if (!fu.getFaction(e.getClickedBlock().getLocation()).isNone()) {
- if (!mp.isOverriding()) {
- if (fu.getFaction(e.getClickedBlock().getLocation()).equals(mp.getFaction())) {
- if (mp.getRole().equals(Rel.RECRUIT)) {
- p.sendMessage(Main.getPlugin().getConfig().getString("Mensagens.Recruta").replace("&", "§"));
- return;
- }
- e.getClickedBlock().breakNaturally();
- int du = p.getItemInHand().getDurability() + dura;
- if (du >= p.getItemInHand().getType().getMaxDurability()) {
- p.setItemInHand(new ItemStack(Material.AIR));
- p.playSound(p.getLocation(), Sound.ITEM_BREAK, 1.0F, 1.0F);
- return;
- }
- p.getItemInHand().setDurability((short)du);
- return;
- }
- return;
- }
- }
- e.getClickedBlock().breakNaturally();
- int du = p.getItemInHand().getDurability() + dura;
- if (du >= p.getItemInHand().getType().getMaxDurability()) {
- p.setItemInHand(new ItemStack(Material.AIR));
- p.playSound(p.getLocation(), Sound.ITEM_BREAK, 1.0F, 1.0F);
- return;
- }
- p.getItemInHand().setDurability((short)du);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement