package xyz.benw.plugins.fouriermc;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;

import java.util.*;

/**
 * ClickListener
 *
 * General event listener for plugin
 *
 */
public class ClickListener implements Listener {

    private FourierMC plugin;

    public ClickListener(FourierMC plugin) {
        this.plugin = plugin;
    }


    /* Logs clicking events */
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {

        UUID playerID = event.getPlayer().getUniqueId();

        if(plugin.clickLogger.containsKey(playerID)) {
            plugin.clickLogger.get(playerID).increment();
        }


    }


    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {

        UUID playerID = event.getPlayer().getUniqueId();

        if(plugin.clickLogger.containsKey(playerID)) {
            plugin.clickLogger.remove(playerID);
        }
    }




}

@@ -559,33 +559,32 @@
 tEvent event) %7B%0A
-%0A
         UUID pla
@@ -749,25 +749,23 @@
      %7D%0A%0A
-%0A
     %7D%0A%0A
-%0A
     @Eve
@@ -828,17 +828,16 @@
 vent) %7B%0A
-%0A
         
@@ -999,21 +999,140 @@
        %7D
+%0A%0A        if(plugin.violationLogger.containsKey(playerID)) %7B%0A            plugin.clickLogger.remove(playerID);%0A        %7D
 %0A    %7D%0A%0A
 %0A%0A%0A%7D%0A
@@ -1126,13 +1126,10 @@
 %0A    %7D%0A%0A
-%0A%0A%0A
 %7D%0A

Handle players leaving