Update getName() to name(), suppress unchecked types

This commit is contained in:
HappyPikachu 2015-01-05 12:38:38 -05:00
parent 85d5dc0414
commit 65c0c4f3df

View File

@ -1,6 +1,7 @@
package me.blackvein.quests; package me.blackvein.quests;
import me.blackvein.quests.util.ColorUtil; import me.blackvein.quests.util.ColorUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
@ -12,7 +13,6 @@ import java.util.Map.Entry;
import me.blackvein.quests.prompts.ItemStackPrompt; import me.blackvein.quests.prompts.ItemStackPrompt;
import me.blackvein.quests.util.CK; import me.blackvein.quests.util.CK;
import static me.blackvein.quests.util.ColorUtil.PURPLE;
import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.Lang;
import me.blackvein.quests.util.MiscUtil; import me.blackvein.quests.util.MiscUtil;
@ -504,6 +504,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -596,7 +597,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
for (String s : types) { for (String s : types) {
QuestMob qm = QuestMob.fromString(s); QuestMob qm = QuestMob.fromString(s);
text += GRAY + " - " + AQUA + qm.getType().getName() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n"; text += GRAY + " - " + AQUA + qm.getType().name() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
} }
} }
@ -906,11 +907,12 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
return (LinkedList<Integer>) context.getSessionData(path); return (LinkedList<Integer>) context.getSessionData(path);
} }
@SuppressWarnings("unused")
private static Boolean getCBoolean(ConversationContext context, String path) { private static Boolean getCBoolean(ConversationContext context, String path) {
return (Boolean) context.getSessionData(path); return (Boolean) context.getSessionData(path);
} }
@SuppressWarnings("unchecked") @SuppressWarnings({ "unchecked", "unused" })
private static LinkedList<Boolean> getCBooleanList(ConversationContext context, String path) { private static LinkedList<Boolean> getCBooleanList(ConversationContext context, String path) {
return (LinkedList<Boolean>) context.getSessionData(path); return (LinkedList<Boolean>) context.getSessionData(path);
} }
@ -1014,6 +1016,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
if (context.getSessionData(CK.E_ITEMS) != null) { if (context.getSessionData(CK.E_ITEMS) != null) {
@SuppressWarnings("unchecked")
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS); LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
LinkedList<String> lines = new LinkedList<String>(); LinkedList<String> lines = new LinkedList<String>();
@ -1079,7 +1082,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
ss.set("name", questMob.getName()); ss.set("name", questMob.getName());
ss.set("spawn-location", Quests.getLocationInfo(questMob.getSpawnLocation())); ss.set("spawn-location", Quests.getLocationInfo(questMob.getSpawnLocation()));
ss.set("mob-type", questMob.getType().getName()); ss.set("mob-type", questMob.getType().name());
ss.set("spawn-amounts", questMob.getSpawnAmounts()); ss.set("spawn-amounts", questMob.getSpawnAmounts());
ss.set("held-item", ItemUtil.serialize(questMob.inventory[0])); ss.set("held-item", ItemUtil.serialize(questMob.inventory[0]));
ss.set("held-item-drop-chance", questMob.dropChances[0]); ss.set("held-item-drop-chance", questMob.dropChances[0]);
@ -1232,6 +1235,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
} }
@SuppressWarnings("unused")
private class SetNpcStartPrompt extends NumericPrompt { private class SetNpcStartPrompt extends NumericPrompt {
@Override @Override
@ -1269,6 +1273,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
@ -1454,6 +1459,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
private List<ItemStack> getItems(ConversationContext context) { private List<ItemStack> getItems(ConversationContext context) {
return (List<ItemStack>) context.getSessionData(CK.E_ITEMS); return (List<ItemStack>) context.getSessionData(CK.E_ITEMS);
} }
@ -1554,10 +1560,12 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
private List<String> getEffects(ConversationContext context) { private List<String> getEffects(ConversationContext context) {
return (List<String>) context.getSessionData(CK.E_EFFECTS); return (List<String>) context.getSessionData(CK.E_EFFECTS);
} }
@SuppressWarnings("unchecked")
private List<String> getEffectLocations(ConversationContext context) { private List<String> getEffectLocations(ConversationContext context) {
return (List<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS); return (List<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
} }
@ -1572,6 +1580,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
@ -1635,6 +1644,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
@ -1951,11 +1961,12 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done");
} else { } else {
@SuppressWarnings("unchecked")
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES); LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
for (int i = 0; i < types.size(); i++) { for (int i = 0; i < types.size(); i++) {
QuestMob qm = QuestMob.fromString(types.get(i)); QuestMob qm = QuestMob.fromString(types.get(i));
text += GOLD + " " + (i + 1) + " - " + Lang.get("edit") + ": " + AQUA + qm.getType().getName() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n"; text += GOLD + " " + (i + 1) + " - " + Lang.get("edit") + ": " + AQUA + qm.getType().name() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
} }
text += BLUE + "" + BOLD + (types.size() + 1) + RESET + YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + "\n"; text += BLUE + "" + BOLD + (types.size() + 1) + RESET + YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + "\n";
@ -1982,6 +1993,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} }
} else { } else {
@SuppressWarnings("unchecked")
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES); LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
int inp; int inp;
try { try {
@ -2043,7 +2055,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobName") + GRAY + " (" + ((questMob.getName() == null) ? Lang.get("noneSet") : AQUA + questMob.getName()) + ")\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobName") + GRAY + " (" + ((questMob.getName() == null) ? Lang.get("noneSet") : AQUA + questMob.getName()) + ")\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobType") + GRAY + " (" + ((questMob.getType() == null) ? Lang.get("eventEditorNoTypesSet") : AQUA + questMob.getType().getName()) + GRAY + ")\n"; text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobType") + GRAY + " (" + ((questMob.getType() == null) ? Lang.get("eventEditorNoTypesSet") : AQUA + questMob.getType().name()) + GRAY + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + GRAY + " (" + ((questMob.getSpawnLocation() == null) ? GRAY + Lang.get("noneSet") : AQUA + Quests.getLocationInfo(questMob.getSpawnLocation())) + GRAY + ")\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + GRAY + " (" + ((questMob.getSpawnLocation() == null) ? GRAY + Lang.get("noneSet") : AQUA + Quests.getLocationInfo(questMob.getSpawnLocation())) + GRAY + ")\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + GRAY + " (" + ((questMob.getSpawnAmounts() == null) ? GRAY + Lang.get("eventEditorNoAmountsSet") : AQUA + "" + questMob.getSpawnAmounts()) + GRAY + ")\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + GRAY + " (" + ((questMob.getSpawnAmounts() == null) ? GRAY + Lang.get("eventEditorNoAmountsSet") : AQUA + "" + questMob.getSpawnAmounts()) + GRAY + ")\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobItemInHand") + GRAY + " (" + ((questMob.inventory[0] == null) ? GRAY + Lang.get("noneSet") : AQUA + ItemUtil.getDisplayString(questMob.inventory[0])) + GRAY + ")\n"; text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobItemInHand") + GRAY + " (" + ((questMob.inventory[0] == null) ? GRAY + Lang.get("noneSet") : AQUA + ItemUtil.getDisplayString(questMob.inventory[0])) + GRAY + ")\n";
@ -2374,6 +2386,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
@ -2430,6 +2443,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -2479,6 +2493,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
} }
@SuppressWarnings("unchecked")
@Override @Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) { protected Prompt acceptValidatedInput(ConversationContext context, String input) {
@ -2833,8 +2848,6 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] commands = input.split(","); String[] commands = input.split(",");