mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 05:35:33 +01:00
Assume value of 1.0 for empty mob drop chance, fixes #531
This commit is contained in:
parent
83ef4e849e
commit
65c0b58c49
@ -1468,7 +1468,8 @@ public class EventFactory implements ConversationAbandonedListener {
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
for (int i = 0; i < types.size(); i++) {
|
||||
QuestMob qm = QuestMob.fromString(types.get(i));
|
||||
text += ChatColor.GOLD + " " + (i + 1) + " - " + Lang.get("edit") + ": " + ChatColor.AQUA + qm.getType().name() + ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + (i + 1) + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("edit") + ": "
|
||||
+ ChatColor.AQUA + qm.getType().name() + ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + (types.size() + 1) + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + (types.size() + 2) + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
||||
@ -1544,9 +1545,9 @@ public class EventFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobName") + ChatColor.GRAY + " (" + ((questMob.getName() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getName()) + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobType") + ChatColor.GRAY + " (" + ((questMob.getType() == null) ? Lang.get("eventEditorNoTypesSet") : ChatColor.AQUA + questMob.getType().name()) + ChatColor.GRAY + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobType") + ChatColor.GRAY + " (" + ((questMob.getType() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getType().name()) + ChatColor.GRAY + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + ChatColor.GRAY + " (" + ((questMob.getSpawnLocation() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + Quests.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + ChatColor.GRAY + " (" + ((questMob.getSpawnAmounts() == null) ? ChatColor.GRAY + Lang.get("eventEditorNoAmountsSet") : ChatColor.AQUA + "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + ChatColor.GRAY + " (" + ((questMob.getSpawnAmounts() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHand") + ChatColor.GRAY + " (" + ((questMob.inventory[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.inventory[0])) + ChatColor.GRAY + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHandDrop") + ChatColor.GRAY + " (" + ((questMob.dropChances[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.dropChances[0]) + ChatColor.GRAY + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobBoots") + ChatColor.GRAY + " (" + ((questMob.inventory[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.inventory[1])) + ChatColor.GRAY + ")\n";
|
||||
@ -1875,8 +1876,8 @@ public class EventFactory implements ConversationAbandonedListener {
|
||||
String text = ChatColor.GOLD + Lang.get("eventEditorPotionEffectsTitle") + "\n";
|
||||
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionEffectTypes") + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorSetPotionDurations") + " " + Lang.get("eventEditorNoTypesSet") + "\n";
|
||||
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("eventEditorNoTypesSet") + "\n";
|
||||
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorSetPotionDurations") + " " + Lang.get("noneSet") + "\n";
|
||||
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("noneSet") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
||||
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
|
||||
} else {
|
||||
@ -1886,9 +1887,9 @@ public class EventFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
if (context.getSessionData(CK.E_POTION_DURATIONS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionDurations") + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("eventEditorNoDurationsSet") + "\n";
|
||||
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("noneSet") + "\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorNoDurationsSet") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("noneSet") + "\n";
|
||||
for (Long l : (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.DARK_AQUA + Quests.getTime(l * 50L) + "\n";
|
||||
}
|
||||
|
@ -190,23 +190,53 @@ public class QuestMob {
|
||||
} else if (string.startsWith("hand-")) {
|
||||
inventory[0] = ItemUtil.readItemStack(string.substring(5));
|
||||
} else if (string.startsWith("hand_drop-")) {
|
||||
dropChances[0] = Float.parseFloat(string.substring(10));
|
||||
try {
|
||||
dropChances[0] = Float.parseFloat(string.substring(10));
|
||||
} catch (NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for hand was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[0] = 1.0f;
|
||||
}
|
||||
} else if (string.startsWith("boots-")) {
|
||||
inventory[1] = ItemUtil.readItemStack(string.substring(6));
|
||||
} else if (string.startsWith("boots_drop-")) {
|
||||
dropChances[1] = Float.parseFloat(string.substring(11));
|
||||
try {
|
||||
dropChances[1] = Float.parseFloat(string.substring(11));
|
||||
} catch (NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for boots was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[1] = 1.0f;
|
||||
}
|
||||
} else if (string.startsWith("leggings-")) {
|
||||
inventory[2] = ItemUtil.readItemStack(string.substring(9));
|
||||
} else if (string.startsWith("leggings_drop-")) {
|
||||
dropChances[2] = Float.parseFloat(string.substring(14));
|
||||
try {
|
||||
dropChances[2] = Float.parseFloat(string.substring(14));
|
||||
} catch (NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for leggings was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[2] = 1.0f;
|
||||
}
|
||||
} else if (string.startsWith("chest-")) {
|
||||
inventory[3] = ItemUtil.readItemStack(string.substring(6));
|
||||
} else if (string.startsWith("chest_drop-")) {
|
||||
dropChances[3] = Float.parseFloat(string.substring(11));
|
||||
try {
|
||||
dropChances[3] = Float.parseFloat(string.substring(11));
|
||||
} catch (NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for chest was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[3] = 1.0f;
|
||||
}
|
||||
} else if (string.startsWith("helmet-")) {
|
||||
inventory[4] = ItemUtil.readItemStack(string.substring(7));
|
||||
} else if (string.startsWith("helmet_drop-")) {
|
||||
dropChances[4] = Float.parseFloat(string.substring(12));
|
||||
try {
|
||||
dropChances[4] = Float.parseFloat(string.substring(12));
|
||||
} catch (NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for helmet was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[4] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
QuestMob qm = new QuestMob(entityType, loc, amounts);
|
||||
|
@ -388,10 +388,8 @@ eventEditorEffectsCleared: "Event effects cleared."
|
||||
eventEditorEffectLocationPrompt: "Right-click on a block to play an effect at, <add>, <cancel>"
|
||||
eventEditorMobSpawns: "Event Mob Spawns"
|
||||
eventEditorAddMobTypes: "Add mob"
|
||||
eventEditorNoTypesSet: "(No type set)"
|
||||
eventEditorMustSetMobTypesFirst: "You must set the mob type first!"
|
||||
eventEditorSetMobAmounts: "Set mob amount"
|
||||
eventEditorNoAmountsSet: "(No amounts set)"
|
||||
eventEditorMustSetMobAmountsFirst: "You must set mob amount first!"
|
||||
eventEditorAddSpawnLocation: "Set spawn location"
|
||||
eventEditorMobSpawnsCleared: "Mob spawns cleared."
|
||||
@ -417,7 +415,6 @@ eventEditorMustSetPotionTypesFirst: "You must set potion effect types first!"
|
||||
eventEditorSetPotionDurations: "Set potion effect durations"
|
||||
eventEditorMustSetPotionDurationsFirst: "You must set potion effect durations first!"
|
||||
eventEditorMustSetPotionTypesAndDurationsFirst: "You must set potion effect types and durations first!"
|
||||
eventEditorNoDurationsSet: "(No durations set)"
|
||||
eventEditorSetPotionMagnitudes: "Set potion effect magnitudes"
|
||||
eventEditorPotionsCleared: "Potion effects cleared."
|
||||
eventEditorInvalidPotionType: "is not a valid potion effect type!"
|
||||
|
Loading…
Reference in New Issue
Block a user