Search in sources :

Example 1 with Class

use of net.warvale.core.classes.Class in project GameCore by Warvale.

the class ClassSelect method openGUI.

private void openGUI(Player player) {
    inv = Bukkit.createInventory(null, 45, ChatColor.DARK_GRAY + "Select a class: ");
    Integer inventoryIndex = 0;
    for (Map.Entry<String, Class> clazzSet : ClassManager.classes.entrySet()) {
        Class clazz = clazzSet.getValue();
        ItemStack classStack = clazz.getItem();
        ItemMeta classMeta = classStack.getItemMeta();
        List<String> desc = new LinkedList<>(clazz.getDescription());
        desc.add(0, ChatColor.translateAlternateColorCodes('&', "&7PRICE: &e" + clazz.getPrice()));
        desc.add(1, ChatColor.GRAY + "ABILITY: " + ChatColor.YELLOW + clazz.getAbility());
        classMeta.setLore(desc);
        classMeta.setDisplayName(ChatColor.AQUA + clazz.getName());
        classStack.setItemMeta(classMeta);
        inv.setItem(inventoryIndex, classStack);
        slots.put(inventoryIndex, clazz);
        inventoryIndex = inventoryIndex + 1;
    }
    player.openInventory(inv);
}
Also used : Class(net.warvale.core.classes.Class) ItemStack(org.bukkit.inventory.ItemStack) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 2 with Class

use of net.warvale.core.classes.Class in project GameCore by Warvale.

the class ClassSelect method onMove.

@EventHandler(priority = EventPriority.HIGHEST)
public void onMove(InventoryClickEvent event) {
    Player player = (Player) event.getWhoClicked();
    Class clazz = slots.get(event.getSlot());
    if (!event.getInventory().equals(inv)) {
        return;
    }
    if (clazz == null) {
        return;
    }
    // if (!ClassManager.hasClass(player)) {
    clazz.addMember(player);
    player.sendMessage(ChatColor.GRAY + "You have successfully chosen the " + ChatColor.YELLOW + clazz.getName() + ChatColor.GRAY + " class!");
    player.playSound(player.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 2);
    //new ClassChooseEvent(player, clazz);
    // } else {
    // player.sendMessage(ChatColor.RED + "You may not switch your class at
    // this time.");
    // }
    event.setCancelled(true);
}
Also used : Player(org.bukkit.entity.Player) Class(net.warvale.core.classes.Class) EventHandler(org.bukkit.event.EventHandler)

Example 3 with Class

use of net.warvale.core.classes.Class in project GameCore by Warvale.

the class AbilityManager method onPlayerInteract.

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
    Player p = e.getPlayer();
    if (!(e.getAction() == RIGHT_CLICK_AIR || e.getAction() == RIGHT_CLICK_BLOCK))
        return;
    if (cooldown.contains(p))
        return;
    Class classCheck = ClassManager.getClassForPlayer(p.getName());
    e.setCancelled(true);
    switch(classCheck.getName()) {
        case "Soldier":
            if (!e.getItem().equals(new ItemStack(Material.FIREWORK_CHARGE)))
                return;
            this.Soldier(p);
            break;
        case "Archer":
            if (!e.getItem().equals(new ItemStack(Material.MAGMA_CREAM)))
                return;
            this.Archer(p);
            break;
        case "Assassin":
            if (!e.getItem().equals(new ItemStack(Material.SULPHUR)))
                return;
            this.Assassin(p);
            break;
        case "Miner":
            if (!e.getItem().equals(new ItemStack(Material.IRON_PICKAXE)))
                return;
            this.Miner(p);
            break;
        case "Spy":
            if (!e.getItem().equals(new ItemStack(Material.GLASS_BOTTLE)))
                return;
            this.Spy(p);
            break;
        case "Technician":
            if (!e.getItem().equals(new ItemStack(Material.REDSTONE_TORCH_ON)))
                return;
            this.Technician(p);
            break;
        case "Musician":
            if (!e.getItem().equals(new ItemStack(Material.RECORD_8)))
                return;
            this.Musician(p);
            break;
        case "Pyromaniac":
            if (!e.getItem().equals(new ItemStack(Material.FIREBALL)))
                return;
            this.Pyromaniac(p);
            break;
        case "Necromancer":
            if (!e.getItem().equals(new ItemStack(Material.FIREBALL)))
                return;
            this.Necromancer(p);
            break;
        case "Medic":
            if (!e.getItem().equals(new ItemStack(Material.FIREBALL)))
                return;
            this.Medic(p);
            break;
    }
    cooldown.add(p);
    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask((Plugin) this, new Runnable() {

        public void run() {
            cooldown.remove(p);
            p.sendMessage(ChatColor.GREEN + "You can use your ability now!");
        }
    }, 200);
}
Also used : Class(net.warvale.core.classes.Class) ItemStack(org.bukkit.inventory.ItemStack) EventHandler(org.bukkit.event.EventHandler)

