SHARE
TWEET

Untitled

a guest Aug 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top