Added game data and menu
This commit is contained in:
parent
1775f11016
commit
031874bc41
@ -37,8 +37,8 @@ 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.getCurrentGameData().setGameKills(0);
|
||||||
playerData.setGameBedsDestroyed(0);
|
playerData.getCurrentGameData().setGameBedsDestroyed(0);
|
||||||
|
|
||||||
String winnerTitle = CC.translate("&aVICTORY!");
|
String winnerTitle = CC.translate("&aVICTORY!");
|
||||||
String losingTitle = CC.translate("&cDEFEAT!");
|
String losingTitle = CC.translate("&cDEFEAT!");
|
||||||
|
@ -14,6 +14,7 @@ import rip.tilly.bedwars.game.arena.Arena;
|
|||||||
import rip.tilly.bedwars.events.GameEndEvent;
|
import rip.tilly.bedwars.events.GameEndEvent;
|
||||||
import rip.tilly.bedwars.events.GameStartEvent;
|
import rip.tilly.bedwars.events.GameStartEvent;
|
||||||
import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem;
|
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.PlayerData;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerState;
|
import rip.tilly.bedwars.playerdata.PlayerState;
|
||||||
import rip.tilly.bedwars.utils.ItemBuilder;
|
import rip.tilly.bedwars.utils.ItemBuilder;
|
||||||
@ -209,12 +210,32 @@ public class GameManager {
|
|||||||
this.plugin.getPlayerDataManager().resetPlayer(player, true);
|
this.plugin.getPlayerDataManager().resetPlayer(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getGameItems() {
|
public List<ItemStack> getGameItems(PlayerCurrentGameData currentGameData) {
|
||||||
List<ItemStack> allItems = new ArrayList<>();
|
List<ItemStack> allItems = new ArrayList<>();
|
||||||
|
|
||||||
ItemStack sword = new ItemBuilder(Material.WOOD_SWORD).build();
|
ItemStack sword = new ItemBuilder(Material.WOOD_SWORD).build();
|
||||||
allItems.add(sword);
|
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;
|
return allItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ public class PlayAGameMenu extends Menu {
|
|||||||
@Override
|
@Override
|
||||||
public void clicked(Player player, int slot, ClickType clickType, int hotbarButton) {
|
public void clicked(Player player, int slot, ClickType clickType, int hotbarButton) {
|
||||||
BedWars.getInstance().getQueueManager().addPlayerToQueue(player, BedWars.getInstance().getPlayerDataManager().getPlayerData(player.getUniqueId()), gameType);
|
BedWars.getInstance().getQueueManager().addPlayerToQueue(player, BedWars.getInstance().getPlayerDataManager().getPlayerData(player.getUniqueId()), gameType);
|
||||||
|
playNeutral(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
@ -18,6 +18,7 @@ public class PlayerData {
|
|||||||
private PlayerState playerState = PlayerState.SPAWN;
|
private PlayerState playerState = PlayerState.SPAWN;
|
||||||
|
|
||||||
private PlayerSettings playerSettings = new PlayerSettings();
|
private PlayerSettings playerSettings = new PlayerSettings();
|
||||||
|
private PlayerCurrentGameData currentGameData = new PlayerCurrentGameData();
|
||||||
|
|
||||||
private PlayerTeam playerTeam;
|
private PlayerTeam playerTeam;
|
||||||
|
|
||||||
@ -37,8 +38,6 @@ public class PlayerData {
|
|||||||
private int bedsDestroyed;
|
private int bedsDestroyed;
|
||||||
|
|
||||||
private Player lastDamager;
|
private Player lastDamager;
|
||||||
private int gameKills;
|
|
||||||
private int gameBedsDestroyed;
|
|
||||||
|
|
||||||
public PlayerData(UUID uniqueId) {
|
public PlayerData(UUID uniqueId) {
|
||||||
this.uniqueId = uniqueId;
|
this.uniqueId = uniqueId;
|
||||||
|
@ -221,7 +221,7 @@ public class ScoreboardProvider implements BoardAdapter {
|
|||||||
if (yourTeam.isHasBed()) {
|
if (yourTeam.isHasBed()) {
|
||||||
lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &a&l✓ &7(You)");
|
lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &a&l✓ &7(You)");
|
||||||
} else if (yourTeam.getPlayingPlayers().size() > 0) {
|
} 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 {
|
} else {
|
||||||
lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &c&l✗ &7(You)");
|
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("&7[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&7] &c&l✗");
|
||||||
}
|
}
|
||||||
lines.add(" ");
|
lines.add(" ");
|
||||||
lines.add("&fKills: &d" + playerData.getGameKills());
|
lines.add("&fKills: &d" + playerData.getCurrentGameData().getGameKills());
|
||||||
lines.add("&fBeds Destroyed: &d" + playerData.getGameBedsDestroyed());
|
lines.add("&fBeds Destroyed: &d" + playerData.getCurrentGameData().getGameBedsDestroyed());
|
||||||
lines.add(" ");
|
lines.add(" ");
|
||||||
lines.add("&dtilly.rip");
|
lines.add("&dtilly.rip");
|
||||||
lines.add(CC.scoreboardBar);
|
lines.add(CC.scoreboardBar);
|
||||||
|
@ -47,7 +47,7 @@ public class RespawnRunnable extends BukkitRunnable {
|
|||||||
this.player.playSound(this.player.getLocation(), Sound.ORB_PICKUP, 10F, 1F);
|
this.player.playSound(this.player.getLocation(), Sound.ORB_PICKUP, 10F, 1F);
|
||||||
|
|
||||||
this.player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData));
|
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);
|
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.game.getTeams().forEach(team -> team.playingPlayers().forEach(gamePlayer -> gamePlayer.hidePlayer(this.player)));
|
||||||
|
|
||||||
this.player.getInventory().clear();
|
this.player.getInventory().clear();
|
||||||
|
this.player.getInventory().setArmorContents(null);
|
||||||
this. player.updateInventory();
|
this. player.updateInventory();
|
||||||
|
|
||||||
this.player.setHealth(this.player.getMaxHealth());
|
this.player.setHealth(this.player.getMaxHealth());
|
||||||
|
Loading…
Reference in New Issue
Block a user