Search in sources :

Example 71 with User

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

the class Events method onEntityInteractEntity.

@EventHandler
public void onEntityInteractEntity(PlayerInteractEntityEvent event) {
    Arena arena = ArenaRegistry.getArena(event.getPlayer());
    if (arena == null)
        return;
    User user = UserManager.getUser(event.getPlayer().getUniqueId());
    if (user.isFakeDead()) {
        event.setCancelled(true);
        return;
    }
    if (event.getPlayer().getItemInHand().getType() == Material.SADDLE) {
        if (event.getRightClicked().getType() == EntityType.IRON_GOLEM || event.getRightClicked().getType() == EntityType.VILLAGER) {
            event.getRightClicked().setPassenger(event.getPlayer());
            event.setCancelled(true);
            return;
        }
    }
    if (event.getRightClicked().getType() == EntityType.VILLAGER) {
        event.setCancelled(true);
        ShopManager.openShop(event.getPlayer());
    } else if (event.getRightClicked().getType() == EntityType.IRON_GOLEM) {
        IronGolem ironGolem = (IronGolem) event.getRightClicked();
        if (ironGolem.getCustomName() != null && ironGolem.getCustomName().contains(event.getPlayer().getName())) {
            event.getRightClicked().setPassenger(event.getPlayer());
        } else {
            event.getPlayer().sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("In-Game.Messages.Cant-Ride-Others-Golem"));
        }
    }
}
Also used : User(pl.plajer.villagedefense3.User) IronGolem(org.bukkit.entity.IronGolem) Arena(pl.plajer.villagedefense3.arena.Arena) EventHandler(org.bukkit.event.EventHandler)

Example 72 with User

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

the class LooterKit method onDeath.

@EventHandler
public void onDeath(EntityDeathEvent event) {
    if (event.getEntity().getType() != EntityType.ZOMBIE)
        return;
    if (event.getEntity().getKiller() == null)
        return;
    Player player = event.getEntity().getKiller();
    if (ArenaRegistry.getArena(player) == null)
        return;
    User user = UserManager.getUser(player.getUniqueId());
    if (user.getKit() instanceof LooterKit) {
        player.getInventory().addItem(new ItemStack(Material.ROTTEN_FLESH, 1));
    }
}
Also used : Player(org.bukkit.entity.Player) User(pl.plajer.villagedefense3.User) ItemStack(org.bukkit.inventory.ItemStack) EventHandler(org.bukkit.event.EventHandler)

Example 73 with User

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

the class WorkerKit method onDoorPlace.

@EventHandler(priority = EventPriority.HIGHEST)
public void onDoorPlace(BlockPlaceEvent event) {
    Arena arena = ArenaRegistry.getArena(event.getPlayer());
    if (arena == null)
        return;
    User user = UserManager.getUser(event.getPlayer().getUniqueId());
    if (user.isSpectator()) {
        event.setCancelled(true);
        return;
    }
    if (event.getPlayer().getItemInHand() == null) {
        event.setCancelled(true);
        return;
    }
    if (!(event.getPlayer().getItemInHand().getType() == Material.WOOD_DOOR || event.getPlayer().getItemInHand().getType() == Material.WOODEN_DOOR)) {
        event.setCancelled(true);
        return;
    }
    if (!arena.getDoorLocations().containsKey(event.getBlock().getLocation())) {
        event.setCancelled(true);
        return;
    }
    event.setCancelled(false);
    event.getPlayer().sendMessage(ChatManager.colorMessage("Kits.Worker.Game-Item-Place-Message"));
}
Also used : User(pl.plajer.villagedefense3.User) Arena(pl.plajer.villagedefense3.arena.Arena) EventHandler(org.bukkit.event.EventHandler)

Example 74 with User

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

the class AdminCommands method addOrbsOther.

public void addOrbsOther(CommandSender sender, String p, String number) {
    // check only target player, maybe sender would do this from console.
    if (Bukkit.getPlayerExact(p) == null) {
        sender.sendMessage(ChatColor.RED + "Target player doesn't exist!");
    }
    Player player = Bukkit.getPlayer(p);
    if (!checkIsInGameInstance(player))
        return;
    if (!hasPermission(sender, "villagedefense.admin.addorbs.others"))
        return;
    if (NumberUtils.isNumber(number)) {
        User user = UserManager.getUser(player.getUniqueId());
        user.setInt("orbs", user.getInt("orbs") + Integer.parseInt(number));
        sender.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("Commands.Admin-Commands.Added-Orbs"));
    } else {
        sender.sendMessage(ChatColor.RED + "Wrong usage. Do /villagedefense addorbs <player> <amount>");
    }
}
Also used : Player(org.bukkit.entity.Player) User(pl.plajer.villagedefense3.User)

Example 75 with User

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

the class AdminCommands method respawn.

public void respawn(CommandSender sender) {
    if (checkSenderIsConsole(sender))
        return;
    Player player = (Player) sender;
    if (!hasPermission(player, "villagedefense.admin.respawn"))
        return;
    if (!checkIsInGameInstance(player))
        return;
    Arena arena = ArenaRegistry.getArena(player);
    player.setGameMode(GameMode.SURVIVAL);
    User user = UserManager.getUser(player.getUniqueId());
    user.setFakeDead(false);
    user.setSpectator(false);
    arena.teleportToStartLocation(player);
    player.setFlying(false);
    player.setAllowFlight(false);
    ArenaUtils.showPlayer(player, arena);
    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) Arena(pl.plajer.villagedefense3.arena.Arena)

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.v202202.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.v202111.User)6 UserServiceInterface (com.google.api.ads.admanager.axis.v202111.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