Limit GUI item displays. Revert fdc78970f5

This commit is contained in:
PikaMug 2020-02-11 06:53:50 -05:00
parent fdc78970f5
commit 2bf09c97a9
2 changed files with 16 additions and 15 deletions

View File

@ -3403,23 +3403,26 @@ public class Quester {
return; return;
} }
Player player = getPlayer(); Player player = getPlayer();
int size = ((quests.size() / 9) + 1) * 9; Inventory inv = plugin.getServer().createInventory(player, ((quests.size() / 9) + 1) * 9,
Inventory inv = plugin.getServer().createInventory(player, size, Lang.get(player, "quests") + " | " Lang.get(player, "quests") + " | " + npc.getName());
+ npc.getName()); int i = 0;
int inc = 0; for (Quest quest : quests) {
for (int i = 0; i < quests.size(); i++) { if (quest.guiDisplay != null) {
if (quests.get(i).guiDisplay != null) { if (i > 53) {
ItemStack display = quests.get(i).guiDisplay; // Protocol-enforced size limit has been exceeded
break;
}
ItemStack display = quest.guiDisplay;
ItemMeta meta = display.getItemMeta(); ItemMeta meta = display.getItemMeta();
if (completedQuests.contains(quests.get(i).getName())) { if (completedQuests.contains(quest.getName())) {
meta.setDisplayName(ChatColor.DARK_PURPLE + ConfigUtil.parseString(quests.get(i).getName() meta.setDisplayName(ChatColor.DARK_PURPLE + ConfigUtil.parseString(quest.getName()
+ " " + ChatColor.GREEN + Lang.get(player, "redoCompleted"), npc)); + " " + ChatColor.GREEN + Lang.get(player, "redoCompleted"), npc));
} else { } else {
meta.setDisplayName(ChatColor.DARK_PURPLE + ConfigUtil.parseString(quests.get(i).getName(), npc)); meta.setDisplayName(ChatColor.DARK_PURPLE + ConfigUtil.parseString(quest.getName(), npc));
} }
if (!meta.hasLore()) { if (!meta.hasLore()) {
LinkedList<String> lines = new LinkedList<String>(); LinkedList<String> lines = new LinkedList<String>();
String desc = quests.get(i).description; String desc = quest.description;
if (desc.equals(ChatColor.stripColor(desc))) { if (desc.equals(ChatColor.stripColor(desc))) {
lines = MiscUtil.makeLines(desc, " ", 40, ChatColor.DARK_GREEN); lines = MiscUtil.makeLines(desc, " ", 40, ChatColor.DARK_GREEN);
} else { } else {
@ -3428,8 +3431,8 @@ public class Quester {
meta.setLore(lines); meta.setLore(lines);
} }
display.setItemMeta(meta); display.setItemMeta(meta);
inv.setItem(inc, display); inv.setItem(i, display);
inc++; i++;
} }
} }
player.openInventory(inv); player.openInventory(inv);

View File

@ -664,8 +664,6 @@ questQuitDisabled: "Quitting this quest has been disabled."
questsUnknownCommand: "Unknown Quests command. Type /quests for help." questsUnknownCommand: "Unknown Quests command. Type /quests for help."
pageNotExist: "Page does not exist." pageNotExist: "Page does not exist."
pageFooter: "- Page <current> of <all> -" pageFooter: "- Page <current> of <all> -"
pagePrevious: "< Prev"
pageNext: "Next >"
questsReloaded: "Quests reloaded." questsReloaded: "Quests reloaded."
numQuestsLoaded: "<number> Quests loaded." numQuestsLoaded: "<number> Quests loaded."
questForceTake: "<player> has forcibly started the Quest <quest>." questForceTake: "<player> has forcibly started the Quest <quest>."