mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-26 12:46:18 +01:00
Update getName() to name(), suppress unchecked types
This commit is contained in:
parent
85d5dc0414
commit
65c0c4f3df
@ -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,7 +504,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
|
|
||||||
String text
|
String text
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean getCBoolean(ConversationContext context, String path) {
|
@SuppressWarnings("unused")
|
||||||
|
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,7 +1016,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
if (context.getSessionData(CK.E_ITEMS) != null) {
|
if (context.getSessionData(CK.E_ITEMS) != null) {
|
||||||
|
|
||||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
@SuppressWarnings("unchecked")
|
||||||
|
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
||||||
LinkedList<String> lines = new LinkedList<String>();
|
LinkedList<String> lines = new LinkedList<String>();
|
||||||
|
|
||||||
for (ItemStack is : items) {
|
for (ItemStack is : items) {
|
||||||
@ -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,7 +1235,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SetNpcStartPrompt extends NumericPrompt {
|
@SuppressWarnings("unused")
|
||||||
|
private class SetNpcStartPrompt extends NumericPrompt {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
@ -1269,7 +1273,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
|
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
@ -1454,7 +1459,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ItemStack> getItems(ConversationContext context) {
|
@SuppressWarnings("unchecked")
|
||||||
|
private List<ItemStack> getItems(ConversationContext context) {
|
||||||
return (List<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
return (List<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1554,11 +1560,13 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getEffects(ConversationContext context) {
|
@SuppressWarnings("unchecked")
|
||||||
|
private List<String> getEffects(ConversationContext context) {
|
||||||
return (List<String>) context.getSessionData(CK.E_EFFECTS);
|
return (List<String>) context.getSessionData(CK.E_EFFECTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getEffectLocations(ConversationContext context) {
|
@SuppressWarnings("unchecked")
|
||||||
|
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,7 +1580,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
|
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
@ -1635,7 +1644,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
|
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
@ -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 {
|
||||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
@SuppressWarnings("unchecked")
|
||||||
|
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,7 +1993,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
@SuppressWarnings("unchecked")
|
||||||
|
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||||
int inp;
|
int inp;
|
||||||
try {
|
try {
|
||||||
inp = Integer.parseInt(input);
|
inp = Integer.parseInt(input);
|
||||||
@ -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,7 +2386,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
|
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
@ -2430,7 +2443,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
|
|
||||||
String text = GOLD + Lang.get("eventEditorPotionEffectsTitle") + "\n";
|
String text = GOLD + Lang.get("eventEditorPotionEffectsTitle") + "\n";
|
||||||
@ -2479,7 +2493,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("1")) {
|
if (input.equalsIgnoreCase("1")) {
|
||||||
@ -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(",");
|
||||||
|
Loading…
Reference in New Issue
Block a user