From 647f874cc032ea5a51ab187db7c0eb0228836b5d Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Thu, 13 Nov 2014 19:27:50 -0800 Subject: [PATCH] Workaround: Client-side fire bug. When creative mode player tries to put out a fire without permission, it APPEARS to succeed to that player, until he logs out and back in. This works around that by explicitly sending that player a block update for the fire block, which really hasn't changed. --- .../GriefPrevention/PlayerEventHandler.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index 75d7911..d7135fa 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -1099,20 +1099,25 @@ class PlayerEventHandler implements Listener if(!this.onLeftClickWatchList(clickedBlockType) && !GriefPrevention.instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null))) { //and an exception for putting our fires - if(GriefPrevention.instance.config_claims_protectFires && event.getClickedBlock() != null && event.getClickedBlock().getRelative(event.getBlockFace()).getType() == Material.FIRE) + if(GriefPrevention.instance.config_claims_protectFires && event.getClickedBlock() != null) { - if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId()); - Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim); - if(claim != null) + Block adjacentBlock = event.getClickedBlock().getRelative(event.getBlockFace()); + if(adjacentBlock.getType() == Material.FIRE) { - playerData.lastClaim = claim; - - String noBuildReason = claim.allowBuild(player, Material.AIR); - if(noBuildReason != null) + if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId()); + Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim); + if(claim != null) { - event.setCancelled(true); - GriefPrevention.sendMessage(player, TextMode.Err, noBuildReason); - return; + playerData.lastClaim = claim; + + String noBuildReason = claim.allowBuild(player, Material.AIR); + if(noBuildReason != null) + { + event.setCancelled(true); + GriefPrevention.sendMessage(player, TextMode.Err, noBuildReason); + player.sendBlockChange(adjacentBlock.getLocation(), adjacentBlock.getTypeId(), adjacentBlock.getData()); + return; + } } } }