e
This commit is contained in:
parent
e27dc75b18
commit
e7b43febac
@ -50,15 +50,13 @@ public class PlayerCurrentGameData {
|
||||
return upgrade.getCostForLevel(this.upgrades.getOrDefault(upgrade, 0) + 1);
|
||||
}
|
||||
|
||||
public void upgrade(Player player, Game game, Upgrade upgrade) {
|
||||
public void upgrade(Player player, Game game, GameTeam gameTeam, Upgrade upgrade) {
|
||||
this.upgrades.put(upgrade, this.upgrades.getOrDefault(upgrade, 0) + 1);
|
||||
|
||||
int level = this.upgrades.get(upgrade);
|
||||
|
||||
GameTeam gameTeam = game.getTeams().get(this.teamId);
|
||||
|
||||
game.getTeams().stream().filter(team -> team == gameTeam).forEach(team -> team.playingPlayers().forEach(teamMember -> {
|
||||
teamMember.sendMessage(CC.translate("&6" + player.getName() + " upgraded " + upgrade.getFormattedName() + " to &cTier " + upgrade.getNumberToRomanNumeral(level)));
|
||||
gameTeam.playingPlayers().forEach(teamPlayer -> {
|
||||
teamPlayer.sendMessage(CC.translate("&6" + player.getName() + " upgraded " + upgrade.getFormattedName() + " to &cTier " + upgrade.getNumberToRomanNumeral(level)));
|
||||
// System.out.println("11111111111111111111111 - " + player.getName());
|
||||
this.giveTeamArmor(player, this);
|
||||
|
||||
@ -124,7 +122,7 @@ public class PlayerCurrentGameData {
|
||||
|
||||
break;
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
public ArmorType getArmorType(Player player) {
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import rip.tilly.bedwars.game.Game;
|
||||
import rip.tilly.bedwars.game.GameTeam;
|
||||
import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData;
|
||||
import rip.tilly.bedwars.utils.CC;
|
||||
import rip.tilly.bedwars.utils.ItemBuilder;
|
||||
@ -68,7 +69,7 @@ public class UpgradeItem {
|
||||
return itemBuilder.build();
|
||||
}
|
||||
|
||||
public void buy(Player player, int level, Game game, PlayerCurrentGameData playerCurrentGameData) {
|
||||
public void buy(Player player, int level, Game game, GameTeam gameTeam, PlayerCurrentGameData playerCurrentGameData) {
|
||||
if (!this.canBuy(player, level)) {
|
||||
return;
|
||||
}
|
||||
@ -96,7 +97,7 @@ public class UpgradeItem {
|
||||
}
|
||||
}
|
||||
|
||||
playerCurrentGameData.upgrade(player, game, this.upgrade);
|
||||
playerCurrentGameData.upgrade(player, game, gameTeam, this.upgrade);
|
||||
}
|
||||
|
||||
public boolean canBuy(Player player, int level) {
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import rip.tilly.bedwars.BedWars;
|
||||
import rip.tilly.bedwars.game.Game;
|
||||
import rip.tilly.bedwars.game.GameTeam;
|
||||
import rip.tilly.bedwars.playerdata.PlayerData;
|
||||
import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData;
|
||||
import rip.tilly.bedwars.upgrades.Upgrade;
|
||||
@ -64,7 +65,7 @@ public class UpgradesMenu extends Menu {
|
||||
}
|
||||
|
||||
if (upgradeItem.canBuy(player, playerCurrentGameData.getLevelForUpgrade(upgradeItem.getUpgrade()) + 1)) {
|
||||
upgradeItem.buy(player, playerCurrentGameData.getLevelForUpgrade(upgradeItem.getUpgrade()) + 1, game, playerCurrentGameData);
|
||||
upgradeItem.buy(player, playerCurrentGameData.getLevelForUpgrade(upgradeItem.getUpgrade()) + 1, game, game.getTeams().get(playerCurrentGameData.getTeamId()), playerCurrentGameData);
|
||||
|
||||
player.updateInventory();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user