geforkt von SteamWar/BungeeCore
Prevent ProcessingSpam
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
4f6bf71f82
Commit
1bc5011d4f
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class SWInventory {
|
||||
|
||||
@ -39,6 +40,8 @@ public class SWInventory {
|
||||
private String title;
|
||||
private boolean next;
|
||||
|
||||
private final AtomicBoolean processingClick = new AtomicBoolean();
|
||||
|
||||
public SWInventory(ProxiedPlayer proxiedPlayer, int size, String title) {
|
||||
itemMap = new HashMap<>();
|
||||
InventoryCallbackHandler.inventoryHashMap.put(SteamwarUser.get(proxiedPlayer).getId(), this);
|
||||
@ -101,13 +104,19 @@ public class SWInventory {
|
||||
}
|
||||
|
||||
public void handleCallback(InvCallback.ClickType type, int pos) {
|
||||
if(processingClick.compareAndSet(false, true)) {
|
||||
itemMap.get(pos).getCallback().clicked(type);
|
||||
processingClick.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleClose() {
|
||||
if(processingClick.compareAndSet(false, true)) {
|
||||
InventoryCallbackHandler.inventoryHashMap.remove(SteamwarUser.get(player).getId(), this);
|
||||
if(close != null)
|
||||
close.clicked(null);
|
||||
processingClick.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void open() {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren