Help with working on an AntiCheat

Status
This thread has been locked.

King Archie

Java Software Development
Banned
Feedback score
6
Posts
168
Reactions
45
Resources
0
I just started a small scale anti cheat that has some nifty checks, but I'm confused as to why this isn't working / is really inaccurate:

Code:
    @EventHandler
    public void onClick(PlayerInteractEvent e) {
        Long current = System.currentTimeMillis();
        if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) {
            Player player = e.getPlayer();
            if (!lastClick.containsKey(player.getUniqueId())) {
                lastClick.put(player.getUniqueId(), current);
                return;
            }

            Long timeBetween = current - lastClick.get(player.getUniqueId());
            System.out.println(timeBetween);
            lastClick.remove(player.getUniqueId());
            lastClick.put(player.getUniqueId(), current);
        }
    }

That should get the MS between every click - but for some reason it is really inaccurate e.g 0ms gap between clicks.
 
Last edited:
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

King Archie

Java Software Development
Banned
Feedback score
6
Posts
168
Reactions
45
Resources
0
If this is a problem I'm not too sure if you can create a anti-cheat, just fyi...
Huh? It's inaccurate as fuck and I'm looking for a better way. I'm using PlayerSwingEvent now.[DOUBLEPOST=1492462835][/DOUBLEPOST]
If this is a problem I'm not too sure if you can create a anti-cheat, just fyi...
I don't understand how to make it more accurate? I want to get the ms between clicks.
 
Last edited:
Banned forever. Reason: Ban Evading (Archie, https://builtbybit.com/members/archie.15314/)
Status
This thread has been locked.
Top