Added ability to change default values of region's flags in config.yml for: FLAG_LIGHTER, FLAG_TNT, FLAG_CREEPER_EXPLOSION, FLAG_MOB_DAMAGE

This commit is contained in:
DarkLiKally 2011-02-22 15:02:17 +01:00
parent 135d92303d
commit c9c747693d
4 changed files with 21 additions and 1 deletions

View File

@ -76,6 +76,10 @@ regions:
build: true
chest-access: false
pvp: true
lighter: true
tnt: true
creeper: true
mobdamage: true
blacklist:
logging:

View File

@ -318,6 +318,10 @@ public void loadConfiguration() {
globalFlags.canBuild = config.getBoolean("regions.default.build", true);
globalFlags.canAccessChests = config.getBoolean("regions.default.chest-access", false);
globalFlags.canPvP = config.getBoolean("regions.default.pvp", true);
globalFlags.canLighter = config.getBoolean("regions.default.lighter", true);
globalFlags.canTnt = config.getBoolean("regions.default.tnt", true);
globalFlags.allowCreeper = config.getBoolean("regions.default.creeper", true);
globalFlags.allowMobDamage = config.getBoolean("regions.default.mobdamage", true);
try {
regionLoader.load();

View File

@ -74,7 +74,15 @@ public boolean allowsFlag(String flag) {
def = global.canAccessChests;
} else if (flag.equals(AreaFlags.FLAG_PVP)) {
def = global.canPvP;
}
} else if (flag.equals(AreaFlags.FLAG_LIGHTER)) {
def = global.canLighter;
} else if (flag.equals(AreaFlags.FLAG_TNT)) {
def = global.canTnt;
} else if (flag.equals(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
def = global.allowCreeper;
} else if (flag.equals(AreaFlags.FLAG_MOB_DAMAGE)) {
def = global.allowMobDamage;
}
return isFlagAllowed(flag, def, null);
}

View File

@ -28,4 +28,8 @@ public class GlobalFlags {
public boolean canBuild = true;
public boolean canAccessChests = false;
public boolean canPvP = true;
public boolean canLighter = true;
public boolean canTnt = true;
public boolean allowCreeper = true;
public boolean allowMobDamage = true;
}