use of com.google.api.ads.admanager.axis.v202205.User in project Village_Defense by Plajer.
the class ArenaUtils method bringDeathPlayersBack.
public static void bringDeathPlayersBack(Arena arena) {
for (Player player : arena.getPlayers()) {
if (!arena.getPlayersLeft().contains(player)) {
User user = UserManager.getUser(player.getUniqueId());
user.setFakeDead(false);
user.setSpectator(false);
arena.teleportToStartLocation(player);
player.setFlying(false);
player.setAllowFlight(false);
player.setGameMode(GameMode.SURVIVAL);
arena.showPlayers();
player.getInventory().clear();
user.getKit().giveKitItems(player);
player.sendMessage(ChatManager.colorMessage("In-Game.Back-In-Game"));
}
}
}
use of com.google.api.ads.admanager.axis.v202205.User in project Village_Defense by Plajer.
the class ArenaUtils method updateLevelStat.
public static void updateLevelStat(Player player, Arena arena) {
User user = UserManager.getUser(player.getUniqueId());
if (Math.pow(50 * user.getInt("level"), 1.5) < user.getInt("xp")) {
user.addInt("level", 1);
player.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.formatMessage(arena, ChatManager.colorMessage("In-Game.You-Leveled-Up"), user.getInt("level")));
}
}
use of com.google.api.ads.admanager.axis.v202205.User in project Village_Defense by Plajer.
the class ArenaUtils method updateScoreboard.
public static void updateScoreboard(Arena arena) {
if (arena.getPlayers().size() == 0)
return;
for (Player p : arena.getPlayers()) {
User user = UserManager.getUser(p.getUniqueId());
if (user.getScoreboard().getObjective("vd_state_0") == null) {
for (ArenaState state : ArenaState.values()) {
user.getScoreboard().registerNewObjective("vd_state_" + state.ordinal(), "dummy");
}
// fighting stage of IN_GAME state
user.getScoreboard().registerNewObjective("vd_state_2F", "dummy");
}
if (arena.getArenaState() == ArenaState.ENDING) {
user.removeScoreboard();
return;
}
Objective gameObjective;
if (arena.getArenaState() == ArenaState.IN_GAME) {
gameObjective = user.getScoreboard().getObjective("vd_state_" + arena.getArenaState().ordinal() + (arena.isFighting() ? "F" : ""));
} else {
gameObjective = user.getScoreboard().getObjective("vd_state_" + arena.getArenaState().ordinal());
}
if (gameObjective == null)
return;
gameObjective.setDisplayName(ChatManager.colorMessage("Scoreboard.Header"));
gameObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
switch(arena.getArenaState()) {
case WAITING_FOR_PLAYERS:
Score playersTotal1 = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Players")));
playersTotal1.setScore(arena.getPlayers().size());
Score neededPlayers2 = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Minimum-Players")));
neededPlayers2.setScore(arena.getMinimumPlayers());
break;
case STARTING:
Score timer = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Starting-In")));
timer.setScore(arena.getTimer());
Score playersTotal = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Players")));
playersTotal.setScore(arena.getPlayers().size());
Score neededPlayers = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Minimum-Players")));
neededPlayers.setScore(arena.getMinimumPlayers());
break;
case IN_GAME:
Score playersLeft = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Players-Left")));
playersLeft.setScore(arena.getPlayersLeft().size());
Score villagersLeft = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Villagers-Left")));
villagersLeft.setScore(arena.getVillagers().size());
Score orbs = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Orbs")));
orbs.setScore(user.getInt("orbs"));
if (arena.isFighting()) {
Score zombiesLeft = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Zombies-Left")));
zombiesLeft.setScore(arena.getZombiesLeft());
} else {
Score nextWaveIn = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Next-Wave-In")));
nextWaveIn.setScore(arena.getTimer());
}
Score rottenFlesh = gameObjective.getScore(ChatManager.formatMessage(arena, ChatManager.colorMessage("Scoreboard.Rotten-Flesh")));
rottenFlesh.setScore(arena.getRottenFlesh());
break;
case RESTARTING:
break;
default:
arena.setArenaState(ArenaState.WAITING_FOR_PLAYERS);
break;
}
Score empty = gameObjective.getScore("");
empty.setScore(-1);
Score footer = gameObjective.getScore(ChatManager.colorMessage("Scoreboard.Footer"));
footer.setScore(-2);
user.setScoreboard(user.getScoreboard());
}
}
use of com.google.api.ads.admanager.axis.v202205.User in project Village_Defense by Plajer.
the class GameCommands method sendStatsOther.
public void sendStatsOther(CommandSender sender, String p) {
Player player = Bukkit.getPlayerExact(p);
if (player == null || UserManager.getUser(player.getUniqueId()) == null) {
sender.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("Commands.Admin-Commands.Player-Not-Found"));
return;
}
User user = UserManager.getUser(player.getUniqueId());
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Header-Other").replaceAll("%player%", player.getName()));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Kills") + user.getInt("kills"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Deaths") + user.getInt("deaths"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Games-Played") + user.getInt("gamesplayed"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Highest-Wave") + user.getInt("highestwave"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Level") + user.getInt("level"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Exp") + user.getInt("xp"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Next-Level-Exp") + Math.ceil(Math.pow(50 * user.getInt("level"), 1.5)));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Footer"));
}
use of com.google.api.ads.admanager.axis.v202205.User in project Village_Defense by Plajer.
the class GameCommands method sendStats.
public void sendStats(CommandSender sender) {
if (checkSenderIsConsole(sender))
return;
User user = UserManager.getUser(((Player) sender).getUniqueId());
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Header"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Kills") + user.getInt("kills"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Deaths") + user.getInt("deaths"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Games-Played") + user.getInt("gamesplayed"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Highest-Wave") + user.getInt("highestwave"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Level") + user.getInt("level"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Exp") + user.getInt("xp"));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Next-Level-Exp") + Math.ceil(Math.pow(50 * user.getInt("level"), 1.5)));
sender.sendMessage(ChatManager.colorMessage("Commands.Stats-Command.Footer"));
}
Aggregations