mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-13 22:25:50 +01:00
Suppress null string on item requirement after setting GUI display
This commit is contained in:
parent
d90f548bed
commit
62ccaa1d4a
@ -644,27 +644,33 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||||
switch (number) {
|
switch (number) {
|
||||||
case 1:
|
case 1:
|
||||||
if (context.getSessionData(CK.REQ_ITEMS) != null) {
|
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
||||||
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
|
} else {
|
||||||
String text = "\n";
|
String text = "\n";
|
||||||
for (final ItemStack is : getItems(context)) {
|
for (final ItemStack is : (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS)) {
|
||||||
|
if (is == null) {
|
||||||
|
// TODO - Find out why this happens after first setting GUI Display
|
||||||
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
|
}
|
||||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
case 2:
|
case 2:
|
||||||
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("reqNoItemsSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
if (context.getSessionData(CK.REQ_ITEMS_REMOVE) == null) {
|
if (context.getSessionData(CK.REQ_ITEMS_REMOVE) == null) {
|
||||||
return ChatColor.YELLOW + "(" + Lang.get("reqNoValuesSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
String text = "\n";
|
String text = "\n";
|
||||||
for (final Boolean b : getRemoveItems(context)) {
|
for (final Boolean b : (List<Boolean>) context.getSessionData(CK.REQ_ITEMS_REMOVE)) {
|
||||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA
|
text += ChatColor.GRAY + " - " + ChatColor.AQUA
|
||||||
+ (b.equals(Boolean.TRUE) ? Lang.get("yesWord") : Lang.get("noWord")) + "\n";
|
+ (b.equals(Boolean.TRUE) ? Lang.get("yesWord") : Lang.get("noWord")) + "\n";
|
||||||
}
|
}
|
||||||
@ -679,12 +685,13 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(final ConversationContext context) {
|
public String getPromptText(final ConversationContext context) {
|
||||||
// Check/add newly made item
|
// Check/add newly made item
|
||||||
if (context.getSessionData("newItem") != null) {
|
if (context.getSessionData("newItem") != null) {
|
||||||
if (context.getSessionData(CK.REQ_ITEMS) != null) {
|
if (context.getSessionData(CK.REQ_ITEMS) != null) {
|
||||||
final List<ItemStack> itemReqs = getItems(context);
|
final List<ItemStack> itemReqs = (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS);
|
||||||
itemReqs.add((ItemStack) context.getSessionData("tempStack"));
|
itemReqs.add((ItemStack) context.getSessionData("tempStack"));
|
||||||
context.setSessionData(CK.REQ_ITEMS, itemReqs);
|
context.setSessionData(CK.REQ_ITEMS, itemReqs);
|
||||||
} else {
|
} else {
|
||||||
@ -750,15 +757,15 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
/*@SuppressWarnings("unchecked")
|
||||||
private List<ItemStack> getItems(final ConversationContext context) {
|
private List<ItemStack> getItems(final ConversationContext context) {
|
||||||
return (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS);
|
return (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
/*@SuppressWarnings("unchecked")
|
||||||
private List<Boolean> getRemoveItems(final ConversationContext context) {
|
private List<Boolean> getRemoveItems(final ConversationContext context) {
|
||||||
return (List<Boolean>) context.getSessionData(CK.REQ_ITEMS_REMOVE);
|
return (List<Boolean>) context.getSessionData(CK.REQ_ITEMS_REMOVE);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RemoveItemsPrompt extends QuestsEditorStringPrompt {
|
public class RemoveItemsPrompt extends QuestsEditorStringPrompt {
|
||||||
|
@ -683,7 +683,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else {
|
} else {
|
||||||
String text = "\n";
|
String text = "\n";
|
||||||
for (final ItemStack is : (List<ItemStack>) context.getSessionData(CK.REW_ITEMS)) {
|
for (final ItemStack is : (List<ItemStack>) context.getSessionData(CK.REW_ITEMS)) {
|
||||||
text += ChatColor.GRAY + "- " + ItemUtil.getDisplayString(is) + "\n";
|
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@ -713,7 +713,8 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData("tempStack", null);
|
context.setSessionData("tempStack", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
final QuestsEditorPostOpenNumericPromptEvent event
|
||||||
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.AQUA + getTitle(context);
|
String text = ChatColor.AQUA + getTitle(context);
|
||||||
|
@ -455,8 +455,6 @@ reqHeroesPrimaryPrompt: "Enter a Heroes Primary Class name, <clear>, <cancel>"
|
|||||||
reqHeroesSecondaryPrompt: "Enter a Heroes Secondary Class name, <clear>, <cancel>"
|
reqHeroesSecondaryPrompt: "Enter a Heroes Secondary Class name, <clear>, <cancel>"
|
||||||
reqAddItem: "Add item"
|
reqAddItem: "Add item"
|
||||||
reqSetRemoveItems: "Set remove items"
|
reqSetRemoveItems: "Set remove items"
|
||||||
reqNoItemsSet: "No items set"
|
|
||||||
reqNoValuesSet: "No values set"
|
|
||||||
reqHeroesPrimaryDisplay: "Primary Class:"
|
reqHeroesPrimaryDisplay: "Primary Class:"
|
||||||
reqHeroesSecondaryDisplay: "Secondary Class:"
|
reqHeroesSecondaryDisplay: "Secondary Class:"
|
||||||
reqNotAQuestName: "<quest> is not a quest name!"
|
reqNotAQuestName: "<quest> is not a quest name!"
|
||||||
|
Loading…
Reference in New Issue
Block a user