Could anyone please explain to me why the following code is so incredibly un-predictable?
if (m.getTrade().isCurrentlyTrading()) {
m.log("Currently in trade with: " + m.getTrade().getOtherPlayer());
if (m.getTrade().getTheirOffers() != null && !m.getTrade().getTheirOffers().isEmpty()) {
m.getTrade().acceptTrade();
return Utils.randNum(1000, 2000);
}
if (m.getTrade().isSecondInterfaceOpen()) {
m.getTrade().acceptTrade();
return Utils.randNum(1000, 2000);
}
return Utils.randNum(250, 500);
}
if (!m.getTrade().isCurrentlyTrading()) {
if (m.getTrade().getLastRequestingPlayer() != null && m.getTrade().getLastRequestingPlayer().exists()) {
m.log("Interacting with: " + m.getTrade().getLastRequestingPlayer().getName());
if (m.getTrade().getLastRequestingPlayer().interact("Trade with")) {
Sleep.sleepUntil(() -> m.getTrade().isCurrentlyTrading(), 5000, 500);
return Utils.randNum(1000, 2000);
}
} else {
delay = Utils.randNum(1000, 2000);
m.log("Not currently in trade, checking again in: " + delay + "ms");
return delay;
}
}
The m in this case is the MethodProvider.
All i'm trying to do is run an account that sits there & just accepts trade requests, however it is incredibly un-reliable & un-predictable. Sometimes it works & accepts the trade, other times it will just close the trade interface or will spam trade the requesting player.
As a side note, is there any difference in using trade or getTrade() ?
Thanks!