Protected cake.

This commit is contained in:
ryanhamshire 2015-02-25 17:24:21 -08:00
parent 7816409ff6
commit 07ea755b4d

View File

@ -1337,6 +1337,7 @@ class PlayerEventHandler implements Listener
clickedBlockType == Material.CAULDRON ||
clickedBlockType == Material.JUKEBOX ||
clickedBlockType == Material.ANVIL ||
clickedBlockType == Material.CAKE_BLOCK ||
GriefPrevention.instance.config_mods_containerTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null)))))
{
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
@ -1440,6 +1441,25 @@ class PlayerEventHandler implements Listener
}
}
//otherwise apply rule for cake
else if(clickedBlock != null && GriefPrevention.instance.config_claims_preventTheft && clickedBlockType == Material.CAKE_BLOCK)
{
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
if(claim != null)
{
playerData.lastClaim = claim;
String noContainerReason = claim.allowAccess(player);
if(noContainerReason != null)
{
event.setCancelled(true);
GriefPrevention.sendMessage(player, TextMode.Err, noContainerReason);
return;
}
}
}
//apply rule for note blocks and repeaters and daylight sensors
else if(clickedBlock != null &&
(
@ -2299,6 +2319,7 @@ class PlayerEventHandler implements Listener
case LEVER:
case DIODE_BLOCK_ON: //redstone repeater
case DIODE_BLOCK_OFF:
case CAKE_BLOCK:
return true;
default:
return false;