mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-22 06:12:56 +02:00
Don't place a block, if interacting with a sign.
This commit is contained in:
@@ -20,12 +20,12 @@ public class SignBlockListener extends BlockListener
|
|||||||
{
|
{
|
||||||
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");
|
||||||
|
|
||||||
public SignBlockListener(IEssentials ess)
|
public SignBlockListener(IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockBreak(final BlockBreakEvent event)
|
public void onBlockBreak(final BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
@@ -33,13 +33,13 @@ public class SignBlockListener extends BlockListener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protectSignsAndBlocks(event.getBlock(), event.getPlayer()))
|
if (protectSignsAndBlocks(event.getBlock(), event.getPlayer()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@@ -77,7 +77,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSignChange(final SignChangeEvent event)
|
public void onSignChange(final SignChangeEvent event)
|
||||||
{
|
{
|
||||||
@@ -96,7 +96,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlace(final BlockPlaceEvent event)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
@@ -104,7 +104,14 @@ public class SignBlockListener extends BlockListener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Block against = event.getBlockAgainst();
|
||||||
|
if (against.getType() == Material.WALL_SIGN
|
||||||
|
|| against.getType() == Material.SIGN_POST)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
if (block.getType() == Material.WALL_SIGN
|
if (block.getType() == Material.WALL_SIGN
|
||||||
|| block.getType() == Material.SIGN_POST)
|
|| block.getType() == Material.SIGN_POST)
|
||||||
@@ -122,7 +129,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockBurn(final BlockBurnEvent event)
|
public void onBlockBurn(final BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
@@ -130,7 +137,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
if ((block.getType() == Material.WALL_SIGN
|
if ((block.getType() == Material.WALL_SIGN
|
||||||
|| block.getType() == Material.SIGN_POST
|
|| block.getType() == Material.SIGN_POST
|
||||||
@@ -150,7 +157,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockIgnite(final BlockIgniteEvent event)
|
public void onBlockIgnite(final BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
@@ -158,7 +165,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protectSignsAndBlocks(event.getBlock(), event.getPlayer()))
|
if (protectSignsAndBlocks(event.getBlock(), event.getPlayer()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Reference in New Issue
Block a user