Well, right now i ended up using messagelistener and hashmap, made it so that it'll clean the list every 1 second, it'll be enough to execute interaction event.
Not sure if the smartest way but meh, works.
Well, sometimes after trade, getLastRequestingPlayer() returns == null like it is supposed to ? But most of the times it'll return != null for like 10 seconds ?
what i am saying is that getTrade().getLastRequestingPlayer() returns != null for a while even though the character haven't received any more trades after the trade.
Ok so i can't really figure out a better logic for this but what i am trying to do here is when a player trades me, it'll accept.
What this code does is once it has finished trading it'll keep trading the same character for a while until requestListener == null
my code;
if (getTrade().isCurrentlyTrading()) {
if (getTrade().isFirstInterfaceOpen()) {
if (getTrade().acceptTrade()) {
new ConditionalSleep(1000) {
@Override
public boolean condition() throws InterruptedException {
return getTrade().isSecondInterfaceOpen();
}
}.sleep();
}
} else {
if (getTrade().isSecondInterfaceOpen()) {
if (getTrade().acceptTrade()) {
new ConditionalSleep(1000) {
@Override
public boolean condition() throws InterruptedException {
return !getTrade().isCurrentlyTrading();
}
}.sleep();
}
}
}
} else {
if (getTrade().getLastRequestingPlayer() != null) {
if (getTrade().getLastRequestingPlayer().getName().equals("")) {
if (getTrade().getLastRequestingPlayer().interact("Trade with")) {
new ConditionalSleep(1000) {
@Override
public boolean condition() throws InterruptedException {
return getTrade().isCurrentlyTrading();
}
}.sleep();
}
}
}
}
How am i supposed to make it so that once it has finished trading it won't trade the same character again ?
EDIT:/ First trade finished it won't interact with the character .. but once i go into second trade, finish it then it'll keep trading the character for a while until getLastRequestingPlayer() == null
Any human being does have free will, we can't just tell them to stop smoking, but what we can do is tell them what smoking does to their body.
It is their decision if they want to keep smoking or quit.
Alright, thanks for the help guys.
EDIT:/
I just figured out that for some reason when i do this;
for (RS2Object object : getObjects().getAll()) {
if (object.getName().equals("Large door")) {
modifiedFlags[object.getLocalX()][object.getLocalY()] = 0;
}
}
It'll work for doors, gates but for some reason it doesn't work with large doors, any ideas ?
Seems like your eclipse doesn't use java 8.
Uninstall your eclipse, download it from here; https://www.eclipse.org/downloads/download.php?file=/oomph/epp/neon/R2a/eclipse-inst-win64.exe