diff --git a/README.md b/README.md
index 1e0b6a6..ce8d504 100644
--- a/README.md
+++ b/README.md
@@ -401,6 +401,7 @@ portalInfoServer=Server: %server%
- Adds a config option to set the exit velocity of any players exiting a stargate
- Adjusts vehicle teleportation a bit to prevent passengers' exit rotation from being wrong
+- Improves the checking for buggy double-clicks on non-button blocks
#### \[Version 0.9.3.1] EpicKnarvik97 fork
diff --git a/src/main/java/net/knarcraft/stargate/listener/PlayerEventListener.java b/src/main/java/net/knarcraft/stargate/listener/PlayerEventListener.java
index b182690..8261673 100644
--- a/src/main/java/net/knarcraft/stargate/listener/PlayerEventListener.java
+++ b/src/main/java/net/knarcraft/stargate/listener/PlayerEventListener.java
@@ -34,14 +34,16 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* This listener listens to any player-related events related to stargates
*/
@SuppressWarnings("unused")
public class PlayerEventListener implements Listener {
- private static long eventTime;
- private static PlayerInteractEvent previousEvent;
+ private static final Map
The event causing the right click
- * @param blockThe block to check
+ * @param playerThe player performing the right-click
+ * @param blockThe block to check
* @returnTrue if the click is a bug and should be cancelled
*/ - private boolean clickIsBug(PlayerInteractEvent event, Block block) { - if (previousEvent != null && - event.getPlayer() == previousEvent.getPlayer() && eventTime + 15 > System.currentTimeMillis()) { - previousEvent = null; - eventTime = 0; + private boolean clickIsBug(Player player, Block block) { + Long previousEventTime = previousEventTimes.get(player); + if (previousEventTime != null && previousEventTime + 50 > System.currentTimeMillis()) { + previousEventTimes.put(player, null); return true; } - previousEvent = event; - eventTime = System.currentTimeMillis(); + previousEventTimes.put(player, System.currentTimeMillis()); return false; }