Adds more information to sentinel marker description

This commit is contained in:
Kristian Knarvik 2022-11-03 02:37:53 +01:00
parent 3d78e16c59
commit 6cc6233d25

View File

@ -42,9 +42,17 @@ public class SentinelHandler extends AbstractTraitHandler {
Class<? extends Trait> sentinelTrait = CitizensAPI.getTraitFactory().getTraitClass("sentinel"); Class<? extends Trait> sentinelTrait = CitizensAPI.getTraitFactory().getTraitClass("sentinel");
for (NPC npc : CitizensAPI.getNPCRegistry()) { for (NPC npc : CitizensAPI.getNPCRegistry()) {
if (npc.hasTrait(sentinelTrait)) { if (npc.hasTrait(sentinelTrait)) {
SentinelTrait trait = CitizensAPI.getTraitFactory().getTrait("sentinel"); SentinelTrait trait = npc.getTraitNullable(SentinelTrait.class);
String description = "<h2>" + npc.getName() + "</h2><b>Armor:</b> " + String description = "<h2>" + npc.getName() + "</h2>";
trait.armor + "<br><b>Health:</b> " + trait.health; if (trait.squad != null) {
description += "<br><b>Squad:</b> " + trait.squad;
}
description += "<br><b>Invincible:</b> " + trait.invincible + "<br><b>Armor:</b> " +
trait.armor + "<br><b>Health:</b> " + trait.health + "<br><b>Accuracy:</b> " + trait.accuracy +
"<br><b>Damage:</b> " + trait.damage + "<br><b>Allow knockback:</b> " + trait.allowKnockback;
description += "<br><b>Range:</b> " + trait.range + "<br><b>Reach:</b> " + trait.reach;
description += "<br><b>Targets:</b> " + trait.allTargets.toAllInOneString() + "<br><b>Avoids:</b> " +
trait.allAvoids.toAllInOneString() + "<br><b>Ignores:</b> " + trait.allIgnores.toAllInOneString();
addNPCMarker(npc.getUniqueId(), "Sentinel NPC: ", description, addNPCMarker(npc.getUniqueId(), "Sentinel NPC: ", description,
DynmapCitizens.getInstance().getMarkerIcons().get(Icon.SENTINEL), sentinelSet); DynmapCitizens.getInstance().getMarkerIcons().get(Icon.SENTINEL), sentinelSet);
} }