diff --git a/src/main/java/rip/tilly/bedwars/providers/tablist/TablistProvider.java b/src/main/java/rip/tilly/bedwars/providers/tablist/TablistProvider.java index a5b2b97..2e6adc1 100644 --- a/src/main/java/rip/tilly/bedwars/providers/tablist/TablistProvider.java +++ b/src/main/java/rip/tilly/bedwars/providers/tablist/TablistProvider.java @@ -10,8 +10,10 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import rip.tilly.bedwars.BedWars; +import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.utils.CC; +import java.text.DecimalFormat; import java.util.List; public class TablistProvider implements TabAdapter { @@ -34,19 +36,34 @@ public class TablistProvider implements TabAdapter { int column = 0; int row = 0; for (Player online : Bukkit.getOnlinePlayers()) { - GameProfile skin = ((CraftPlayer) online).getProfile(); - Property property = skin.getProperties().get("textures").stream().findFirst().orElse(null); - lines.add(new TabEntry(column, row, player.getDisplayName()).setPing(((CraftPlayer) online).getHandle().ping).setSkin(new Skin(property.getValue(), property.getSignature()))); + if (online == null) { + break; + } + GameProfile onlineSkin = ((CraftPlayer) online).getProfile(); + Property onlineProperty = onlineSkin.getProperties().get("textures").stream().findFirst().orElse(null); + + assert onlineProperty != null; + lines.add(new TabEntry(column, row, online.getDisplayName()).setPing(((CraftPlayer) online).getHandle().ping).setSkin(new Skin(onlineProperty.getValue(), onlineProperty.getSignature()))); if (column++ < 2) { continue; } column = 0; - if (row++ < 19) { continue; } row = 0; } + + GameProfile skin = ((CraftPlayer) player).getProfile(); + Property property = skin.getProperties().get("textures").stream().findFirst().orElse(null); + + PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId()); + DecimalFormat decimalFormat = new DecimalFormat("0.00"); + + lines.add(new TabEntry(3, 2, CC.translate("&d&lYour Profile")).setPing(-1).setSkin(new Skin(property.getValue(), property.getSignature()))); + lines.add(new TabEntry(3, 3, CC.translate(" &fKills: &d" + playerData.getKills())).setPing(-1)); + lines.add(new TabEntry(3, 4, CC.translate(" &fDeaths: &d" + playerData.getDeaths())).setPing(-1)); + return lines; } }