Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ITEMREGEN
- ArrayList<Item> arrayitemregen = new ArrayList<Item>();
- //ITEMREGEN
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
- @Override
- public void run() {
- for(Item item : arrayitemregen) {
- if(!item.isOnGround()) {
- for(Player p : Bukkit.getOnlinePlayers()) {
- 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));
- }
- }
- }
- }
- }, 0, 1);
- //ITEMREGEN
- @EventHandler
- public void onpickup3(PlayerPickupItemEvent e) {
- if(arrayitemregen.contains(e.getItem())) {
- arrayitemregen.remove(e.getItem());
- }
- }
- //ITEMREGEN
- @EventHandler
- public void onbreako(BlockBreakEvent e) {
- ArrayList<Location> arrayloc = new ArrayList<Location>();
- if(e.getBlock().getType() == Material.GRASS_BLOCK) {
- //x ,y, z kleine zahlen
- Location eckpunkt1 = new Location(Bukkit.getWorld("world"), 33, 90, 297);
- //x ,y, z große zahl
- Location eckpunkt2 = new Location(Bukkit.getWorld("world"), 71, 120, 326);
- for(int x = eckpunkt1.getBlockX(); x < eckpunkt2.getBlockX();x++) {
- for(int y = eckpunkt1.getBlockY(); y < eckpunkt2.getBlockY();y++) {
- for(int z = eckpunkt1.getBlockZ(); z < eckpunkt2.getBlockZ();z++) {
- Location loc = new Location(Bukkit.getWorld("world"), x, y, z).add(0.5, 0, 0.5);
- arrayloc.add(loc);
- }
- }
- }
- //anzahl der drops festlegen!! abhäng von userzahlen ?!
- for(int i = 0;i<10;i++) {
- Random r=new Random();
- int randomNumber=r.nextInt(arrayloc.size());
- Location randloc = arrayloc.get(randomNumber);
- ItemStack is = new ItemStack(Material.DIAMOND);
- Item item1 = Bukkit.getWorld("world").dropItem(randloc, is);
- arrayitemregen.add(item1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement