Switch sign listeners back to compare block id, rather than materials.

This commit is contained in:
KHobbits 2012-04-02 22:58:07 +01:00
parent bf1e073ef4
commit 37370f722c
4 changed files with 22 additions and 19 deletions

View file

@ -323,7 +323,7 @@ public class EssentialsPlayerListener implements Listener
{
return;
}
if (event.getClickedBlock().getType() == Material.BED_BLOCK && ess.getSettings().getUpdateBedAtDaytime())
if (event.getClickedBlock().getTypeId() == Material.BED_BLOCK.getId() && ess.getSettings().getUpdateBedAtDaytime())
{
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
}

View file

@ -19,6 +19,8 @@ public class SignBlockListener implements Listener
{
private final transient IEssentials ess;
private final static Logger LOGGER = Logger.getLogger("Minecraft");
private final static int WALL_SIGN = Material.WALL_SIGN.getId();
private final static int SIGN_POST = Material.SIGN_POST.getId();
public SignBlockListener(IEssentials ess)
{
@ -42,7 +44,7 @@ public class SignBlockListener implements Listener
public boolean protectSignsAndBlocks(final Block block, final Player player)
{
final int mat = block.getTypeId();
if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId())
if (mat == SIGN_POST || mat == WALL_SIGN)
{
final Sign csign = (Sign)block.getState();
@ -116,16 +118,16 @@ public class SignBlockListener implements Listener
}
final Block against = event.getBlockAgainst();
if ((against.getType() == Material.WALL_SIGN
|| against.getType() == Material.SIGN_POST)
if ((against.getTypeId() == WALL_SIGN
|| against.getTypeId() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(against)))
{
event.setCancelled(true);
return;
}
final Block block = event.getBlock();
if (block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
if (block.getTypeId() == WALL_SIGN
|| block.getTypeId() == SIGN_POST)
{
return;
}
@ -150,8 +152,8 @@ public class SignBlockListener implements Listener
}
final Block block = event.getBlock();
if (((block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
if (((block.getTypeId() == WALL_SIGN
|| block.getTypeId() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@ -178,8 +180,8 @@ public class SignBlockListener implements Listener
}
final Block block = event.getBlock();
if (((block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
if (((block.getTypeId() == WALL_SIGN
|| block.getTypeId() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@ -202,8 +204,8 @@ public class SignBlockListener implements Listener
{
for (Block block : event.getBlocks())
{
if (((block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
if (((block.getTypeId() == WALL_SIGN
|| block.getTypeId() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@ -228,8 +230,8 @@ public class SignBlockListener implements Listener
if (event.isSticky())
{
final Block block = event.getBlock();
if (((block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
if (((block.getTypeId() == WALL_SIGN
|| block.getTypeId() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{

View file

@ -24,8 +24,8 @@ public class SignEntityListener implements Listener
{
for (Block block : event.blockList())
{
if (((block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
if (((block.getTypeId() == Material.WALL_SIGN.getId()
|| block.getTypeId() == Material.SIGN_POST.getId())
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@ -52,8 +52,8 @@ public class SignEntityListener implements Listener
}
final Block block = event.getBlock();
if (((block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
if (((block.getTypeId() == Material.WALL_SIGN.getId()
|| block.getTypeId() == Material.SIGN_POST.getId())
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{

View file

@ -34,7 +34,8 @@ public class SignPlayerListener implements Listener
return;
}
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
final int mat = block.getTypeId();
if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId())
{
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
{