Fix: Blocks can't be broken.

This commit is contained in:
snowleo 2011-06-30 22:50:22 +02:00
parent a720bf33ce
commit 995f18bb0f
2 changed files with 8 additions and 3 deletions

View File

@ -194,7 +194,7 @@ public class EssentialsSign
{ {
if (block.getFace(BlockFace.UP).getType() == Material.SIGN_POST) if (block.getFace(BlockFace.UP).getType() == Material.SIGN_POST)
{ {
return false; return true;
} }
final BlockFace[] directions = new BlockFace[] final BlockFace[] directions = new BlockFace[]
{ {
@ -211,12 +211,12 @@ public class EssentialsSign
final org.bukkit.material.Sign sign = (org.bukkit.material.Sign)signblock.getState().getData(); final org.bukkit.material.Sign sign = (org.bukkit.material.Sign)signblock.getState().getData();
if (sign.getFacing() == blockFace) if (sign.getFacing() == blockFace)
{ {
return false;
}
}
}
return true; return true;
} }
}
}
return false;
}
protected boolean onBlockPlace(final Block block, final User player, final String username, final IEssentials ess) throws SignException, ChargeException protected boolean onBlockPlace(final Block block, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
{ {

View File

@ -1,6 +1,8 @@
package com.earth2me.essentials.signs; package com.earth2me.essentials.signs;
import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.IEssentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
@ -17,6 +19,7 @@ import org.bukkit.event.block.SignChangeEvent;
public class SignBlockListener extends BlockListener public class SignBlockListener extends BlockListener
{ {
private final transient IEssentials ess; private final transient IEssentials ess;
private final static Logger LOGGER = Logger.getLogger("Minecraft");
public SignBlockListener(IEssentials ess) public SignBlockListener(IEssentials ess)
{ {
@ -58,6 +61,7 @@ public class SignBlockListener extends BlockListener
// prevent any signs be broken by destroying the block they are attached to // prevent any signs be broken by destroying the block they are attached to
if (EssentialsSign.checkIfBlockBreaksSigns(block)) if (EssentialsSign.checkIfBlockBreaksSigns(block))
{ {
LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign.");
return true; return true;
} }
for (Signs signs : Signs.values()) for (Signs signs : Signs.values())
@ -66,6 +70,7 @@ public class SignBlockListener extends BlockListener
if (sign.getBlocks().contains(block.getType()) if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockBreak(block, player, ess)) && !sign.onBlockBreak(block, player, ess))
{ {
LOGGER.log(Level.INFO, "A block was protected by a sign.");
return true; return true;
} }
} }