Search in sources :

Example 71 with User

use of com.google.api.ads.admanager.axis.v202111.User in project Village_Defense by Plajer.

the class Arena method startWave.

private void startWave() {
    VillageWaveStartEvent villageWaveStartEvent = new VillageWaveStartEvent(this, wave);
    Bukkit.getPluginManager().callEvent(villageWaveStartEvent);
    setZombieAmount();
    if (plugin.getConfig().getBoolean("Respawn-After-Wave"))
        ArenaUtils.bringDeathPlayersBack(this);
    for (User user : UserManager.getUsers(this)) {
        user.getKit().reStock(user.toPlayer());
    }
    String message = ChatManager.formatMessage(this, ChatManager.colorMessage("In-Game.Messages.Wave-Started"), wave);
    for (Player player1 : getPlayers()) {
        player1.sendMessage(ChatManager.PLUGIN_PREFIX + message);
    }
}
Also used : Player(org.bukkit.entity.Player) User(pl.plajer.villagedefense3.User) VillageWaveStartEvent(pl.plajer.villagedefense3.villagedefenseapi.VillageWaveStartEvent)

Example 72 with User

use of com.google.api.ads.admanager.axis.v202111.User in project Village_Defense by Plajer.

the class Arena method addExperience.

void addExperience(Player player, int i) {
    User user = UserManager.getUser(player.getUniqueId());
    user.addInt("xp", i);
    if (player.hasPermission(PermissionsManager.getVip())) {
        user.addInt("xp", (int) Math.ceil(i / 2));
    }
    if (player.hasPermission(PermissionsManager.getMvp())) {
        user.addInt("xp", (int) Math.ceil(i / 2));
    }
    if (player.hasPermission(PermissionsManager.getElite())) {
        user.addInt("xp", (int) Math.ceil(i / 2));
    }
    ArenaUtils.updateLevelStat(player, this);
}
Also used : User(pl.plajer.villagedefense3.User)

Example 73 with User

use of com.google.api.ads.admanager.axis.v202111.User in project Village_Defense by Plajer.

the class FileStats method saveStat.

public void saveStat(Player player, String stat) {
    User user = UserManager.getUser(player.getUniqueId());
    config.set(player.getUniqueId().toString() + "." + stat, user.getInt(stat));
    try {
        config.save(ConfigurationManager.getFile("stats"));
    } catch (IOException e) {
        e.printStackTrace();
        BigTextUtils.errorOccured();
        Bukkit.getConsoleSender().sendMessage("Cannot save stats.yml file!");
        Bukkit.getConsoleSender().sendMessage("Restart the server, file COULD BE OVERRIDDEN!");
    }
}
Also used : User(pl.plajer.villagedefense3.User) IOException(java.io.IOException)

Example 74 with User

use of com.google.api.ads.admanager.axis.v202111.User in project Village_Defense by Plajer.

the class Events method onShop.

@EventHandler
public void onShop(InventoryClickEvent event) {
    if (!(event.getWhoClicked() instanceof Player))
        return;
    Player player = (Player) event.getWhoClicked();
    Inventory inv = event.getInventory();
    Arena arena = ArenaRegistry.getArena((Player) event.getWhoClicked());
    if (arena == null)
        return;
    User user = UserManager.getUser(player.getUniqueId());
    if (user.isFakeDead()) {
        event.setCancelled(true);
        return;
    }
    if (inv.getName() == null || !inv.getName().equalsIgnoreCase(ChatManager.colorMessage("In-Game.Messages.Shop-Messages.Shop-GUI-Name")))
        return;
    event.setCancelled(true);
    if (event.getCurrentItem() == null || !event.getCurrentItem().hasItemMeta() || !event.getCurrentItem().getItemMeta().hasLore())
        return;
    String string = event.getCurrentItem().getItemMeta().getLore().get(0);
    string = ChatColor.stripColor(string);
    if (!(string.contains(ChatManager.colorMessage("In-Game.Messages.Shop-Messages.Currency-In-Shop")) || string.contains("orbs"))) {
        boolean b = false;
        for (String s : event.getCurrentItem().getItemMeta().getLore()) {
            if (string.contains(ChatManager.colorMessage("In-Game.Messages.Shop-Messages.Currency-In-Shop")) || string.contains("orbs")) {
                string = s;
                b = true;
            }
        }
        if (!b)
            return;
    }
    int price = Integer.parseInt(string.split(" ")[0]);
    if (price > UserManager.getUser(player.getUniqueId()).getInt("orbs")) {
        player.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("In-Game.Messages.Shop-Messages.Not-Enough-Orbs"));
        return;
    }
    if (event.getCurrentItem().hasItemMeta() && event.getCurrentItem().getItemMeta().hasDisplayName()) {
        if (event.getCurrentItem().getItemMeta().getDisplayName().contains(ChatManager.colorMessage("In-Game.Messages.Shop-Messages.Golem-Item-Name"))) {
            arena.spawnGolem(arena.getStartLocation(), player);
            player.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("In-Game.Messages.Golem-Spawned"));
            UserManager.getUser(player.getUniqueId()).setInt("orbs", UserManager.getUser(player.getUniqueId()).getInt("orbs") - price);
            return;
        }
        if (event.getCurrentItem().getItemMeta().getDisplayName().contains(ChatManager.colorMessage("In-Game.Messages.Shop-Messages.Wolf-Item-Name"))) {
            arena.spawnWolf(arena.getStartLocation(), player);
            player.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("In-Game.Messages.Wolf-Spawned"));
            UserManager.getUser(player.getUniqueId()).setInt("orbs", UserManager.getUser(player.getUniqueId()).getInt("orbs") - price);
            return;
        }
    }
    ItemStack itemStack = event.getCurrentItem().clone();
    ItemMeta itemMeta = itemStack.getItemMeta();
    List<String> lore = new ArrayList<>();
    for (String loopLore : lore) {
        if (loopLore.contains(ChatManager.colorMessage("In-Game.Messages.Shop-Messages.Currency-In-Shop"))) {
            lore.remove(loopLore);
        }
    }
    itemMeta.setLore(lore);
    itemStack.setItemMeta(itemMeta);
    player.getInventory().addItem(itemStack);
    UserManager.getUser(player.getUniqueId()).setInt("orbs", UserManager.getUser(player.getUniqueId()).getInt("orbs") - price);
}
Also used : Player(org.bukkit.entity.Player) User(pl.plajer.villagedefense3.User) ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) Inventory(org.bukkit.inventory.Inventory) Arena(pl.plajer.villagedefense3.arena.Arena) ItemMeta(org.bukkit.inventory.meta.ItemMeta) EventHandler(org.bukkit.event.EventHandler)

Example 75 with User

use of com.google.api.ads.admanager.axis.v202111.User in project Village_Defense by Plajer.

the class Events method onFriendHurt.

@EventHandler(priority = EventPriority.HIGHEST)
public void onFriendHurt(EntityDamageByEntityEvent event) {
    if (!(event.getDamager() instanceof Player))
        return;
    Arena arena = ArenaRegistry.getArena((Player) event.getDamager());
    if (arena == null)
        return;
    User user = UserManager.getUser(event.getDamager().getUniqueId());
    if (user.isFakeDead()) {
        event.setCancelled(true);
        return;
    }
    if (!VILLAGE_ENTITIES.contains(event.getEntityType()))
        return;
    event.setCancelled(true);
}
Also used : Player(org.bukkit.entity.Player) User(pl.plajer.villagedefense3.User) Arena(pl.plajer.villagedefense3.arena.Arena) EventHandler(org.bukkit.event.EventHandler)

Aggregations

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