use of com.ebicep.warlords.game.Game in project Warlords by ebicep.
the class DebugMenuPlayerOptions method openPlayerMenu.
public static void openPlayerMenu(Player player, WarlordsPlayer target) {
if (target == null)
return;
String targetName = target.getName();
Menu menu = new Menu("Player Options: " + targetName, 9 * 5);
ItemStack[] firstRow = { new ItemBuilder(Material.EXP_BOTTLE).name(ChatColor.GREEN + "Energy").get(), new ItemBuilder(Material.INK_SACK, 1, (byte) 8).name(ChatColor.GREEN + "Cooldown").get(), new ItemBuilder(Material.DIAMOND_CHESTPLATE).name(ChatColor.GREEN + "Damage").get(), new ItemBuilder(Material.RABBIT_FOOT).name(ChatColor.GREEN + "Crits").get(), new ItemBuilder(Material.AIR).get(), new ItemBuilder(new Potion(PotionType.INSTANT_DAMAGE), 1, true).name(ChatColor.GREEN + "Kill").flags(ItemFlag.HIDE_POTION_EFFECTS).get(), new ItemBuilder(Material.WOOL, 1, (short) (Warlords.getPlayerSettings(player.getUniqueId()).getWantedTeam() == Team.BLUE ? 14 : 11)).name(ChatColor.GREEN + "Swap to the " + (Warlords.getPlayerSettings(player.getUniqueId()).getWantedTeam() == Team.BLUE ? Team.RED.coloredPrefix() : Team.BLUE.coloredPrefix()) + ChatColor.GREEN + " team").get() };
ItemStack[] secondRow = { new ItemBuilder(Material.SUGAR).name(ChatColor.GREEN + "Modify Speed").get(), new ItemBuilder(new Potion(PotionType.INSTANT_HEAL), 1, true).name(ChatColor.GREEN + "Add Health").flags(ItemFlag.HIDE_POTION_EFFECTS).get(), new ItemBuilder(Material.DIAMOND_SWORD).name(ChatColor.GREEN + "Take Damage").flags(ItemFlag.HIDE_ATTRIBUTES).get(), new ItemBuilder(Material.BREWING_STAND_ITEM).name(ChatColor.GREEN + "Cooldowns").get(), new ItemBuilder(Material.EYE_OF_ENDER).name(ChatColor.GREEN + "Teleport To").get(), new ItemBuilder(Material.BANNER).name(ChatColor.GREEN + "Flag Options").get(), new ItemBuilder(Material.NETHER_STAR).name(ChatColor.GREEN + "Change Spec").get() };
for (int i = 0; i < firstRow.length; i++) {
int index = i + 1;
menu.setItem(index, 1, firstRow[i], (m, e) -> {
switch(index) {
case 1:
Bukkit.getServer().dispatchCommand(player, "wl energy " + (target.isInfiniteEnergy() ? "enable" : "disable") + " " + targetName);
break;
case 2:
Bukkit.getServer().dispatchCommand(player, "wl cooldown " + (target.isDisableCooldowns() ? "enable" : "disable") + " " + targetName);
break;
case 3:
Bukkit.getServer().dispatchCommand(player, "wl damage " + (target.isTakeDamage() ? "disable" : "enable") + " " + targetName);
break;
case 4:
Bukkit.getServer().dispatchCommand(player, "wl crits " + (target.isCanCrit() ? "disable" : "enable") + " " + targetName);
break;
case 6:
Bukkit.getServer().dispatchCommand(player, "kill " + targetName);
break;
case 7:
Game game = target.getGame();
Team currentTeam = target.getTeam();
Team otherTeam = target.getTeam().enemy();
game.setPlayerTeam(player, otherTeam);
target.setTeam(otherTeam);
target.getGameState().updatePlayerName(target);
Warlords.getPlayerSettings(target.getUuid()).setWantedTeam(otherTeam);
LobbyLocationMarker randomLobbyLocation = LobbyLocationMarker.getRandomLobbyLocation(game, otherTeam);
if (randomLobbyLocation != null) {
Location teleportDestination = MapSymmetryMarker.getSymmetry(game).getOppositeLocation(game, currentTeam, otherTeam, target.getLocation(), randomLobbyLocation.getLocation());
target.teleport(teleportDestination);
}
ArmorManager.resetArmor(Bukkit.getPlayer(target.getUuid()), Warlords.getPlayerSettings(target.getUuid()).getSelectedClass(), otherTeam);
player.sendMessage(ChatColor.RED + "DEV: " + currentTeam.teamColor() + target.getName() + "§a was swapped to the " + otherTeam.coloredPrefix() + " §ateam");
openPlayerMenu(player, target);
break;
}
});
}
for (int i = 0; i < secondRow.length; i++) {
int index = i + 1;
menu.setItem(index, 2, secondRow[i], (m, e) -> {
switch(index) {
case 1:
// TODO
break;
case 2:
openAmountMenu(player, target, "heal");
break;
case 3:
openAmountMenu(player, target, "takedamage");
break;
case 4:
openCooldownsMenu(player, target);
break;
case 5:
openTeleportLocations(player, target);
break;
case 6:
openFlagOptionMenu(player, target);
break;
case 7:
openSpecMenu(player, target);
break;
}
});
}
menu.setItem(3, 4, MENU_BACK, (m, e) -> {
if (player.getUniqueId() == target.getUuid()) {
DebugMenu.openDebugMenu(player);
} else {
openTeamMenu(player);
}
});
menu.setItem(4, 4, MENU_CLOSE, ACTION_CLOSE_MENU);
menu.openForPlayer(player);
}
use of com.ebicep.warlords.game.Game in project Warlords by ebicep.
the class WarlordsPlayer method addDamageInstance.
private void addDamageInstance(WarlordsDamageHealingEvent event) {
WarlordsPlayer attacker = event.getAttacker();
String ability = event.getAbility();
float min = event.getMin();
float max = event.getMax();
int critChance = event.getCritChance();
int critMultiplier = event.getCritMultiplier();
boolean ignoreReduction = event.isIgnoreReduction();
boolean isLastStandFromShield = event.isIsLastStandFromShield();
boolean isMeleeHit = ability.isEmpty();
boolean isFallDamage = ability.equals("Fall");
// Spawn Protection / Undying Army / Game State
if ((dead && !cooldownManager.checkUndyingArmy(false)) || getGameState() != getGame().getState()) {
return;
}
int initialHealth = health;
for (AbstractCooldown<?> abstractCooldown : getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.doBeforeReductionFromSelf(event);
}
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.doBeforeReductionFromAttacker(event);
}
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
critChance = abstractCooldown.addCritChanceFromAttacker(event, critChance);
critMultiplier = abstractCooldown.addCritMultiplierFromAttacker(event, critMultiplier);
}
// crit
float damageValue = (int) ((Math.random() * (max - min)) + min);
int crit = (int) ((Math.random() * (100)));
boolean isCrit = false;
if (crit <= critChance && attacker.canCrit) {
isCrit = true;
damageValue *= critMultiplier / 100f;
}
final float damageHealValueBeforeReduction = damageValue;
addAbsorbed(Math.abs(damageValue - (damageValue *= 1 - spec.getDamageResistance() / 100f)));
if (attacker == this && (isFallDamage || isMeleeHit)) {
if (isMeleeHit) {
// True damage
sendMessage(GIVE_ARROW + ChatColor.GRAY + " You took " + ChatColor.RED + Math.round(min) + ChatColor.GRAY + " melee damage.");
regenTimer = 10;
if (health - min <= 0 && !cooldownManager.checkUndyingArmy(false)) {
if (entity instanceof Player) {
PacketUtils.sendTitle((Player) entity, ChatColor.RED + "YOU DIED!", ChatColor.GRAY + "You took " + ChatColor.RED + Math.round(min) + ChatColor.GRAY + " melee damage and died.", 0, 40, 0);
}
health = 0;
die(attacker);
} else {
health -= min;
playHurtAnimation(this.entity, attacker);
}
} else {
// Fall Damage
sendMessage(GIVE_ARROW + ChatColor.GRAY + " You took " + ChatColor.RED + Math.round(damageValue) + ChatColor.GRAY + " fall damage.");
regenTimer = 10;
if (health - damageValue < 0 && !cooldownManager.checkUndyingArmy(false)) {
// Title card "YOU DIED!"
if (entity instanceof Player) {
PacketUtils.sendTitle((Player) entity, ChatColor.RED + "YOU DIED!", ChatColor.GRAY + "You took " + ChatColor.RED + Math.round(damageValue) + ChatColor.GRAY + " fall damage and died.", 0, 40, 0);
}
health = 0;
die(attacker);
} else {
health -= damageValue;
playHurtAnimation(entity, attacker);
}
addAbsorbed(Math.abs(damageValue * spec.getDamageResistance() / 100));
}
cancelHealingPowerUp();
return;
}
// Reduction before Intervene.
if (!ignoreReduction) {
// Flag carrier multiplier.
damageValue *= getFlagDamageMultiplier();
// Checks whether the player is standing in a Hammer of Light.
if (!HammerOfLight.standingInHammer(attacker, entity)) {
for (AbstractCooldown<?> abstractCooldown : getCooldownManager().getCooldownsDistinct()) {
damageValue = abstractCooldown.modifyDamageBeforeInterveneFromSelf(event, damageValue);
}
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
damageValue = abstractCooldown.modifyDamageBeforeInterveneFromAttacker(event, damageValue);
}
}
}
// Intervene
Optional<RegularCooldown> optionalInterveneCooldown = new CooldownFilter<>(this, RegularCooldown.class).filterCooldownClass(Intervene.class).filter(regularCooldown -> regularCooldown.getFrom() != this).findFirst();
if (optionalInterveneCooldown.isPresent() && !HammerOfLight.standingInHammer(attacker, entity) && isEnemy(attacker)) {
Intervene intervene = (Intervene) optionalInterveneCooldown.get().getCooldownObject();
WarlordsPlayer intervenedBy = optionalInterveneCooldown.get().getFrom();
damageValue *= .5;
intervenedBy.addAbsorbed(damageValue);
intervenedBy.setRegenTimer(10);
intervene.addDamagePrevented(damageValue);
intervenedBy.addDamageInstance(attacker, "Intervene", damageValue, damageValue, isCrit ? 100 : -1, 100, false);
Location loc = getLocation();
// EFFECTS + SOUNDS
Utils.playGlobalSound(loc, "warrior.intervene.block", 2, 1);
playHitSound(attacker);
entity.playEffect(EntityEffect.HURT);
intervenedBy.getEntity().playEffect(EntityEffect.HURT);
// Red line particle if the player gets hit
EffectUtils.playParticleLinkAnimation(getLocation(), intervenedBy.getLocation(), 255, 0, 0, 2);
// Remove horses.
removeHorse();
intervenedBy.removeHorse();
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onInterveneFromAttacker(event, damageValue);
}
} else {
// Damage reduction after Intervene
if (!ignoreReduction) {
if (!HammerOfLight.standingInHammer(attacker, entity)) {
// Example: .8 = 20% reduction.
for (AbstractCooldown<?> abstractCooldown : getCooldownManager().getCooldownsDistinct()) {
damageValue = abstractCooldown.modifyDamageAfterInterveneFromSelf(event, damageValue);
}
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
damageValue = abstractCooldown.modifyDamageAfterInterveneFromAttacker(event, damageValue);
}
}
}
// Arcane Shield
List<ArcaneShield> arcaneShields = new CooldownFilter<>(this, RegularCooldown.class).filterCooldownClassAndMapToObjectsOfClass(ArcaneShield.class).collect(Collectors.toList());
if (!arcaneShields.isEmpty() && isEnemy(attacker) && !HammerOfLight.standingInHammer(attacker, entity)) {
ArcaneShield arcaneShield = arcaneShields.get(0);
// adding dmg to shield
arcaneShield.addShieldHealth(-damageValue);
// check if broken
if (arcaneShield.getShieldHealth() < 0) {
if (entity instanceof Player) {
((EntityLiving) ((CraftPlayer) entity).getHandle()).setAbsorptionHearts(0);
}
cooldownManager.removeCooldown(arcaneShield);
addDamageInstance(new WarlordsDamageHealingEvent(this, attacker, ability, -arcaneShield.getShieldHealth(), -arcaneShield.getShieldHealth(), isCrit ? 100 : -1, 100, false, true, true));
addAbsorbed(-(arcaneShield.getShieldHealth()));
return;
} else {
if (entity instanceof Player) {
((EntityLiving) ((CraftPlayer) entity).getHandle()).setAbsorptionHearts((float) (arcaneShield.getShieldHealth() / (maxHealth * .5) * 20));
}
if (isMeleeHit) {
sendMessage(GIVE_ARROW + ChatColor.GRAY + " You absorbed " + attacker.getName() + "'s melee " + ChatColor.GRAY + "hit.");
attacker.sendMessage(RECEIVE_ARROW + ChatColor.GRAY + " Your melee hit was absorbed by " + name);
} else {
sendMessage(GIVE_ARROW + ChatColor.GRAY + " You absorbed " + attacker.getName() + "'s " + ability + " " + ChatColor.GRAY + "hit.");
attacker.sendMessage(RECEIVE_ARROW + ChatColor.GRAY + " Your " + ability + " was absorbed by " + name + ChatColor.GRAY + ".");
}
addAbsorbed(Math.abs(damageHealValueBeforeReduction));
}
for (AbstractCooldown<?> abstractCooldown : getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onShieldFromSelf(event, damageValue, isCrit);
}
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onShieldFromAttacker(event, damageValue, isCrit);
}
playHurtAnimation(this.entity, attacker);
if (!isMeleeHit) {
playHitSound(attacker);
}
removeHorse();
} else {
boolean debt = getCooldownManager().hasCooldownFromName("Spirits Respite");
if (isEnemy(attacker)) {
hitBy.put(attacker, 10);
cancelHealingPowerUp();
removeHorse();
regenTimer = 10;
sendDamageMessage(attacker, this, ability, damageValue, isCrit, isMeleeHit);
if (spec instanceof Vindicator) {
((SoulShackle) spec.getRed()).addToShacklePool(damageValue);
}
// Repentance
if (spec instanceof Spiritguard) {
((Repentance) spec.getBlue()).addToPool(damageValue);
}
for (AbstractCooldown<?> abstractCooldown : getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onDamageFromSelf(event, damageValue, isCrit);
}
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onDamageFromAttacker(event, damageValue, isCrit);
}
}
updateJimmyHealth();
// debt and healing
if (!debt && takeDamage) {
this.health -= Math.round(damageValue);
}
attacker.addDamage(damageValue);
playHurtAnimation(this.entity, attacker);
recordDamage.add(damageValue);
// The player died.
if (this.health <= 0 && !cooldownManager.checkUndyingArmy(false)) {
if (attacker.entity instanceof Player) {
((Player) attacker.entity).playSound(attacker.getLocation(), Sound.ORB_PICKUP, 500f, 1);
((Player) attacker.entity).playSound(attacker.getLocation(), Sound.ORB_PICKUP, 500f, 0.5f);
}
attacker.addKill();
sendMessage(ChatColor.GRAY + "You were killed by " + attacker.getColoredName());
attacker.sendMessage(ChatColor.GRAY + "You killed " + getColoredName());
gameState.getGame().forEachOnlinePlayer((p, t) -> {
if (p != this.entity && p != attacker.entity) {
p.sendMessage(getColoredName() + ChatColor.GRAY + " was killed by " + attacker.getColoredName());
}
});
for (WarlordsPlayer enemy : PlayerFilter.playingGame(game).enemiesOf(this).stream().collect(Collectors.toList())) {
for (AbstractCooldown<?> abstractCooldown : enemy.getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onDeathFromEnemies(event, damageValue, isCrit, enemy == attacker);
}
}
// Title card "YOU DIED!"
if (this.entity instanceof Player) {
PacketUtils.sendTitle((Player) entity, ChatColor.RED + "YOU DIED!", ChatColor.GRAY + attacker.getName() + " killed you.", 0, 40, 0);
}
die(attacker);
} else {
if (!isMeleeHit && this != attacker && damageValue != 0) {
playHitSound(attacker);
}
}
}
}
for (AbstractCooldown<?> abstractCooldown : getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onEndFromSelf(event, damageValue, isCrit);
}
for (AbstractCooldown<?> abstractCooldown : attacker.getCooldownManager().getCooldownsDistinct()) {
abstractCooldown.onEndFromAttacker(event, damageValue, isCrit);
}
getCooldownManager().getCooldowns().removeAll(new CooldownFilter<>(attacker, DamageHealCompleteCooldown.class).stream().collect(Collectors.toList()));
attacker.getCooldownManager().getCooldowns().removeAll(new CooldownFilter<>(attacker, DamageHealCompleteCooldown.class).stream().collect(Collectors.toList()));
// WarlordsDamageHealingFinalEvent finalEvent = new WarlordsDamageHealingFinalEvent(
// this,
// attacker,
// ability,
// initialHealth,
// damageValue,
// critChance,
// critMultiplier,
// isCrit,
// true);
// secondStats.addDamageHealingEventAsSelf(finalEvent);
// attacker.getSecondStats().addDamageHealingEventAsAttacker(finalEvent);
//
// checkForAchievementsDamage(attacker);
}
use of com.ebicep.warlords.game.Game in project Warlords by ebicep.
the class PlayingState method begin.
@Override
@SuppressWarnings("null")
public void begin() {
this.game.setAcceptsSpectators(true);
this.game.setAcceptsPlayers(false);
this.resetTimer();
RemoveEntities.doRemove(this.game);
for (Option option : game.getOptions()) {
option.start(game);
}
this.game.forEachOfflinePlayer((player, team) -> {
if (team != null) {
PlayerSettings playerSettings = Warlords.getPlayerSettings(player.getUniqueId());
Warlords.addPlayer(new WarlordsPlayer(player, this, team, playerSettings));
}
});
this.game.forEachOfflineWarlordsPlayer(wp -> {
CustomScoreboard customScoreboard = Warlords.playerScoreboards.get(wp.getUuid());
updateBasedOnGameState(customScoreboard, wp);
if (wp.getEntity() instanceof Player) {
wp.applySkillBoost((Player) wp.getEntity());
}
});
if (DatabaseManager.playerService != null) {
Warlords.newChain().async(() -> game.forEachOfflinePlayer((player, team) -> {
DatabasePlayer databasePlayer = DatabaseManager.playerService.findByUUID(player.getUniqueId());
DatabaseManager.updatePlayerAsync(databasePlayer);
DatabaseManager.loadPlayer(player.getUniqueId(), PlayersCollections.SEASON_5, () -> {
});
DatabaseManager.loadPlayer(player.getUniqueId(), PlayersCollections.WEEKLY, () -> {
});
DatabaseManager.loadPlayer(player.getUniqueId(), PlayersCollections.DAILY, () -> {
});
})).execute();
} else {
System.out.println("ATTENTION - playerService is null");
}
game.registerEvents(new Listener() {
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onWin(WarlordsGameTriggerWinEvent event) {
game.setNextState(new EndState(game, event));
winEvent = event;
}
});
GameRunnable.create(game, this::updateScoreboard).runTaskTimer(0, 10);
new GameRunnable(game) {
@Override
public void run() {
counter++;
timer += GameRunnable.SECOND;
if (counter >= 60) {
counter -= 60;
PlayerFilter.playingGame(game).forEach(wp -> wp.getMinuteStats().advanceMinute());
}
PlayerFilter.playingGame(game).forEach(wp -> wp.getSecondStats().advanceSecond());
}
}.runTaskTimer(0, GameRunnable.SECOND);
game.registerGameMarker(TimerSkipAbleMarker.class, (delay) -> {
counter += delay / GameRunnable.SECOND;
timer += delay;
});
Warlords.getInstance().hideAndUnhidePeople();
}
use of com.ebicep.warlords.game.Game in project Warlords by ebicep.
the class GameMenu method openTeamMenu.
public static void openTeamMenu(Player player) {
Team selectedTeam = Warlords.getPlayerSettings(player.getUniqueId()).getWantedTeam();
Menu menu = new Menu("Team Selector", 9 * 4);
List<Team> values = new ArrayList<>(Arrays.asList(Team.values()));
for (int i = 0; i < values.size(); i++) {
Team team = values.get(i);
ItemBuilder builder = new ItemBuilder(team.getItem()).name(team.teamColor() + team.getName()).flags(ItemFlag.HIDE_ENCHANTS);
List<String> lore = new ArrayList<>();
if (team == selectedTeam) {
lore.add(ChatColor.GREEN + "Currently selected!");
builder.enchant(Enchantment.OXYGEN, 1);
} else {
lore.add(ChatColor.YELLOW + "Click to select!");
}
builder.lore(lore);
menu.setItem(9 / 2 - values.size() % 2 + i * 2 - 1, 1, builder.get(), (m, e) -> {
if (selectedTeam != team) {
player.sendMessage(ChatColor.GREEN + "You have joined the " + team.teamColor() + team.getName() + ChatColor.GREEN + " team!");
Optional<Game> playerGame = Warlords.getGameManager().getPlayerGame(player.getUniqueId());
if (playerGame.isPresent()) {
Game game = playerGame.get();
Team oldTeam = game.getPlayerTeam(player.getUniqueId());
game.setPlayerTeam(player, team);
LobbyLocationMarker randomLobbyLocation = LobbyLocationMarker.getRandomLobbyLocation(game, team);
if (randomLobbyLocation != null) {
Location teleportDestination = MapSymmetryMarker.getSymmetry(game).getOppositeLocation(game, oldTeam, team, player.getLocation(), randomLobbyLocation.getLocation());
player.teleport(teleportDestination);
Warlords.setRejoinPoint(player.getUniqueId(), teleportDestination);
}
}
ArmorManager.resetArmor(player, Warlords.getPlayerSettings(player.getUniqueId()).getSelectedClass(), team);
Warlords.getPlayerSettings(player.getUniqueId()).setWantedTeam(team);
}
openTeamMenu(player);
});
}
menu.setItem(4, 3, Menu.MENU_CLOSE, ACTION_CLOSE_MENU);
menu.openForPlayer(player);
}
use of com.ebicep.warlords.game.Game in project Warlords by ebicep.
the class DatabaseGameBase method createGameSwitcherHologram.
private static void createGameSwitcherHologram(Player player) {
HolographicDisplaysAPI.get(Warlords.getInstance()).getHolograms().stream().filter(h -> h.getVisibilitySettings().isVisibleTo(player) && h.getPosition().toLocation().equals(DatabaseGameBase.gameSwitchLocation)).forEach(Hologram::delete);
Hologram gameSwitcher = HolographicDisplaysAPI.get(Warlords.getInstance()).createHologram(DatabaseGameBase.gameSwitchLocation);
gameSwitcher.getLines().appendText(ChatColor.AQUA.toString() + ChatColor.UNDERLINE + "Last " + previousGames.size() + " Games");
gameSwitcher.getLines().appendText("");
int selectedGame = LeaderboardManager.playerGameHolograms.get(player.getUniqueId());
int gameBefore = getGameBefore(selectedGame);
int gameAfter = getGameAfter(selectedGame);
if (previousGames.isEmpty()) {
return;
}
ClickableHologramLine beforeLine;
ClickableHologramLine afterLine;
if (gameBefore == previousGames.size() - 1) {
beforeLine = gameSwitcher.getLines().appendText(ChatColor.GRAY + "Latest Game");
} else {
beforeLine = gameSwitcher.getLines().appendText(ChatColor.GRAY.toString() + (gameBefore + 1) + ". " + previousGames.get(gameBefore).getDate());
}
if (selectedGame == previousGames.size() - 1) {
gameSwitcher.getLines().appendText(ChatColor.GREEN + "Latest Game");
} else {
gameSwitcher.getLines().appendText(ChatColor.GREEN.toString() + (selectedGame + 1) + ". " + previousGames.get(selectedGame).getDate());
}
if (gameAfter == previousGames.size() - 1) {
afterLine = gameSwitcher.getLines().appendText(ChatColor.GRAY + "Latest Game");
} else {
afterLine = gameSwitcher.getLines().appendText(ChatColor.GRAY.toString() + (gameAfter + 1) + ". " + previousGames.get(gameAfter).getDate());
}
beforeLine.setClickListener((clicker) -> {
LeaderboardManager.playerGameHolograms.put(player.getUniqueId(), gameBefore);
setGameHologramVisibility(player);
});
afterLine.setClickListener((clicker) -> {
LeaderboardManager.playerGameHolograms.put(player.getUniqueId(), gameAfter);
setGameHologramVisibility(player);
});
gameSwitcher.getVisibilitySettings().setGlobalVisibility(VisibilitySettings.Visibility.HIDDEN);
gameSwitcher.getVisibilitySettings().setIndividualVisibility(player, VisibilitySettings.Visibility.VISIBLE);
}
Aggregations