public static DisableDamageModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
SetMultimap<DamageCause, PlayerRelation> causes = HashMultimap.create();
for(Element damageCauseElement : doc.getRootElement().getChildren("disabledamage")) {
for(Element damageEl : damageCauseElement.getChildren("damage")) {
DamageCause cause = XMLUtils.parseEnum(damageEl, DamageCause.class, "damage type");
for(PlayerRelation damagerType : PlayerRelation.values()) {
// Legacy syntax used "other" instead of "neutral"
String attrName = damagerType.name().toLowerCase();
Node attr = damagerType == PlayerRelation.NEUTRAL ? Node.fromAttr(damageEl, attrName, "other")
: Node.fromAttr(damageEl, attrName);
if(XMLUtils.parseBoolean(attr, true)) {
causes.put(cause, damagerType);
// Bukkit 1.7.10 changed TNT from BLOCK_EXPLOSION to ENTITY_EXPLOSION,
// so we include them both to keep old maps working.
if(cause == DamageCause.BLOCK_EXPLOSION) {
causes.put(DamageCause.ENTITY_EXPLOSION, damagerType);
}
}
}
}
}
return new DisableDamageModule(causes);
}
DisableDamageModule.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:ProjectAres
作者:
评论列表
文章目录