Reset another player at will
When you trade/duel request another player, that player is set as your recipient.
player.getTrade().setTradeRecipient(affectedPlayer);
If you then do any action to cancel the trade request (e.g. walk, trade someone else) this is called:
public void resetAll() {
Player tradeRecipient = getTradeRecipient();
if (tradeRecipient != null && !tradeRecipient.isFollowing()) {
setTradeRecipient(null);
tradeRecipient.resetAll(); // this should be tradeRecipient.getTrade().resetAll()
}
if (isTradeActive()) {
ActionSender.sendTradeWindowClose(player);
}
setTradeActive(false);
setTradeAccepted(false);
setTradeConfirmAccepted(false);
resetOffer();
}
Even with the above line changed, this still allows you to reset another player's trade or duel (explains the dueling bugs observed in the past).