Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore placements if they have a cooldown #1853

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ private static void handleBlockPlaceOrUseItem(PacketWrapper<?> packet, GrimPlaye

// The offhand is unable to interact with blocks like this... try to stop some desync points before they happen
if ((!player.isSneaking || onlyAir) && place.getHand() == InteractionHand.MAIN_HAND) {

if (player.checkManager.getCompensatedCooldown().hasMaterial(placedWith.getType())) {
return;
}

Vector3i blockPosition = place.getBlockPosition();
BlockPlace blockPlace = new BlockPlace(player, place.getHand(), blockPosition, place.getFaceId(), place.getFace(), placedWith, getNearestHitResult(player, null, true));

Expand Down Expand Up @@ -503,6 +508,10 @@ public void onPacketReceive(PacketReceiveEvent event) {
placedWith = player.getInventory().getOffHand();
}

if (player.checkManager.getCompensatedCooldown().hasMaterial(placedWith.getType())) {
return;
}

// This is the use item packet
if (packet.getFace() == BlockFace.OTHER && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9)) {
player.placeUseItemPackets.add(new BlockPlaceSnapshot(packet, player.isSneaking));
Expand Down