Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void spawnAnimatedItems(Location location, ArrayList<ItemStack> items) {
- Hologram hologram = HologramsAPI.createHologram(this.plugin, location);
- final int[] time = {2};
- new BukkitRunnable() {
- @Override
- public void run() {
- if (time[0] == 0) {
- hologram.clearLines();
- hologram.appendItemLine(getRandomItem(items));
- time[0] = 2;
- return;
- }
- time[0]--;
- }
- }.runTaskTimer(this.plugin, 0L, 40L);
- }
- private ItemStack getRandomItem(ArrayList<ItemStack> items) {
- if (items.isEmpty())
- return null;
- return items.get(new Random().nextInt(items.size()));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement