Advertisement
testkarna

Untitled

Jan 20th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. public class Tag extends BukkitRunnable implements Listener {
  2.  
  3. private static Tag INSTANCE = null;
  4. private static HashSet<UUID> PLAYERSROUGE = new HashSet<UUID>();
  5. private static UUID INFILTRED_INDIAN = null;
  6. private static HashSet<EntityArmorStand> STANDS = new HashSet<EntityArmorStand>();
  7.  
  8. private Tag() {
  9. this.runTaskTimer(UHC.getInstance(), 1, 1);
  10. Bukkit.getPluginManager().registerEvents(this, UHC.getInstance());
  11. }
  12.  
  13. public static void initialize() {
  14. if(INSTANCE == null) {
  15. INSTANCE = new Tag();
  16. }
  17. }
  18.  
  19. @Override
  20. public void run() {
  21. for(EntityArmorStand stand : STANDS) {
  22. PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]{stand.getId()});
  23. for(Player player : Bukkit.getOnlinePlayers()) {
  24. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
  25. }
  26. }
  27. STANDS = new HashSet<EntityArmorStand>();
  28. for(UUID looker : PLAYERSROUGE) {
  29. Player player = Bukkit.getPlayer(looker);
  30. if(player == null || !player.isOnline() || player.getGameMode().equals(GameMode.SPECTATOR)) continue;
  31. EntityArmorStand stand = getArmorStand(player);
  32. PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(stand);
  33. Vector vel = player.getVelocity();
  34. PacketPlayOutEntityVelocity packet2 = new PacketPlayOutEntityVelocity(stand.getId(), vel.getX(), vel.getY(), vel.getZ());
  35. STANDS.add(stand);
  36. for(UUID looked : PLAYERSROUGE) {
  37. if(looked == looker) continue;
  38. Player player2 = Bukkit.getPlayer(looked);
  39. if(player2 == null || !player2.isOnline()) continue;
  40. ((CraftPlayer) player2).getHandle().playerConnection.sendPacket(packet);
  41. ((CraftPlayer) player2).getHandle().playerConnection.sendPacket(packet2);
  42. }
  43. }
  44. Player player = Bukkit.getPlayer(INFILTRED_INDIAN);
  45. if(player == null || !player.isOnline()) return;
  46. EntityArmorStand stand = getArmorStand(player);
  47. PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(stand);
  48. Vector vel = player.getVelocity();
  49. PacketPlayOutEntityVelocity packet2 = new PacketPlayOutEntityVelocity(stand.getId(), vel.getX(), vel.getY(), vel.getZ());
  50. STANDS.add(stand);
  51. for(UUID looked : PLAYERSROUGE) {
  52. Player player2 = Bukkit.getPlayer(looked);
  53. if(player2 == null || !player2.isOnline()) continue;
  54. ((CraftPlayer) player2).getHandle().playerConnection.sendPacket(packet);
  55. ((CraftPlayer) player2).getHandle().playerConnection.sendPacket(packet2);
  56. }
  57. }
  58.  
  59. public static EntityArmorStand getArmorStand(Player player){
  60. Location loc = player.getLocation();
  61. EntityArmorStand stand = new EntityArmorStand(((CraftWorld) loc.getWorld()).getHandle(), loc.getX(), loc.getY() + 1, loc.getZ());
  62. stand.setCustomName("§cRouge");
  63. stand.setCustomNameVisible(true);
  64. stand.setInvisible(true);
  65. stand.setGravity(false);
  66. stand.setSmall(true);
  67. return stand;
  68. }
  69.  
  70. public static void addCowBoy(Player player) {
  71. //PLAYERSROUGE.add(player.getUniqueId());
  72. }
  73.  
  74. public static void setInfiltredIndian(Player player) {
  75. INFILTRED_INDIAN = player.getUniqueId();
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement