Skip to content

Commit

Permalink
Add block place, block break flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
sk89q committed Aug 22, 2014
1 parent 722dabc commit bd8e1a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -141,12 +141,12 @@ public boolean apply(Location target) {

/* Flint and steel, fire charge, etc. */
if (type == Material.FIRE) {
canPlace = query.testBuild(target, associable, DefaultFlag.LIGHTER);
canPlace = query.testBuild(target, associable, DefaultFlag.BLOCK_PLACE, DefaultFlag.LIGHTER);
what = "place fire";

/* Everything else */
} else {
canPlace = query.testBuild(target, associable);
canPlace = query.testBuild(target, associable, DefaultFlag.BLOCK_PLACE);
what = "place that block";
}

Expand Down Expand Up @@ -178,12 +178,12 @@ public boolean apply(Location target) {

/* TNT */
if (event.getCause().find(EntityType.PRIMED_TNT, EntityType.PRIMED_TNT) != null) {
canBreak = query.testBuild(target, associable, DefaultFlag.TNT);
canBreak = query.testBuild(target, associable, DefaultFlag.BLOCK_BREAK, DefaultFlag.TNT);
what = "dynamite blocks";

/* Everything else */
} else {
canBreak = query.testBuild(target, associable);
canBreak = query.testBuild(target, associable, DefaultFlag.BLOCK_BREAK);
what = "break that block";
}

Expand Down
Expand Up @@ -44,6 +44,8 @@ public final class DefaultFlag {
// These flags are used in tandem with the BUILD flag - if the player can
// build, then the following flags do not need to be checked (although they
// are still checked for DENY), so they are false by default
public static final StateFlag BLOCK_BREAK = new StateFlag("block-break", false);
public static final StateFlag BLOCK_PLACE = new StateFlag("block-place", false);
public static final StateFlag USE = new StateFlag("use", false);
public static final StateFlag PVP = new StateFlag("pvp", false);
public static final StateFlag SLEEP = new StateFlag("sleep", false);
Expand Down Expand Up @@ -125,7 +127,7 @@ public final class DefaultFlag {
public static final SetFlag<String> ALLOWED_CMDS = new SetFlag<String>("allowed-cmds", new CommandStringFlag(null));

public static final Flag<?>[] flagsList = new Flag<?>[] {
PASSTHROUGH, BUILD, CONSTRUCT, PVP, CHEST_ACCESS, PISTONS,
PASSTHROUGH, BUILD, CONSTRUCT, BLOCK_BREAK, BLOCK_PLACE, PVP, CHEST_ACCESS, PISTONS,
TNT, LIGHTER, USE, PLACE_VEHICLE, DESTROY_VEHICLE, SLEEP,
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY, EXP_DROPS,
CREEPER_EXPLOSION, OTHER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
Expand Down

0 comments on commit bd8e1a3

Please sign in to comment.