Originally Posted by
Empathy
Well it all depends on how Items are handled in general as well as your checks. The source I work with checks this by having the remove method as a boolean. E.g.
if (player.getInventory().remove(item)) {
//do stuff
}
If your code doesnt have a check like that you need to add one yourself or see how other interfaces, such as banking, handles checks.
Originally Posted by
.Mayhem.
Before it adds the item to the players inventory, put in a check to see if the item is actually still in the container.
Thank you both for your feedback. I ended up using an EventManager delay system like this:
Code:
EventManager.getSingleton().addEvent(new Event() {
Client self = editor;
public void execute(EventContainer c) {
editor.clickCount = 0;
editor.clickedBob = false;
c.stop();
}
}, 500);
With a conditional at the top of the add/remove item from BoB function like this:
Code:
if(editor.clickedBob == true && editor.clickCount == 1) return;
With the idea that the clickCount will be set to 0 after 500 milliseconds, and any clicks made to the item in the container will not be registered until that 500 millisecond time period goes by, essentially guaranteeing it has been removed from the container.
Do you think this is an okay solution?
Below is the working version: