Allow breaking/placing blocks when in creative

This commit is contained in:
Shaun Bennett 2015-08-26 13:09:01 -07:00
parent 7a66a8dad9
commit 14f5cb4704
2 changed files with 4 additions and 3 deletions

View File

@ -506,7 +506,7 @@ public class ClansGame extends MiniPlugin
//Block Placement
if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
if (player.getItemInHand().getType() != Material.AIR)
if (Clans.getClanBlocks().denyUsePlace(player.getItemInHand().getTypeId()))
if (player.getGameMode() != GameMode.CREATIVE && Clans.getClanBlocks().denyUsePlace(player.getItemInHand().getTypeId()))
{
//Disallow
event.setCancelled(true);

View File

@ -3,6 +3,7 @@ package mineplex.game.clans.spawn;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
@ -157,11 +158,11 @@ public class Spawn extends MiniPlugin
@EventHandler
public void onBlockBreak(BlockBreakEvent event)
{
if (isInSpawn(event.getBlock().getLocation()))
if (isInSpawn(event.getBlock().getLocation()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
{
event.setCancelled(true);
}
else if (isInSpawn(event.getPlayer()))
else if (isInSpawn(event.getPlayer()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
{
event.setCancelled(true);
}