Prevent players placing barrier blocks (caused by a bug in ShopPage)
This commit is contained in:
parent
9a3765ee2f
commit
5f156f771e
@ -88,7 +88,7 @@ public class CakePlayerModule extends CakeModule
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void blockBreak(BlockPlaceEvent event)
|
||||
public void blockPlaceRecord(BlockPlaceEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
@ -121,12 +121,26 @@ public class CakePlayerModule extends CakeModule
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void holdingRunePlace(BlockPlaceEvent event)
|
||||
public void blockPlacePrevent(BlockPlaceEvent event)
|
||||
{
|
||||
if (event.getItemInHand().getType() == RUNE_OF_HOLDING.getType())
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack.getType() == RUNE_OF_HOLDING.getType())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannot place a " + F.name(RUNE_OF_HOLDING.getItemMeta().getDisplayName()) + "."));
|
||||
player.sendMessage(F.main("Game", "You cannot place a " + F.name(RUNE_OF_HOLDING.getItemMeta().getDisplayName()) + "."));
|
||||
}
|
||||
else if (itemStack.getType() == Material.BARRIER)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.setItemInHand(null);
|
||||
player.sendMessage(F.main("Game", "You cannot place " + F.name("Barriers") + "."));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user