///////
// Match @object format
if (string.startsWith("fl")) {
FlagManager flag_manager = DenizenAPI.getCurrentInstance().flagManager();
if (string.indexOf('[') == 2) {
int cb = string.indexOf(']');
if (cb > 4 && string.indexOf('@') == (cb + 1)) {
String owner = string.substring(3, cb);
String flag = string.substring(cb + 2);
if (dPlayer.matches(owner)) {
dPlayer player = dPlayer.valueOf(owner);
if (FlagManager.playerHasFlag(player, flag))
return new dList(flag_manager.getPlayerFlag(player, flag));
else
dB.echoError("Player '" + owner + "' flag '" + flag + "' not found.");
}
else if (Depends.citizens != null && dNPC.matches(owner)) {
dNPC npc = dNPC.valueOf(owner);
if (FlagManager.npcHasFlag(npc, flag))
return new dList(flag_manager.getNPCFlag(npc.getId(), flag));
else
dB.echoError("NPC '" + owner + "' flag '" + flag + "' not found.");
}
}
else
dB.echoError("Invalid dFlag format: " + string);
}
else if (string.indexOf('@') == 2) {
String flag = string.substring(3);
if (FlagManager.serverHasFlag(flag))
return new dList(flag_manager.getGlobalFlag(flag));
else
dB.echoError("Global flag '" + flag + "' not found.");
}
return null;
}