Core/src/main/java/eu/univento/core/antihack/modules/AutoClicker.java

31 lines
941 B
Java

/*
* Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.core.antihack.modules;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.HashMap;
public class AutoClicker implements Listener {
public static final HashMap<CustomPlayer, Integer> clicks = new HashMap<>();
@EventHandler
public void onClick(PlayerInteractEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(e.getAction() == Action.LEFT_CLICK_AIR ||e.getAction() == Action.LEFT_CLICK_BLOCK) {
if(clicks.containsKey(p)) {
clicks.put(p, clicks.get(p) + 1);
}else{
clicks.put(p, 1);
}
}
}
}