public void playerTags(ReplaceableTagEvent event) {
if (!event.matches("player", "pl") || event.replaced()) return;
// Build a new attribute out of the raw_tag supplied in the script to be fulfilled
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
// PlayerTags require a... dPlayer!
dPlayer p = event.getPlayer();
// Player tag may specify a new player in the <player[context]...> portion of the tag.
if (attribute.hasContext(1))
// Check if this is a valid player and update the dPlayer object reference.
if (dPlayer.matches(attribute.getContext(1)))
p = dPlayer.valueOf(attribute.getContext(1));
else {
if (!event.hasAlternative()) dB.echoError("Could not match '" + attribute.getContext(1) + "' to a valid player!");
return;
}
if (p == null || !p.isValid()) {
if (!event.hasAlternative()) dB.echoError("Invalid or missing player for tag <" + event.raw_tag + ">!");
return;
}
event.setReplaced(p.getAttribute(attribute.fulfill(1)));
}