Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. //EXPREGEN
  2. @EventHandler
  3. public void onbreako1(BlockBreakEvent e) {
  4. ArrayList<Location> arraylocexp = new ArrayList<Location>();
  5.  
  6. if(e.getBlock().getType() == Material.BOOKSHELF) {
  7.  
  8. //x ,y, z kleine zahlen
  9. Location eckpunkt1 = new Location(Bukkit.getWorld("world"), 33, 90, 297);
  10. //x ,y, z große zahl
  11. Location eckpunkt2 = new Location(Bukkit.getWorld("world"), 71, 120, 326);
  12.  
  13. for(int x = eckpunkt1.getBlockX(); x < eckpunkt2.getBlockX();x++) {
  14.  
  15. for(int y = eckpunkt1.getBlockY(); y < eckpunkt2.getBlockY();y++) {
  16.  
  17. for(int z = eckpunkt1.getBlockZ(); z < eckpunkt2.getBlockZ();z++) {
  18.  
  19. Location loc = new Location(Bukkit.getWorld("world"), x, y, z).add(0.5, 0, 0.5);
  20. arraylocexp.add(loc);
  21. }
  22. }
  23. }
  24. //anzahl der drops festlegen!! abhäng von userzahlen ?!
  25. for(int i = 0;i<30;i++) {
  26. Random r=new Random();
  27. int randomNumber=r.nextInt(arraylocexp.size());
  28.  
  29. Location randloc = arraylocexp.get(randomNumber);
  30.  
  31. ExperienceOrb orb = (ExperienceOrb) Bukkit.getWorld("world").spawnEntity(randloc, EntityType.EXPERIENCE_ORB);
  32. orb.setExperience(new Random().nextInt(5));
  33. }
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement