Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package minecore.captcha;
- import minecore.MineCore;
- import net.minecraft.server.v1_16_R3.*;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
- import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- import java.util.ArrayList;
- import java.util.List;
- 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) {
- armor.setInvisible(false);
- armor.setNoGravity(false);
- armor.setSmall(true);
- armor.setCustomNameVisible(true);
- PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- Bukkit.broadcastMessage(" A " + armor.getCustomNameVisible());
- }
- }
- 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