public ArrayList<String> toTradeArray = new ArrayList<String>();
public String lastTraded = null;
public String needsTraded = null;
public String[] toTrade = new String[toTradeArray.size()];
public void checkTrades() {
if(s.getTrade().getLastRequestingPlayer() != null) {
lastTraded = s.getTrade().getLastRequestingPlayer().getName();
}
toTrade = toTradeArray.toArray(toTrade);
for (String i : toTrade) {
if(lastTraded != null) {
s.log("Last Traded: "+lastTraded.toLowerCase());
s.log("We need: "+i.toLowerCase());
if(i.toLowerCase().equals(lastTraded.toLowerCase())) {
s.log("Correct Player Traded");
needsTraded = i.toLowerCase();
}
}
}
}
As you can see, my problem is I have two strings that I am comparing, if I try it without spaces it works, but when I try it with spaces, it does not. Why is this?
The stacktraces print & as you can see, they're identical, where in my code did I go wrong?
[INFO][Bot #1][10/27 07:58:15 PM]: We need: test 123
[INFO][Bot #1][10/27 07:58:15 PM]: Last Traded: test 123