com.sucy.skill.data.CustomScoreboardHolder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proskillapi Show documentation
Show all versions of proskillapi Show documentation
A Minecraft Bukkit plugin aiming to provide an easy code API and skill editor for all server owners to
create unique and fully custom classes and skills.
package com.sucy.skill.data;
import com.sucy.skill.SkillAPI;
import com.sucy.skill.util.PlaceholderUtil;
import mc.promcteam.engine.mccore.scoreboard.StatHolder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class CustomScoreboardHolder implements StatHolder {
private List format;
private UUID id;
public CustomScoreboardHolder(Player player) {
this.id = player.getUniqueId();
format = SkillAPI.getSettings().getScoreboardFormat();
}
@Override
public List getNames() {
Player player = Bukkit.getPlayer(id);
List formattedLines = PlaceholderUtil.colorizeAndReplace(format, player)
.stream()
// .map(s -> {
// return
// s.length() > 16 ? s.substring(0, 16) :
// s;
// })
.collect(Collectors.toList());
return formattedLines;
}
@Override
public List getValues() {
// Return a list just counting down from to zero from the number of lines
List values = new ArrayList<>();
for (int i = format.size(); i > 0; i--) {
values.add(i);
}
return values;
}
}