boogzey 1 Share Posted August 30, 2018 I want to just have my character stand in an area and send the player names to my server. I don't have an issue making the HTTP requests, but how can I use Player to return the players in my area? I checked out the docs and it seems like getPlayers().all(); is the way to go. Can anyone point me in the right direction for logging players around me to the console? Thanks. Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted August 30, 2018 List<Player> playerList = getPlayers().all(); playerList.forEach(p -> { log(p.getName()); }); You could do something like that. Link to comment Share on other sites More sharing options...
boogzey 1 Author Share Posted August 30, 2018 4 minutes ago, Milasoft said: List<Player> playerList = getPlayers().all(); playerList.forEach(p -> { log(p.getName()); }); You could do something like that. Thanks, this looks good. Unfortunately, I can't get it to work. Here's the issue: Error:(24, 9) java: cannot find symbol symbol: class List location: class main.Main Error:(24, 14) java: cannot find symbol symbol: class Player location: class main.Main I think the first issue has something to do with Java not recognizing the list type, but I have the following at the top of my file: import java.util.List; Any idea why that's happening? As for the second issue, I'm not sure why that's happening either. I am importing Players like so: import org.dreambot.api.methods.interactive.Players; Apologies if these are dumb questions. I come from a Python background. Thanks for the help! Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted August 30, 2018 import org.dreambot.api.wrappers.interactive.Player; Are you not using an IDE? Link to comment Share on other sites More sharing options...
boogzey 1 Author Share Posted August 30, 2018 6 minutes ago, Milasoft said: import org.dreambot.api.wrappers.interactive.Player; Are you not using an IDE? I'm using IntelliJ. Why? Edit: that import works perfectly. Can you tell me where in the docs that is? Also, what was the import I was using previously for? Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted August 30, 2018 Oh, because it usually shows you in red where it's messed up and you can pick the import from there. Link to comment Share on other sites More sharing options...
boogzey 1 Author Share Posted August 30, 2018 5 minutes ago, Milasoft said: Oh, because it usually shows you in red where it's messed up and you can pick the import from there. Haha damn. Like I said, pretty new to Java/this IDE. Thanks for the help man! Really appreciate it. Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted August 30, 2018 No problem. And to answer your question... Player represents a single player. The Players class is just methods to retrieve Player objects. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.