Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. public void spawnAnimatedItems(Location location, ArrayList<ItemStack> items) {
  2. Hologram hologram = HologramsAPI.createHologram(this.plugin, location);
  3.  
  4. final int[] time = {2};
  5.  
  6. new BukkitRunnable() {
  7. @Override
  8. public void run() {
  9. if (time[0] == 0) {
  10. hologram.clearLines();
  11. hologram.appendItemLine(getRandomItem(items));
  12. time[0] = 2;
  13. return;
  14. }
  15. time[0]--;
  16. }
  17. }.runTaskTimer(this.plugin, 0L, 40L);
  18. }
  19.  
  20. private ItemStack getRandomItem(ArrayList<ItemStack> items) {
  21. if (items.isEmpty())
  22. return null;
  23.  
  24. return items.get(new Random().nextInt(items.size()));
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement