Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Hologram {
- private static MineCore plugin = JavaPlugin.getPlugin(MineCore.class);
- private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
- private String[] Text;
- private Location location;
- private double DISTANCE = 0.25D;
- int count;
- public Hologram(String[] Text, Location location) {
- this.Text = Text;
- this.location = location;
- create();
- }
- public void hidePlayer(Player player) {
- for (EntityArmorStand armor : entitylist) {
- PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- }
- }
- public void showPlayer(Player player) {
- for (EntityArmorStand armor : entitylist) {
- PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- }
- }
- public void showPlayerTemp(final Player player, int time) {
- showPlayer(player);
- Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
- @Override
- public void run() {
- hidePlayer(player);
- }
- }, time);
- }
- private void create() {
- for (String Text : this.Text) {
- EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(),this.location.getX(), this.location.getY(),this.location.getZ());
- entity.setCustomName(new ChatComponentText(Text));
- entity.setCustomNameVisible(true);
- entity.setInvisible(true);
- entity.setNoGravity(true);
- entitylist.add(entity);
- this.location.subtract(0, this.DISTANCE, 0);
- count++;
- }
- this.count = 0;
- }
- }
Add Comment
Please, Sign In to add comment