Advertisement
Maniek2341

Untitled

Feb 4th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. if (b.getType() == Material.STONE && b.getData() == 0) {
  2. User u = UserUtils.getUser(e.getPlayer());
  3. if (u == null) return;
  4. for (Drop d : DropUtils.getDrops()) {
  5. Random rand = new Random();
  6. int luck = rand.nextInt(101);
  7. if (luck > d.getSzansa() || p.hasPermission("mDrop.vip") && luck > d.getSzansaVip()) {
  8. continue;
  9. }
  10. if (b.getLocation().getBlockY() > d.getMinY()) {
  11. continue;
  12. }
  13. ItemStack item = p.getInventory().getItemInMainHand();
  14. ItemStack is = new ItemStack(d.getType());
  15. if(item == null) continue;
  16.  
  17. int ilosc;
  18. switch (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)) {
  19. case 1:
  20. ilosc = rand.nextInt(d.getFi1m() - d.getFi1() + 1) + d.getFi1();
  21. break;
  22. case 2:
  23. ilosc = rand.nextInt(d.getFi2m() - d.getFi2() + 1) + d.getFi2();
  24. break;
  25. case 3:
  26. ilosc = rand.nextInt(d.getFi3m() - d.getFi3() + 1) + d.getFi3();
  27. break;
  28. default:
  29. ilosc = rand.nextInt(d.getIloscmax() - d.getIlosc() + 1) + d.getIlosc();
  30. break;
  31. }
  32. is.setDurability(d.getData());
  33. is.setAmount(ilosc);
  34. iTD.add(is);
  35. p.sendMessage(ChatColor.translateAlternateColorCodes('&', d.getMsg()) + " §7(" + ilosc + "szt) " + "§7[§c+" + d.getpoints() + "§7]");
  36. p.giveExp(d.getExp());
  37. u.addPkt(d.getpoints());
  38. }
  39. if (u.getPkt() >= u.getNextPkt()) {
  40. u.setLvl(u.getLvl() + 1);
  41. u.setPkt(0);
  42. u.setNextPkt((u.getNextPkt() * 0.3) + u.getNextPkt());
  43. p.sendMessage("§aAwansowales na: §6" + u.getLvl() + " §apoziom!");
  44. }
  45. if (u.getLvl()%10 == 0) {
  46. Bukkit.broadcastMessage("Gracz " + p.getName() + " awansowal na " + u.getLvl());
  47. }
  48. }
  49. for (ItemStack is : iTD) {
  50. if (canGet(is.getType(), p, is.getDurability())) {
  51. p.getInventory().addItem(is);
  52. } else {
  53. b.getWorld().dropItemNaturally(b.getLocation(), is);
  54. }
  55. }
  56. b.setType(Material.AIR);
  57. for (ItemStack is : drops) {
  58. if (canGet(is.getType(), p, is.getDurability())) {
  59. p.getInventory().addItem(is);
  60. } else b.getWorld().dropItemNaturally(b.getLocation(), is);
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement