Improves blacksmith description, and adds some missing comments
This commit is contained in:
parent
5fa6408f90
commit
909863a2f7
@ -5,11 +5,34 @@ package net.knarcraft.dynmapcitizens;
|
|||||||
*/
|
*/
|
||||||
public enum Icon {
|
public enum Icon {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An icon representing a quest giver
|
||||||
|
*/
|
||||||
QUEST_GIVER,
|
QUEST_GIVER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An icon representing an interactable NPC part of some quest
|
||||||
|
*/
|
||||||
QUEST_INTERACT,
|
QUEST_INTERACT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An icon representing an NPC to be killed as part of a quest
|
||||||
|
*/
|
||||||
QUEST_KILL,
|
QUEST_KILL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An icon representing an NPC taking deliveries as part of a quest
|
||||||
|
*/
|
||||||
QUEST_DELIVER,
|
QUEST_DELIVER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An icon representing a sentinel NPC
|
||||||
|
*/
|
||||||
SENTINEL,
|
SENTINEL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An icon representing a blacksmith NPC
|
||||||
|
*/
|
||||||
BLACKSMITH
|
BLACKSMITH
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@ import org.dynmap.markers.MarkerSet;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstract class with useful code for all citizens-trait-handlers
|
||||||
|
*/
|
||||||
public abstract class AbstractTraitHandler implements CitizensTraitHandler {
|
public abstract class AbstractTraitHandler implements CitizensTraitHandler {
|
||||||
|
|
||||||
protected boolean isEnabled = false;
|
protected boolean isEnabled = false;
|
||||||
|
@ -53,12 +53,8 @@ public class BlacksmithHandler extends AbstractTraitHandler {
|
|||||||
if (trait == null) {
|
if (trait == null) {
|
||||||
DynmapCitizens.getInstance().getLogger().log(Level.WARNING, "Unable to get blacksmith trait");
|
DynmapCitizens.getInstance().getLogger().log(Level.WARNING, "Unable to get blacksmith trait");
|
||||||
} else {
|
} else {
|
||||||
NPCSettings npcSettings = trait.getSettings();
|
|
||||||
//TODO: Make a setting which allows disabling extra information (except title and reforge-able items?)
|
//TODO: Make a setting which allows disabling extra information (except title and reforge-able items?)
|
||||||
description = "<b>Blacksmith name:</b> " + npc.getName() + "<br><b>Blacksmith title:</b> " +
|
description = getDetailedBlacksmithInfo(npc, trait.getSettings());
|
||||||
npcSettings.getBlacksmithTitle() + "<br><b>Fail chance:</b> " + npcSettings.getFailChance() +
|
|
||||||
"<br><b>Enchantment chance:</b> " + npcSettings.getExtraEnchantmentChance() +
|
|
||||||
"<br><b>Reforge-able items:</b> " + getReforgeAbleItemsString(npcSettings.getReforgeAbleItems());
|
|
||||||
}
|
}
|
||||||
addNPCMarker(npc.getUniqueId(), "Blacksmith NPC: ", description,
|
addNPCMarker(npc.getUniqueId(), "Blacksmith NPC: ", description,
|
||||||
DynmapCitizens.getInstance().getMarkerIcons().get(Icon.BLACKSMITH), blacksmithSet);
|
DynmapCitizens.getInstance().getMarkerIcons().get(Icon.BLACKSMITH), blacksmithSet);
|
||||||
@ -66,6 +62,26 @@ public class BlacksmithHandler extends AbstractTraitHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets detailed information about a blacksmith NPC
|
||||||
|
*
|
||||||
|
* @param npc <p>The NPC the settings belong to</p>
|
||||||
|
* @param npcSettings <p>The settings to search for information</p>
|
||||||
|
* @return <p>A string describing the blacksmith</p>
|
||||||
|
*/
|
||||||
|
private String getDetailedBlacksmithInfo(NPC npc, NPCSettings npcSettings) {
|
||||||
|
String info = "<b>Blacksmith name:</b> " + npc.getName() + "<br><b>Blacksmith title:</b> " +
|
||||||
|
npcSettings.getBlacksmithTitle() + "<br><b>Fail chance:</b> " + npcSettings.getFailChance() +
|
||||||
|
"<br><b>Enchantment chance:</b> " + npcSettings.getExtraEnchantmentChance() + "<br><b>Delay:</b> " +
|
||||||
|
npcSettings.getMinReforgeDelay() + " to " + npcSettings.getMaxReforgeDelay() +
|
||||||
|
" seconds<br><b>Cool-down:</b> " + npcSettings.getReforgeCoolDown() + " seconds<br><b>Drop item:</b> " +
|
||||||
|
npcSettings.getDropItem();
|
||||||
|
if (!npcSettings.getReforgeAbleItems().isEmpty()) {
|
||||||
|
info += "<br><b>Reforge-able items:</b> " + getReforgeAbleItemsString(npcSettings.getReforgeAbleItems());
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets reforge-able items as a string
|
* Gets reforge-able items as a string
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package net.knarcraft.dynmapcitizens.trait;
|
package net.knarcraft.dynmapcitizens.trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A handler which takes care of everything for one citizen trait
|
||||||
|
*/
|
||||||
public interface CitizensTraitHandler {
|
public interface CitizensTraitHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,9 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A handler class for the quests trait
|
||||||
|
*/
|
||||||
public class QuestsHandler extends AbstractTraitHandler {
|
public class QuestsHandler extends AbstractTraitHandler {
|
||||||
|
|
||||||
private QuestsAPI questsAPI;
|
private QuestsAPI questsAPI;
|
||||||
@ -38,9 +41,10 @@ public class QuestsHandler extends AbstractTraitHandler {
|
|||||||
questMarkerSet.setHideByDefault(false);
|
questMarkerSet.setHideByDefault(false);
|
||||||
questAreaMarkerSet.setHideByDefault(true);
|
questAreaMarkerSet.setHideByDefault(true);
|
||||||
isEnabled = true;
|
isEnabled = true;
|
||||||
//TODO: Initialize the dynmap drawer with the marker sets
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package net.knarcraft.dynmapcitizens.trait;
|
package net.knarcraft.dynmapcitizens.trait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A handler class for the sentinel trait
|
||||||
|
*/
|
||||||
public class SentinelHandler extends AbstractTraitHandler {
|
public class SentinelHandler extends AbstractTraitHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user