Skip to content

Instantly share code, notes, and snippets.

/Item Lore Animation Secret

Created Jun 3, 2014
Embed
What would you like to do?
Item Lore Animation
package com.gap;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
public class Wool extends JavaPlugin implements Listener {
List<Inventory> invlist = new ArrayList<Inventory>();
int framecounter = 0;
ArrayList<String> frame = new ArrayList<String>();
ArrayList<ArrayList<String>> animation = new ArrayList<ArrayList<String>>();
@Override
public void onDisable() {
}
@Override
public void onEnable() {
for (World w : getServer().getWorlds()) {
for (Player p : w.getPlayers()) {
invlist.add(p.getInventory());
}
}
// add frame #1
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
animation.add(new ArrayList<String>(frame));
frame.clear();
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§1█§1█§1█§1█");
this.frame.add("§r§l§f█§f█§f█§f█§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§e█§e█§e█§e█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§b█§b█§b█§b█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
this.frame.add("§r§l§2█§2█§2█§2█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§f█§4█§4█§4█§4█");
animation.add(new ArrayList<String>(frame));
frame.clear();
BukkitScheduler scheduler = getServer().getScheduler();
scheduler.runTaskTimer(this, new Runnable() {
@Override
public void run() {
for (Inventory inv : invlist) {
for (ItemStack item : inv.getContents()) {
if (item != null) {
if (item.getType() == Material.GOLDEN_APPLE) {
ItemMeta meta = item.getItemMeta();
meta.setLore(animation.get(framecounter++));
item.setItemMeta(meta);
if (framecounter > 1) {
framecounter = 0;
}
}
}
}
}
}
}, 1, 1);
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler (priority = EventPriority.NORMAL)
public void onJoin(PlayerJoinEvent e) {
invlist.add(e.getPlayer().getInventory());
}
@EventHandler (priority = EventPriority.NORMAL)
public void onQuit(PlayerQuitEvent e) {
invlist.remove(e.getPlayer().getInventory());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.