Added /region flag <id> (spawn|teleport) (allow|deny)

(all|owner|member).
This commit is contained in:
Valentin Churavy 2011-02-25 22:40:07 +01:00
parent e61b496ca4
commit 8127e56603
2 changed files with 42 additions and 2 deletions

View File

@ -90,6 +90,32 @@ public boolean handle(CommandSender sender, String senderName, String command, S
switch (nfo.type) {
case STRING: {
validValue = true;
if(nfo.name.equals("teleport") || nfo.name.equals("spawn")){
if (valueStr.equals("all")) {
if(nfo.subName.equals("allow")){
region.getFlags().setFlag(nfo.flagName, nfo.flagSubName+"."+valueStr, true);
}else if(nfo.subName.equals("deny")){
region.getFlags().setFlag(nfo.flagName, nfo.flagSubName+"."+valueStr, false);
}
} else if (valueStr.equals("owner")){
if(nfo.subName.equals("allow")){
region.getFlags().setFlag(nfo.flagName, nfo.flagSubName+"."+valueStr, true);
}else if(nfo.subName.equals("deny")){
region.getFlags().setFlag(nfo.flagName, nfo.flagSubName+"."+valueStr, false);
}
} else if (valueStr.equals("member")){
if(nfo.subName.equals("allow")){
region.getFlags().setFlag(nfo.flagName, nfo.flagSubName+"."+valueStr, true);
}else if(nfo.subName.equals("deny")){
region.getFlags().setFlag(nfo.flagName, nfo.flagSubName+"."+valueStr, false);
}
} else {
sender.sendMessage(ChatColor.RED + "Usage: /region flag "+id+" "+nfo.name+" "+nfo.subName+" (all|owner|member)");
validValue=false;
}
}
break;
}
case INT: {
@ -109,6 +135,14 @@ public boolean handle(CommandSender sender, String senderName, String command, S
valueStr = "true";
} else if (valueStr.equals("1")) {
valueStr = "true";
} else if (valueStr.equals("off")){
valueStr="false";
} else if (valueStr.equals("deny")){
valueStr="false";
}else if(valueStr.equals("0")){
valueStr="false";
} else{
validValue = false;
}
validValue = true;
break;

View File

@ -58,8 +58,14 @@ public static enum FlagValueType { STRING, BOOLEAN, INT, FLOAT, DOUBLE, STATE, L
flagList.add(new FlagInfo("waterflow", null, FlagValueType.STATE, "states", "waterflow"));
flagList.add(new FlagInfo("iconomy", "buyable", FlagValueType.BOOLEAN, "iconomy", "buyable"));
flagList.add(new FlagInfo("iconomy", "price", FlagValueType.INT, "iconomy", "price"));
flagList.add(new FlagInfo("spawn", "*", FlagValueType.LOCATION, "spawn", ""));
flagList.add(new FlagInfo("teleport", "*", FlagValueType.LOCATION, "teleport", ""));
flagList.add(new FlagInfo("spawn", "set", FlagValueType.LOCATION, "spawn", ""));
flagList.add(new FlagInfo("spawn", "delete", FlagValueType.LOCATION, "spawn", ""));
flagList.add(new FlagInfo("spawn", "allow", FlagValueType.STRING, "spawn", "settings"));
flagList.add(new FlagInfo("spawn", "deny", FlagValueType.STRING, "spawn", "settings"));
flagList.add(new FlagInfo("teleport", "set", FlagValueType.LOCATION, "teleport", ""));
flagList.add(new FlagInfo("teleport", "delete", FlagValueType.LOCATION, "teleport", ""));
flagList.add(new FlagInfo("teleport", "allow", FlagValueType.STRING, "teleport", "settings"));
flagList.add(new FlagInfo("teleport", "deny", FlagValueType.STRING, "teleport", "settings"));
}
public static FlagInfo getFlagInfo(String name, String subName) {