Attribute attribute = event.getAttributes();
int i = 0;
for (ChatColor color : ChatColor.values()) {
if (i > 22) break;
if (event.matches(color.name()))
event.setReplaced(new Element(color.toString()).getAttribute(attribute.fulfill(1)));
else if (event.matches("&" + code[i]))
event.setReplaced(new Element(ChatColor.getByChar(code[i]).toString()).getAttribute(attribute.fulfill(1)));
i++;
}
}