Example 4 with Class

use of net.warvale.core.classes.Class in project GameCore by Warvale.

the class Main method setupClasses.

private static void setupClasses() {
    new Class("Soldier", 0, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aDefault class. &7Charges forward and deals extra"), ChatColor.translateAlternateColorCodes('&', "&7damage to enemies.")), new ItemStack(Material.FIREWORK_CHARGE), "Charge");
    new Class("Archer", 0, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aDefault class. &7Shoot explosive arrows towards"), ChatColor.translateAlternateColorCodes('&', "&7enemies to deal extra damage.")), new ItemStack(Material.MAGMA_CREAM), "Volley");
    new Class("Assassin", 0, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aDefault class. &7Hide in the shadows with your"), ChatColor.translateAlternateColorCodes('&', "&7sneaky invisibility.")), new ItemStack(Material.SULPHUR), "Sneak");
    new Class("Miner", 100, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Chance to deal double damage"), ChatColor.translateAlternateColorCodes('&', "&7when mining the core.")), new ItemStack(Material.IRON_PICKAXE), "Superswing");
    new Class("Spy", 500, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Appear as if you are on the other team"), ChatColor.translateAlternateColorCodes('&', "&7 by transforming your name color!")), new ItemStack(Material.GLASS_BOTTLE), "Undercover");
    new Class("Technician", 1000, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Paralyze your enemy with your stunning "), ChatColor.translateAlternateColorCodes('&', "&7electrocution powers.")), new ItemStack(Material.REDSTONE_TORCH_ON), "Electrocute");
    new Class("Musician", 1000, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Play your music and gain healing powers"), ChatColor.translateAlternateColorCodes('&', "&7when near it!")), new ItemStack(Material.RECORD_8), "Jukebox");
    new Class("Pyromaniac", 1000, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Use the power of fire to light your"), ChatColor.translateAlternateColorCodes('&', "&7target aflame.")), new ItemStack(Material.FIREBALL), "Ignite");
    new Class("Necromancer", 5000, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Raise evil mobs from the dead to attack"), ChatColor.translateAlternateColorCodes('&', "&7enemies.")), new ItemStack(Material.BONE), "Reincarnate");
    new Class("Earthbender", 5000, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Harness the powers of the Earth to control"), ChatColor.translateAlternateColorCodes('&', "&7the environment.")), new ItemStack(Material.GRASS), "Terraform");
    new Class("Medic", 7000, Arrays.asList(ChatColor.translateAlternateColorCodes('&', "&aPurchasable class. &7Take on the role of a support class by "), ChatColor.translateAlternateColorCodes('&', "&7healing your teammates around you!")), new ItemStack(Material.BLAZE_ROD), "Trainquility");
}
Also used : Class(net.warvale.core.classes.Class) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

Class (net.warvale.core.classes.Class)4 ItemStack (org.bukkit.inventory.ItemStack)3 EventHandler (org.bukkit.event.EventHandler)2 Player (org.bukkit.entity.Player)1 ItemMeta (org.bukkit.inventory.meta.ItemMeta)1