31 lines
1016 B
Java
31 lines
1016 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.commons.player.warn.WarnReason;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.Listener;
|
|
import org.bukkit.event.block.BlockPlaceEvent;
|
|
|
|
import java.util.HashMap;
|
|
|
|
public class FastPlace implements Listener{
|
|
|
|
private final HashMap<CustomPlayer, Long> time = new HashMap<>();
|
|
|
|
@EventHandler
|
|
public void onPlace(BlockPlaceEvent e) {
|
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
|
if(time.containsKey(p)) {
|
|
if(System.currentTimeMillis() - time.get(p) <= 110L) {
|
|
//TODO: change to real reason
|
|
p.warn(WarnReason.ADVERTISEMENT, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
|
}
|
|
}
|
|
time.put(p, System.currentTimeMillis());
|
|
}
|
|
} |