/region info now outputs all flag types, /region flag cspawn still needs fixing

This commit is contained in:
Redecouverte 2011-02-25 19:20:49 +01:00
parent 23fa7a89ad
commit 46e0607a26
2 changed files with 27 additions and 24 deletions

View File

@ -15,14 +15,14 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package com.sk89q.worldguard.bukkit.commands;
import com.sk89q.worldguard.bukkit.BukkitPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardConfiguration;
import com.sk89q.worldguard.bukkit.WorldGuardWorldConfiguration;
import com.sk89q.worldguard.bukkit.commands.CommandHandler.CommandHandlingException;
import com.sk89q.worldguard.bukkit.commands.FlagInfo.FlagValueType;
import com.sk89q.worldguard.domains.DefaultDomain;
import com.sk89q.worldguard.protection.regionmanager.RegionManager;
import com.sk89q.worldguard.protection.regions.AreaFlags;
@ -56,17 +56,13 @@ public boolean handle(CommandSender sender, String senderName, String command, S
if (region.isOwner(BukkitPlayer.wrapPlayer(cfg, player))) {
cfg.checkRegionPermission(sender, "region.info.ownregions");
}
else if(region.isMember(BukkitPlayer.wrapPlayer(cfg, player))) {
} else if (region.isMember(BukkitPlayer.wrapPlayer(cfg, player))) {
cfg.checkRegionPermission(sender, "region.info.memberregions");
}
else {
} else {
cfg.checkRegionPermission(sender, "region.info.foreignregions");
}
}
else
{
cfg.checkRegionPermission(sender, "region.info.foreignregions");
} else {
cfg.checkRegionPermission(sender, "region.info.foreignregions");
}
AreaFlags flags = region.getFlags();
@ -79,25 +75,32 @@ else if(region.isMember(BukkitPlayer.wrapPlayer(cfg, player))) {
StringBuilder s = new StringBuilder();
for (FlagInfo nfo : FlagInfo.getFlagInfoList()) {
if (s.length() > 0) {
s.append(", ");
}
String fullName = nfo.name;
if (nfo.subName != null) {
if (nfo.subName != null && nfo.subName != "*") {
fullName += " " + nfo.subName;
}
String value = flags.getFlag(nfo.flagName, nfo.flagSubName);
if (value != null) {
s.append(fullName + ": " + value + ", ");
String value;
if (nfo.type == FlagValueType.LOCATION) {
value = flags.getFlag(nfo.flagName, "x");
if (value != null) {
s.append(fullName + ": set");
} else {
s.append(fullName + ": -");
}
} else {
value = flags.getFlag(nfo.flagName, nfo.flagSubName);
if (value != null) {
s.append(fullName + ": " + value);
} else {
s.append(fullName + ": -");
}
}
}
String spawnTest = flags.getFlag("spawn", "x");
if(spawnTest != null)
{
s.append("spawn: set");
}
else
{
s.append("spawn: not set");
}
sender.sendMessage(ChatColor.BLUE + "Flags: " + s.toString());

View File

@ -42,7 +42,7 @@ public static enum FlagValueType { STRING, BOOLEAN, INT, FLOAT, DOUBLE, STATE, L
flagList = new ArrayList<FlagInfo>();
flagList.add(new FlagInfo("msg", "g", FlagValueType.STRING, "msg", "g"));
flagList.add(new FlagInfo("msg", "f", FlagValueType.STRING, "msg", "f"));
flagList.add(new FlagInfo("cs", "*", FlagValueType.STRING, "creaturespawn", "*"));
flagList.add(new FlagInfo("cspawn", "*", FlagValueType.STRING, "creaturespawn", "*"));
flagList.add(new FlagInfo("heal", "delay", FlagValueType.INT, "heal", "delay"));
flagList.add(new FlagInfo("heal", "amount", FlagValueType.INT, "heal", "amount"));
flagList.add(new FlagInfo("passthrough", null, FlagValueType.STATE, "states", "passthrough"));