1616import org .bukkit .Bukkit ;
1717import org .bukkit .ChatColor ;
1818import org .bukkit .command .CommandSender ;
19- import org .bukkit .entity .EntityType ;
2019import org .bukkit .entity .Player ;
2120import org .bukkit .plugin .java .JavaPlugin ;
2221
@@ -49,9 +48,9 @@ public class EntityDetection extends JavaPlugin {
4948
5049 private EntitySearch currentSearch ;
5150
52- private Map <SearchType , SearchResult > results = new HashMap <SearchType , SearchResult >();
53- private Map <String , SearchResult > customResults = new HashMap <String , SearchResult >();
54- private Map <String , SearchResult > lastResultViewed = new HashMap <String , SearchResult >();
51+ private Map <SearchType , SearchResult <?>> results = new HashMap <>();
52+ private Map <String , SearchResult <?>> customResults = new HashMap <>();
53+ private Map <String , SearchResult <?>> lastResultViewed = new HashMap <>();
5554
5655 private boolean serverIsSpigot = true ;
5756
@@ -84,7 +83,7 @@ public boolean stopSearch(String stopper) {
8483 return true ;
8584 }
8685
87- public void addResult (SearchResult result ) {
86+ public void addResult (SearchResult <?> result ) {
8887 if (result .getType () == SearchType .CUSTOM && result .getSearched ().size () == 1 ) {
8988 Set <String > searchedEntities = result .getSearched ();
9089 customResults .put (searchedEntities .toArray (new String [searchedEntities .size ()])[0 ], result );
@@ -97,12 +96,12 @@ public EntitySearch getCurrentSearch() {
9796 return currentSearch ;
9897 }
9998
100- public void send (CommandSender sender , SearchResult result ) {
99+ public void send (CommandSender sender , SearchResult <?> result ) {
101100 send (sender , result , 0 );
102101 }
103102
104103
105- public void send (CommandSender sender , SearchResult result , int page ) {
104+ public void send (CommandSender sender , SearchResult <?> result , int page ) {
106105 lastResultViewed .put (sender .getName (), result );
107106
108107 String dateStr = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" ).format (new Date (result .getEndTime ()));
@@ -124,10 +123,10 @@ public void send(CommandSender sender, SearchResult result, int page) {
124123 .append ("from " + dateStr + ":" )
125124 .color (net .md_5 .bungee .api .ChatColor .WHITE );
126125
127- List <SearchResultEntry > results = result .getSortedEntries ();
126+ List <? extends SearchResultEntry <?> > results = result .getSortedEntries ();
128127 if (results .size () > 0 ) {
129128 for (int line = start ; line < start + 10 && line < results .size (); line ++) {
130- SearchResultEntry entry = results .get (line );
129+ SearchResultEntry <?> entry = results .get (line );
131130
132131 builder .append ("\n " )
133132 .retain (ComponentBuilder .FormatRetention .NONE )
@@ -142,7 +141,7 @@ public void send(CommandSender sender, SearchResult result, int page) {
142141 )
143142 )
144143 .event (new ClickEvent (ClickEvent .Action .RUN_COMMAND , "/detect tp " + (line + 1 )))
145- .append (entry .getChunk () + " " )
144+ .append (entry .getLocation () + " " )
146145 .color (net .md_5 .bungee .api .ChatColor .YELLOW )
147146 .append (entry .getSize () + " " )
148147 .color (net .md_5 .bungee .api .ChatColor .RED );
@@ -171,12 +170,12 @@ public void send(CommandSender sender, SearchResult result, int page) {
171170 List <String > msg = new ArrayList <String >();
172171 msg .add (ChatColor .GREEN + Utils .enumToHumanName (result .getType ()) + " search " + ChatColor .WHITE + "from " + dateStr + ":" );
173172
174- List <SearchResultEntry > chunkEntries = result .getSortedEntries ();
173+ List <? extends SearchResultEntry <?> > chunkEntries = result .getSortedEntries ();
175174 if (chunkEntries .size () > 0 ) {
176175 for (int line = start ; line < start + 10 && line < chunkEntries .size (); line ++) {
177- SearchResultEntry chunkEntry = chunkEntries .get (line );
176+ SearchResultEntry <?> chunkEntry = chunkEntries .get (line );
178177
179- String lineText = ChatColor .WHITE + " " + (line + 1 ) + ": " + ChatColor .YELLOW + chunkEntry .getChunk () + " " + ChatColor .RED + chunkEntry .getSize () + " " ;
178+ String lineText = ChatColor .WHITE + " " + (line + 1 ) + ": " + ChatColor .YELLOW + chunkEntry .getLocation () + " " + ChatColor .RED + chunkEntry .getSize () + " " ;
180179
181180 int entitiesListed = 0 ;
182181 for (Entry <String , Integer > entityEntry : chunkEntry .getEntryCount ()) {
@@ -195,15 +194,15 @@ public void send(CommandSender sender, SearchResult result, int page) {
195194 }
196195 }
197196
198- public SearchResult getResult (CommandSender sender ) {
197+ public SearchResult <?> getResult (CommandSender sender ) {
199198 return lastResultViewed .get (sender .getName ());
200199 }
201200
202- public SearchResult getResult (String type ) {
201+ public SearchResult <?> getResult (String type ) {
203202 return customResults .get (type );
204203 }
205204
206- public SearchResult getResult (SearchType type ) {
205+ public SearchResult <?> getResult (SearchType type ) {
207206 return results .get (type );
208207 }
209208}
0 commit comments