add new Tag, Use Style instead of Textformating, implement grade indicator, fix offset
This commit is contained in:
parent
9af6f4c073
commit
dead4f21a8
7 changed files with 62 additions and 29 deletions
|
@ -4,7 +4,9 @@ import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TextColor;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.saltymc.eaa.util.database.DB_Player;
|
||||
import net.saltymc.eaa.util.database.DB_Tag;
|
||||
|
@ -57,7 +59,7 @@ public class CheckFunction {
|
|||
|
||||
source.sendFeedback(new LiteralText(dateformat.format(curr.getTagDate())).formatted(Formatting.GRAY)
|
||||
.append(new LiteralText(" | "))
|
||||
.append(new LiteralText(curr.getType().getTag()).formatted(curr.getType().getFormatting()))
|
||||
.append(new LiteralText(curr.getType().getTag()).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(curr.getType().getColor()))))
|
||||
.append(new LiteralText(" (" + curr.getGrade() + ") ").formatted(getScaleFormat(curr.getGrade())))
|
||||
);
|
||||
}
|
||||
|
@ -71,7 +73,7 @@ public class CheckFunction {
|
|||
}
|
||||
}
|
||||
|
||||
private static Formatting getScaleFormat(int grade){
|
||||
public static Formatting getScaleFormat(int grade){
|
||||
if (grade <= 5)
|
||||
return Formatting.WHITE;
|
||||
else if (grade < 9)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package net.saltymc.eaa.function;
|
||||
|
||||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
import net.saltymc.eaa.custom.ping.TagDTO;
|
||||
import net.saltymc.eaa.util.database.DB_Player;
|
||||
import net.saltymc.eaa.util.database.DB_Tag;
|
||||
import net.saltymc.eaa.util.mojangApi.PlayerInfo;
|
||||
|
@ -23,16 +23,18 @@ public class TagFunction {
|
|||
}
|
||||
}
|
||||
|
||||
public static DB_Tag.Type getScoreboardTag(String uuid){
|
||||
if (player_tags.containsKey(uuid))
|
||||
return player_tags.get(uuid).getType();
|
||||
else {
|
||||
public static TagDTO getScoreboardTag(String uuid){
|
||||
if (player_tags.containsKey(uuid)) {
|
||||
DB_Tag tag = player_tags.get(uuid);
|
||||
return new TagDTO(tag.getGrade(), tag.getType());
|
||||
|
||||
} else {
|
||||
if (free) {
|
||||
free = false;
|
||||
loadPlayer(uuid, false);
|
||||
}
|
||||
}
|
||||
return DB_Tag.Type.NOTLOADED;
|
||||
return new TagDTO(-1, DB_Tag.Type.NOTLOADED);
|
||||
}
|
||||
|
||||
public static void tagPlayer(String player, DB_Tag.Type tag, int grade, FabricClientCommandSource source){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue