This commit is contained in:
Trixkz 2021-11-22 13:14:11 -05:00
commit 91ef781de0
3 changed files with 21 additions and 4 deletions

View File

@ -99,6 +99,7 @@ public class DamageListener implements Listener {
playerData.setLastDamager(damager); playerData.setLastDamager(damager);
double health = player.getHealth() - event.getFinalDamage(); double health = player.getHealth() - event.getFinalDamage();
if (health < 0) { if (health < 0) {
event.setCancelled(true);
this.plugin.getServer().getPluginManager().callEvent(new PlayerKillEvent(player, damager)); this.plugin.getServer().getPluginManager().callEvent(new PlayerKillEvent(player, damager));
} }

View File

@ -33,6 +33,7 @@ public class GameEndListener implements Listener {
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId()); PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId());
playerData.setLastDamager(null); playerData.setLastDamager(null);
playerData.setGameKills(0); playerData.setGameKills(0);
playerData.setGameBedsDestroyed(0);
String winnerTitle = CC.translate("&aVICTORY!"); String winnerTitle = CC.translate("&aVICTORY!");
String losingTitle = CC.translate("&cDEFEAT!"); String losingTitle = CC.translate("&cDEFEAT!");

View File

@ -10,6 +10,7 @@ import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.playerdata.PlayerData;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
import java.util.List; import java.util.List;
@ -34,19 +35,33 @@ public class TablistProvider implements TabAdapter {
int column = 0; int column = 0;
int row = 0; int row = 0;
for (Player online : Bukkit.getOnlinePlayers()) { for (Player online : Bukkit.getOnlinePlayers()) {
GameProfile skin = ((CraftPlayer) online).getProfile(); if (online == null) {
Property property = skin.getProperties().get("textures").stream().findFirst().orElse(null); break;
lines.add(new TabEntry(column, row, player.getDisplayName()).setPing(((CraftPlayer) online).getHandle().ping).setSkin(new Skin(property.getValue(), property.getSignature()))); }
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) { if (column++ < 2) {
continue; continue;
} }
column = 0; column = 0;
if (row++ < 19) { if (row++ < 19) {
continue; continue;
} }
row = 0; 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());
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; return lines;
} }
} }