Improves display of NPC names

This commit is contained in:
Kristian Knarvik 2022-11-01 15:27:16 +01:00
parent ce042fe3ec
commit 032327c0f7
4 changed files with 31 additions and 15 deletions

View File

@ -77,8 +77,8 @@ public class BlacksmithHandler extends AbstractTraitHandler {
* @return <p>A string describing the blacksmith</p> * @return <p>A string describing the blacksmith</p>
*/ */
private String getDetailedBlacksmithInfo(NPC npc, NPCSettings npcSettings) { private String getDetailedBlacksmithInfo(NPC npc, NPCSettings npcSettings) {
String info = "<b>Blacksmith name:</b> " + npc.getName() + "<br><b>Blacksmith title:</b> " + String info = "<h2>" + npc.getName() + " the " +
npcSettings.getBlacksmithTitle() + "<br><b>Fail chance:</b> " + npcSettings.getFailChance() + npcSettings.getBlacksmithTitle() + "</h2><b>Fail chance:</b> " + npcSettings.getFailChance() +
"<br><b>Enchantment chance:</b> " + npcSettings.getExtraEnchantmentChance() + "<br><b>Delay:</b> " + "<br><b>Enchantment chance:</b> " + npcSettings.getExtraEnchantmentChance() + "<br><b>Delay:</b> " +
npcSettings.getMinReforgeDelay() + " to " + npcSettings.getMaxReforgeDelay() + npcSettings.getMinReforgeDelay() + " to " + npcSettings.getMaxReforgeDelay() +
" seconds<br><b>Cool-down:</b> " + npcSettings.getReforgeCoolDown() + " seconds<br><b>Drop item:</b> " + " seconds<br><b>Cool-down:</b> " + npcSettings.getReforgeCoolDown() + " seconds<br><b>Drop item:</b> " +

View File

@ -73,10 +73,10 @@ public class MinstrelHandler extends AbstractTraitHandler {
* @return <p>A string describing the minstrel</p> * @return <p>A string describing the minstrel</p>
*/ */
private String getDetailedMinstrelInfo(NPC npc, MinstrelTrait trait) { private String getDetailedMinstrelInfo(NPC npc, MinstrelTrait trait) {
StringBuilder info = new StringBuilder("<b>Minstrel name:</b> " + npc.getName()); StringBuilder info = new StringBuilder("<h2>" + npc.getName() + "</h2>");
info.append("<br><b>Songs:</b><ul>"); info.append("<b>Songs:</b><ul>");
for (Song song : trait.getPlaylist().getSongs()) { for (Song song : trait.getPlaylist().getSongs()) {
info.append("<li>Category: ").append(song.getCategory()).append(" Sound: ").append(song.getSound()).append("</li>"); info.append("<li>Category: ").append(song.getCategory()).append("<br>Sound: ").append(song.getSound()).append("</li>");
} }
info.append("</ul>"); info.append("</ul>");
return info.toString(); return info.toString();

View File

@ -49,7 +49,7 @@ public class SentinelHandler extends AbstractTraitHandler {
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 = CitizensAPI.getTraitFactory().getTrait("sentinel");
String description = "<b>Name:</b> " + npc.getName() + "<br><b>Armor:</b> " + String description = "<h2>" + npc.getName() + "</h2><b>Armor:</b> " +
trait.armor + "<br><b>Health:</b> " + trait.health; trait.armor + "<br><b>Health:</b> " + trait.health;
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);

View File

@ -121,7 +121,7 @@ public class QuestsHandler extends AbstractTraitHandler {
markerDescription.append("<h2>").append(registry.getByUniqueId(npcId).getName()).append("</h2>"); markerDescription.append("<h2>").append(registry.getByUniqueId(npcId).getName()).append("</h2>");
if (!questStarts.isEmpty()) { if (!questStarts.isEmpty()) {
markerDescription.append("<br><h3>Quests offered:</h3><ul>"); markerDescription.append("<h3>Quests offered:</h3><ul>");
for (IQuest quest : questStarts) { for (IQuest quest : questStarts) {
markerDescription.append("<li><h4><b>").append(quest.getName()).append("</b></h4><h5><b>- "); markerDescription.append("<li><h4><b>").append(quest.getName()).append("</b></h4><h5><b>- ");
markerDescription.append(quest.getDescription()).append("</b></h5>").append(getQuestStagesInfo(quest)); markerDescription.append(quest.getDescription()).append("</b></h5>").append(getQuestStagesInfo(quest));
@ -173,16 +173,28 @@ public class QuestsHandler extends AbstractTraitHandler {
requirementInfo.append("<li>").append(requirements.getExp()).append(" exp</li>"); requirementInfo.append("<li>").append(requirements.getExp()).append(" exp</li>");
} }
for (IQuest blockQuest : requirements.getBlockQuests()) { if (!requirements.getBlockQuests().isEmpty()) {
requirementInfo.append("<li>Blocked by quest: ").append(blockQuest.getName()).append("</li>"); requirementInfo.append("<li>Blocked by quests:<ul>");
for (IQuest blockQuest : requirements.getBlockQuests()) {
requirementInfo.append("<li>").append(blockQuest.getName()).append("</li>");
}
requirementInfo.append("</ul></li>");
} }
for (IQuest neededQuest : requirements.getNeededQuests()) { if (!requirements.getNeededQuests().isEmpty()) {
requirementInfo.append("<li>Requires quest: ").append(neededQuest.getName()).append("</li>"); requirementInfo.append("<li>Required quests:<ul>");
for (IQuest neededQuest : requirements.getNeededQuests()) {
requirementInfo.append("<li>").append(neededQuest.getName()).append("</li>");
}
requirementInfo.append("</ul></li>");
} }
for (ItemStack item : requirements.getItems()) { if (!requirements.getItems().isEmpty()) {
requirementInfo.append("<li>Requires item: ").append(uppercaseFirst(getItemStackString(item))).append("</li>"); requirementInfo.append("<li>Required items:<ul>");
for (ItemStack item : requirements.getItems()) {
requirementInfo.append("<li>").append(uppercaseFirst(getItemStackString(item))).append("</li>");
}
requirementInfo.append("</ul></li>");
} }
if (!requirements.getMcmmoSkills().isEmpty()) { if (!requirements.getMcmmoSkills().isEmpty()) {
@ -194,8 +206,12 @@ public class QuestsHandler extends AbstractTraitHandler {
} }
} }
for (String permission : requirements.getPermissions()) { if (!requirements.getPermissions().isEmpty()) {
requirementInfo.append("<li>Requires permission: ").append(permission).append("</li>"); requirementInfo.append("<li>Required permissions:<ul>");
for (String permission : requirements.getPermissions()) {
requirementInfo.append("<li>").append(permission).append("</li>");
}
requirementInfo.append("</ul></li>");
} }
Map<String, Map<String, Object>> customRequirementPlugins = requirements.getCustomRequirements(); Map<String, Map<String, Object>> customRequirementPlugins = requirements.getCustomRequirements();