Split quest tasks in the lore if they get too long

This commit is contained in:
Spencer 2018-01-04 19:30:37 -05:00 committed by Alexander Meech
parent 010d31bd9e
commit 0ea229a8b4

View File

@ -1,6 +1,7 @@
package mineplex.core.quests.shop;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.bukkit.ChatColor;
@ -13,6 +14,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory;
@ -81,8 +84,9 @@ public class QuestPage extends ShopPageBase<QuestManager, QuestShop>
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + quest.getName());
meta.setLore(Arrays.asList(
ChatColor.LIGHT_PURPLE + quest.getTask(),
List<String> lore = UtilText.splitLine(ChatColor.LIGHT_PURPLE + quest.getTask(), LineFormat.LORE);
lore.addAll(Arrays.asList(
"",
ChatColor.GRAY + "Cost: " + ChatColor.GREEN + quest.getCost() + " Gems",
ChatColor.GRAY + "Reward: " + ChatColor.AQUA + quest.getRewardAmount() + " " + quest.getRewardName(),
@ -90,7 +94,9 @@ public class QuestPage extends ShopPageBase<QuestManager, QuestShop>
quest.getRarity().getColor() + "" + ChatColor.BOLD + quest.getRarity().toString(),
"",
ChatColor.GREEN + "Click to buy " + QuestManager.QUEST_NAME + "!"
));
));
meta.setLore(lore);
item.setItemMeta(meta);
addButton(i + currentSlot, item, new BuyQuestButton(_manager, this, quest));