Tryskell

Knownlist

Feb 7th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.98 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/model/actor/knownlist/NpcKnownList.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/model/actor/knownlist/NpcKnownList.java  (revision 288)
  6. +++ java/net/sf/l2j/gameserver/model/actor/knownlist/NpcKnownList.java  (working copy)
  7. @@ -14,6 +14,10 @@
  8.   */
  9.  package net.sf.l2j.gameserver.model.actor.knownlist;
  10.  
  11. +import java.util.ArrayList;
  12. +import java.util.Collection;
  13. +import java.util.List;
  14. +
  15.  import net.sf.l2j.gameserver.model.L2Object;
  16.  import net.sf.l2j.gameserver.model.actor.L2Character;
  17.  import net.sf.l2j.gameserver.model.actor.L2Npc;
  18. @@ -21,6 +25,8 @@
  19.  import net.sf.l2j.gameserver.model.actor.instance.L2CabaleBufferInstance;
  20.  import net.sf.l2j.gameserver.model.actor.instance.L2FestivalGuideInstance;
  21.  import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
  22. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  23. +import net.sf.l2j.gameserver.util.Util;
  24.  
  25.  public class NpcKnownList extends CharKnownList
  26.  {
  27. @@ -58,4 +64,42 @@
  28.        
  29.         return 500;
  30.     }
  31. +  
  32. +   @Override
  33. +   @SuppressWarnings("unchecked")
  34. +   public <A> Collection<A> getKnownType(Class<A> type)
  35. +   {
  36. +       List<A> result = new ArrayList<>();
  37. +      
  38. +       for (L2Object obj : _knownObjects.values())
  39. +       {
  40. +           if (type.isAssignableFrom(obj.getClass()))
  41. +           {
  42. +               if (obj instanceof L2PcInstance && ((L2PcInstance) obj).isGM() && ((L2PcInstance) obj).getAppearance().getInvisible())
  43. +                   continue;
  44. +              
  45. +               result.add((A) obj);
  46. +           }
  47. +       }
  48. +       return result;
  49. +   }
  50. +  
  51. +   @Override
  52. +   @SuppressWarnings("unchecked")
  53. +   public <A> Collection<A> getKnownTypeInRadius(Class<A> type, int radius)
  54. +   {
  55. +       List<A> result = new ArrayList<>();
  56. +      
  57. +       for (L2Object obj : _knownObjects.values())
  58. +       {
  59. +           if (type.isAssignableFrom(obj.getClass()) && Util.checkIfInRange(radius, getActiveObject(), obj, true))
  60. +           {
  61. +               if (obj instanceof L2PcInstance && ((L2PcInstance) obj).isGM() && ((L2PcInstance) obj).getAppearance().getInvisible())
  62. +                   continue;
  63. +              
  64. +               result.add((A) obj);
  65. +           }
  66. +       }
  67. +       return result;
  68. +   }
  69.  }
  70. \ No newline at end of file
  71. Index: java/net/sf/l2j/gameserver/model/actor/knownlist/ObjectKnownList.java
  72. ===================================================================
  73. --- java/net/sf/l2j/gameserver/model/actor/knownlist/ObjectKnownList.java   (revision 288)
  74. +++ java/net/sf/l2j/gameserver/model/actor/knownlist/ObjectKnownList.java   (working copy)
  75. @@ -132,7 +132,7 @@
  76.     }
  77.    
  78.     @SuppressWarnings("unchecked")
  79. -   public final <A> Collection<A> getKnownType(Class<A> type)
  80. +   public <A> Collection<A> getKnownType(Class<A> type)
  81.     {
  82.         List<A> result = new ArrayList<>();
  83.        
  84. @@ -145,7 +145,7 @@
  85.     }
  86.    
  87.     @SuppressWarnings("unchecked")
  88. -   public final <A> Collection<A> getKnownTypeInRadius(Class<A> type, int radius)
  89. +   public <A> Collection<A> getKnownTypeInRadius(Class<A> type, int radius)
  90.     {
  91.         List<A> result = new ArrayList<>();
Advertisement
Add Comment
Please, Sign In to add comment