Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. //ITEMREGEN
  2. ArrayList<Item> arrayitemregen = new ArrayList<Item>();
  3.  
  4.  
  5. //ITEMREGEN
  6. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
  7.  
  8. @Override
  9. public void run() {
  10. for(Item item : arrayitemregen) {
  11.  
  12. if(!item.isOnGround()) {
  13. for(Player p : Bukkit.getOnlinePlayers()) {
  14.  
  15. p.getWorld().spawnParticle(Particle.REDSTONE, item.getLocation(), 1, new Particle.DustOptions(Color.fromBGR(new Random().nextInt(255), new Random().nextInt(255), new Random().nextInt(255)), 15));
  16.  
  17. }
  18. }
  19.  
  20.  
  21.  
  22. }
  23.  
  24.  
  25.  
  26.  
  27. }
  28.  
  29. }, 0, 1);
  30.  
  31.  
  32.  
  33. //ITEMREGEN
  34. @EventHandler
  35. public void onpickup3(PlayerPickupItemEvent e) {
  36.  
  37. if(arrayitemregen.contains(e.getItem())) {
  38. arrayitemregen.remove(e.getItem());
  39. }
  40.  
  41. }
  42.  
  43.  
  44. //ITEMREGEN
  45. @EventHandler
  46. public void onbreako(BlockBreakEvent e) {
  47. ArrayList<Location> arrayloc = new ArrayList<Location>();
  48.  
  49. if(e.getBlock().getType() == Material.GRASS_BLOCK) {
  50.  
  51. //x ,y, z kleine zahlen
  52. Location eckpunkt1 = new Location(Bukkit.getWorld("world"), 33, 90, 297);
  53. //x ,y, z große zahl
  54. Location eckpunkt2 = new Location(Bukkit.getWorld("world"), 71, 120, 326);
  55.  
  56. for(int x = eckpunkt1.getBlockX(); x < eckpunkt2.getBlockX();x++) {
  57.  
  58. for(int y = eckpunkt1.getBlockY(); y < eckpunkt2.getBlockY();y++) {
  59.  
  60. for(int z = eckpunkt1.getBlockZ(); z < eckpunkt2.getBlockZ();z++) {
  61.  
  62. Location loc = new Location(Bukkit.getWorld("world"), x, y, z).add(0.5, 0, 0.5);
  63. arrayloc.add(loc);
  64. }
  65. }
  66. }
  67. //anzahl der drops festlegen!! abhäng von userzahlen ?!
  68. for(int i = 0;i<10;i++) {
  69. Random r=new Random();
  70. int randomNumber=r.nextInt(arrayloc.size());
  71.  
  72. Location randloc = arrayloc.get(randomNumber);
  73. ItemStack is = new ItemStack(Material.DIAMOND);
  74. Item item1 = Bukkit.getWorld("world").dropItem(randloc, is);
  75. arrayitemregen.add(item1);
  76. }
  77. }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement