Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (b.getType() == Material.STONE && b.getData() == 0) {
- User u = UserUtils.getUser(e.getPlayer());
- if (u == null) return;
- for (Drop d : DropUtils.getDrops()) {
- Random rand = new Random();
- int luck = rand.nextInt(101);
- if (luck > d.getSzansa() || p.hasPermission("mDrop.vip") && luck > d.getSzansaVip()) {
- continue;
- }
- if (b.getLocation().getBlockY() > d.getMinY()) {
- continue;
- }
- ItemStack item = p.getInventory().getItemInMainHand();
- ItemStack is = new ItemStack(d.getType());
- if(item == null) continue;
- int ilosc;
- switch (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)) {
- case 1:
- ilosc = rand.nextInt(d.getFi1m() - d.getFi1() + 1) + d.getFi1();
- break;
- case 2:
- ilosc = rand.nextInt(d.getFi2m() - d.getFi2() + 1) + d.getFi2();
- break;
- case 3:
- ilosc = rand.nextInt(d.getFi3m() - d.getFi3() + 1) + d.getFi3();
- break;
- default:
- ilosc = rand.nextInt(d.getIloscmax() - d.getIlosc() + 1) + d.getIlosc();
- break;
- }
- is.setDurability(d.getData());
- is.setAmount(ilosc);
- iTD.add(is);
- p.sendMessage(ChatColor.translateAlternateColorCodes('&', d.getMsg()) + " §7(" + ilosc + "szt) " + "§7[§c+" + d.getpoints() + "§7]");
- p.giveExp(d.getExp());
- u.addPkt(d.getpoints());
- }
- if (u.getPkt() >= u.getNextPkt()) {
- u.setLvl(u.getLvl() + 1);
- u.setPkt(0);
- u.setNextPkt((u.getNextPkt() * 0.3) + u.getNextPkt());
- p.sendMessage("§aAwansowales na: §6" + u.getLvl() + " §apoziom!");
- }
- if (u.getLvl()%10 == 0) {
- Bukkit.broadcastMessage("Gracz " + p.getName() + " awansowal na " + u.getLvl());
- }
- }
- for (ItemStack is : iTD) {
- if (canGet(is.getType(), p, is.getDurability())) {
- p.getInventory().addItem(is);
- } else {
- b.getWorld().dropItemNaturally(b.getLocation(), is);
- }
- }
- b.setType(Material.AIR);
- for (ItemStack is : drops) {
- if (canGet(is.getType(), p, is.getDurability())) {
- p.getInventory().addItem(is);
- } else b.getWorld().dropItemNaturally(b.getLocation(), is);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement