Search in sources :

Example 71 with User

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"));
        }
    }
}
Also used : Player(org.bukkit.entity.Player) User(pl.plajer.villagedefense3.User)

Example 72 with User

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")));
    }
}
Also used : User(pl.plajer.villagedefense3.User)

Example 73 with User

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());
    }
}
Also used : Objective(org.bukkit.scoreboard.Objective) Player(org.bukkit.entity.Player) Score(org.bukkit.scoreboard.Score) User(pl.plajer.villagedefense3.User)

Example 74 with User

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"));
}
Also used : Player(org.bukkit.entity.Player) User(pl.plajer.villagedefense3.User)

Example 75 with User

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"));
}
Also used : User(pl.plajer.villagedefense3.User)

Aggregations

User (pl.plajer.villagedefense3.User)30 Player (org.bukkit.entity.Player)18 User (org.gluu.oxtrust.model.scim2.User)17 User (org.openstack4j.model.identity.v3.User)13 EventHandler (org.bukkit.event.EventHandler)11 Test (org.junit.Test)11 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)10 ScimPatchUser (org.gluu.oxtrust.model.scim2.ScimPatchUser)10 Date (java.util.Date)9 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)8 Arena (pl.plajer.villagedefense3.arena.Arena)8 User (me.zhanghai.android.douya.network.api.info.apiv2.User)7 User (com.google.api.ads.admanager.axis.v202108.User)6 User (com.google.api.ads.admanager.axis.v202202.User)6 UserServiceInterface (com.google.api.ads.admanager.axis.v202202.UserServiceInterface)6 ArrayList (java.util.ArrayList)6 SimpleUser (me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)6 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)6 User (com.google.api.ads.admanager.axis.v202205.User)5 UserServiceInterface (com.google.api.ads.admanager.axis.v202205.UserServiceInterface)5