Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ClientBlockPlacePacket extends PacketAdapter {
- private final ExploitFixerPlugin plugin;
- private final Map<Player,Long> limit = new ConcurrentHashMap<>();
- public ClientBlockPlacePacket(ExploitFixerPlugin plugin) {
- super(plugin, ListenerPriority.NORMAL, PacketType.Play.Client.BLOCK_PLACE);
- this.plugin = plugin;
- }
- @Override
- public void onPacketReceiving(PacketEvent e) {
- final Player player = e.getPlayer();
- final Long lastSentPacket = limit.get(player);
- if (lastSentPacket==null) {
- limit.put(player, System.currentTimeMillis());
- return;
- }
- if ( (System.currentTimeMillis()-lastSentPacket) > spierdalaj ){
- e.setCancelled(true);
- limit.remove(player);
- plugin.getLogger().info(player.getName()+" spierdlajvocan");
- plugin.kickPlayer(player);
- return;
- }
- final WrapperPlayClientBlockPlace packet = new WrapperPlayClientBlockPlace(e.getPacket());
- final ItemStack item = packet.getHeldItem();
- if (item == null || item.getType() == Material.AIR) return;
- plugin.checkNBTTags(item,player,e);
- }
- public Map<Player, Long> getLimit() {
- return limit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement