package com.yaohun.storyline.util;

import org.bukkit.command.CommandSender;

public class QuestShow {

    public static StringBuilder ShowString(int present,int require,int length){
        String color = "§7";
        if(present >= 1){
            color = "§a";
        }
        int lost_durability = present * length / require;
        StringBuilder builder = new StringBuilder(color);
        for (int i = 0; i < lost_durability; i++) {
            builder.append('|');
        }
        if (lost_durability > 0) {
            builder.append("§7");
        }
        for (int i = 0; i < length - lost_durability; i++) {
            builder.append('|');
        }
        return builder;
    }

    public static void Show(CommandSender sender, String name, int present, int require){
        sender.sendMessage("§f任务: §e"+name+"  §f当前进度: "+ShowString(present,require,15)+" §f[§6"+present+"§f/§6"+require+"§f]");
    }
}
