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; 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()); event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
} }

View file

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

View file

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

View file

@ -34,7 +34,8 @@ public class SignPlayerListener implements Listener
return; 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) if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
{ {