Added game data and menu

This commit is contained in:
Luca 2021-11-23 13:34:45 +01:00
parent 1775f11016
commit 031874bc41
7 changed files with 45 additions and 9 deletions

View File

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

View File

@ -14,6 +14,7 @@ import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.events.GameEndEvent;
import rip.tilly.bedwars.events.GameStartEvent;
import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem;
import rip.tilly.bedwars.playerdata.PlayerCurrentGameData;
import rip.tilly.bedwars.playerdata.PlayerData;
import rip.tilly.bedwars.playerdata.PlayerState;
import rip.tilly.bedwars.utils.ItemBuilder;
@ -209,12 +210,32 @@ public class GameManager {
this.plugin.getPlayerDataManager().resetPlayer(player, true);
}
public List<ItemStack> getGameItems() {
public List<ItemStack> getGameItems(PlayerCurrentGameData currentGameData) {
List<ItemStack> allItems = new ArrayList<>();
ItemStack sword = new ItemBuilder(Material.WOOD_SWORD).build();
allItems.add(sword);
if (currentGameData.isShears()) {
ItemStack shears = new ItemBuilder(Material.SHEARS).build();
allItems.add(shears);
}
if (currentGameData.getAxeLevel() > 0) {
if (currentGameData.getAxeLevel() == 1) {
}
if (currentGameData.getAxeLevel() == 1) {
}
if (currentGameData.getAxeLevel() == 1) {
}
if (currentGameData.getAxeLevel() == 1) {
}
}
return allItems;
}

View File

@ -68,6 +68,7 @@ public class PlayAGameMenu extends Menu {
@Override
public void clicked(Player player, int slot, ClickType clickType, int hotbarButton) {
BedWars.getInstance().getQueueManager().addPlayerToQueue(player, BedWars.getInstance().getPlayerDataManager().getPlayerData(player.getUniqueId()), gameType);
playNeutral(player);
}
}
}

View File

@ -0,0 +1,14 @@
package rip.tilly.bedwars.playerdata;
import lombok.Data;
@Data
public class PlayerCurrentGameData {
private int gameKills;
private int gameBedsDestroyed;
private int pickaxeLevel = 0;
private int axeLevel = 0;
private boolean shears = false;
}

View File

@ -18,6 +18,7 @@ public class PlayerData {
private PlayerState playerState = PlayerState.SPAWN;
private PlayerSettings playerSettings = new PlayerSettings();
private PlayerCurrentGameData currentGameData = new PlayerCurrentGameData();
private PlayerTeam playerTeam;
@ -37,8 +38,6 @@ public class PlayerData {
private int bedsDestroyed;
private Player lastDamager;
private int gameKills;
private int gameBedsDestroyed;
public PlayerData(UUID uniqueId) {
this.uniqueId = uniqueId;

View File

@ -221,7 +221,7 @@ public class ScoreboardProvider implements BoardAdapter {
if (yourTeam.isHasBed()) {
lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &a&l✓ &7(You)");
} else if (yourTeam.getPlayingPlayers().size() > 0) {
lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &f" + yourTeam.getPlayingPlayers().size() + " &7(YOU)");
lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &f" + yourTeam.getPlayingPlayers().size() + " &7(You)");
} else {
lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &c&l✗ &7(You)");
}
@ -233,8 +233,8 @@ public class ScoreboardProvider implements BoardAdapter {
lines.add("&7[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&7] &c&l✗");
}
lines.add(" ");
lines.add("&fKills: &d" + playerData.getGameKills());
lines.add("&fBeds Destroyed: &d" + playerData.getGameBedsDestroyed());
lines.add("&fKills: &d" + playerData.getCurrentGameData().getGameKills());
lines.add("&fBeds Destroyed: &d" + playerData.getCurrentGameData().getGameBedsDestroyed());
lines.add(" ");
lines.add("&dtilly.rip");
lines.add(CC.scoreboardBar);

View File

@ -47,7 +47,7 @@ public class RespawnRunnable extends BukkitRunnable {
this.player.playSound(this.player.getLocation(), Sound.ORB_PICKUP, 10F, 1F);
this.player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData));
for (ItemStack stack : this.plugin.getGameManager().getGameItems()) {
for (ItemStack stack : this.plugin.getGameManager().getGameItems(this.playerData.getCurrentGameData())) {
this.player.getInventory().addItem(stack);
}
@ -70,6 +70,7 @@ public class RespawnRunnable extends BukkitRunnable {
this.game.getTeams().forEach(team -> team.playingPlayers().forEach(gamePlayer -> gamePlayer.hidePlayer(this.player)));
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
this. player.updateInventory();
this.player.setHealth(this.player.getMaxHealth());