Ejemplo n.º 1
0
 /** Setup it so he can see himself when disguised */
 public static void setupFakeDisguise(final Disguise disguise) {
   Entity e = disguise.getEntity();
   // If the disguises entity is null, or the disguised entity isn't a player return
   if (e == null
       || !(e instanceof Player)
       || !getDisguises().containsKey(e.getUniqueId())
       || !getDisguises().get(e.getUniqueId()).contains(disguise)) {
     return;
   }
   Player player = (Player) e;
   // Check if he can even see this..
   if (!((TargetedDisguise) disguise).canSee(player)) {
     return;
   }
   // Remove the old disguise, else we have weird disguises around the place
   DisguiseUtilities.removeSelfDisguise(player);
   // If the disguised player can't see himself. Return
   if (!disguise.isSelfDisguiseVisible()
       || !PacketsManager.isViewDisguisesListenerEnabled()
       || player.getVehicle() != null) {
     return;
   }
   selfDisguised.add(player.getUniqueId());
   sendSelfDisguise(player, (TargetedDisguise) disguise);
   if (disguise.isHidingArmorFromSelf() || disguise.isHidingHeldItemFromSelf()) {
     if (PacketsManager.isInventoryListenerEnabled()) {
       player.updateInventory();
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Get all EntityPlayers who have this entity in their Entity Tracker And they are in the
  * targetted disguise.
  */
 public static ArrayList<Player> getPerverts(Disguise disguise) {
   ArrayList<Player> players = new ArrayList<Player>();
   try {
     Object entityTrackerEntry = ReflectionManager.getEntityTrackerEntry(disguise.getEntity());
     if (entityTrackerEntry != null) {
       HashSet trackedPlayers =
           (HashSet)
               ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers")
                   .get(entityTrackerEntry);
       for (Object p : trackedPlayers) {
         Player player = (Player) ReflectionManager.getBukkitEntity(p);
         if (((TargetedDisguise) disguise).canSee(player)) {
           players.add(player);
         }
       }
     }
   } catch (Exception ex) {
     ex.printStackTrace();
   }
   return players;
 }
Ejemplo n.º 3
0
 public static boolean isDisguiseInUse(Disguise disguise) {
   return disguise.getEntity() != null
       && getDisguises().containsKey(disguise.getEntity().getUniqueId())
       && getDisguises().get(disguise.getEntity().getUniqueId()).contains(disguise);
 }