34 lines
734 B
Java
34 lines
734 B
Java
package net.saltymc.eaa.custom.ping;
|
|
|
|
import net.saltymc.eaa.util.database.DB_Tag;
|
|
|
|
import static net.saltymc.eaa.custom.ping.PingColors.computeOffset;
|
|
|
|
public class TagDTO {
|
|
final int gradeColor;
|
|
final DB_Tag.Type type;
|
|
|
|
public TagDTO(int grade, DB_Tag.Type type) {
|
|
this.gradeColor = calcGradient(grade);
|
|
this.type = type;
|
|
}
|
|
|
|
public int getGradeColor() {
|
|
return gradeColor;
|
|
}
|
|
|
|
public DB_Tag.Type getType() {
|
|
return type;
|
|
}
|
|
|
|
private static int calcGradient(int grade){
|
|
if (grade < 1)
|
|
return 0xaaaaaa;
|
|
|
|
return ColorUtil.interpolate(
|
|
0x00ff00,
|
|
0xff0000,
|
|
computeOffset(0, 10, grade));
|
|
}
|
|
}
|