Jump to content

List allPlayers = getPlayers().getAll(); - How to get display names?


semanji

Recommended Posts

Hi brothers, how do you get the display name of other characters?

 

Im get only

org.osbot.rs07.api.model.Player@1f2b425

And it dont match with my admin string

			if (getInventory().contains(7936) && getInventory().getAmount(7936) > 4) {
				// trade for ess	
				java.util.List<Player> allPlayers = getPlayers().getAll();
				if (!hosts.contains(admin)) {
					hosts.add(admin);
				}
				if (allPlayers != null) {
					for (int i = 0; i < allPlayers.size(); i++) {
						log(allPlayers.get(i));
						log(hosts);
						if (hosts.contains(allPlayers.get(i))) {
							playerMatch = allPlayers.get(i);
							//playerMatch.interact("Follow");
							break;
						}
						
					}
					new ConditionalSleep(2000) {
						@Override
						public boolean condition() throws InterruptedException {
							return trade.isFirstInterfaceOpen();
						}
					}.sleep();
					if (trade.isCurrentlyTrading()) {
						if (trade.isFirstInterfaceOpen()) {
							trade.offerAll(7936);
						}
						if (trade.getTheirOffers().onlyContains(7937, 995) && trade.didOtherAcceptTrade()) {
							trade.acceptTrade();
						}
						if (trade.isSecondInterfaceOpen() && trade.getTheirOffers().onlyContains(7937, 995)
								&& trade.didOtherAcceptTrade()) {
							trade.acceptTrade();
						}
					}
				}
			}
Edited by semanji
Link to comment
Share on other sites

 

Hi brothers, how do you get the display name of other characters?

 

Im get only

org.osbot.rs07.api.model.Player@1f2b425

And it dont match with my admin string

			
if (hosts.contains(allPlayers.get(i))) 
										

 

use getName(), but you will also need to account for non breaking spaces in their name so use:

if (hosts.contains(allPlayers.get(i).getName().replace('\u00A0', ' ')))
Edited by Explv
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...