Search in sources :

Example 6 with SPlayer

use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.

the class Inventories method run_PlayersInventory_invite.

public static void run_PlayersInventory_invite(InventoryClickEvent event) {
    try {
        Player pl = (Player) event.getWhoClicked();
        SkullMeta skull = (SkullMeta) event.getInventory().getItem(event.getSlot()).getItemMeta();
        Player cible = Bukkit.getPlayer(skull.getOwner());
        SPlayer p_sender = PlayersManager.getSPlayer(pl);
        SPlayer p_cible = PlayersManager.getSPlayer(cible);
        p_cible.setLastIsInvite(p_sender.getIsland().getID());
        cible.sendTitle("§a" + pl.getDisplayName() + " vous veut sur son île!", "§eFaites /is accept pour accepter !", 10, 20, 10);
    } catch (Exception ex) {
    }
}
Also used : Player(org.bukkit.entity.Player) SPlayer(pixelssky.objects.SPlayer) SkullMeta(org.bukkit.inventory.meta.SkullMeta) SPlayer(pixelssky.objects.SPlayer)

Example 7 with SPlayer

use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.

the class Inventories method run_IslandMenu.

public static void run_IslandMenu(InventoryClickEvent event) {
    Player pl = (Player) event.getWhoClicked();
    SPlayer p = PlayersManager.getSPlayer(pl);
    boolean isAdmin = p.getIsland().isAdmin(p.getID());
    if (event.getSlot() == 0) {
        pl.sendTitle("§aBienvenue sur votre île :)", "§cNe tombez pas !", 10, 20, 10);
        pl.teleport(p.getIsland().getSpawn());
        pl.playSound(pl.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 100, 100);
        pl.closeInventory();
    } else if (event.getSlot() == 1) {
        pl.sendTitle("§aTéléportation au spawn", "", 10, 20, 10);
        pl.teleport(Bukkit.getWorld("world").getSpawnLocation());
        pl.playSound(pl.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 100, 100);
        pl.closeInventory();
    } else if (event.getSlot() == 2) {
        p.getIsland().calculateLevel(pl);
        pl.closeInventory();
    } else if (event.getSlot() == 3) {
        pl.openInventory(getChallengesMainInventory());
    } else if (event.getSlot() == 6) {
    // Valeurs des blocks
    } else if (event.getSlot() == 7) {
        pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_GUITAR, 100, 100);
        pl.openInventory(getIslandsList(p));
    } else if (event.getSlot() == 8) {
    // Infos de l'île
    } else if (event.getSlot() == 9 && isAdmin) {
        pl.sendTitle("§aMise à jour effectuée :)", "§cVotre home a changé !", 10, 20, 10);
        p.getIsland().setHome(pl.getLocation());
        pl.playSound(pl.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 100, 100);
        pl.closeInventory();
    } else if (event.getSlot() == 12 && isAdmin) {
    // Ajouter admin
    } else if (event.getSlot() == 11 && isAdmin) {
        pl.openInventory(getPlayersInventory_invite(p));
    } else if (event.getSlot() == 13 && isAdmin) {
    // Suppr admin
    } else if (event.getSlot() == 14 && isAdmin) {
    // Virer joueur
    } else if (event.getSlot() == 16 && isAdmin) {
    // Calcul progression
    } else if (event.getSlot() == 20 && isAdmin) {
    // Biome
    } else if (event.getSlot() == 21 && isAdmin) {
    // 2léments débloqués
    } else if (event.getSlot() == 24 && isAdmin) {
    // Ajouter externe
    } else if (event.getSlot() == 25 && isAdmin) {
    // Suppr externe
    }
}
Also used : Player(org.bukkit.entity.Player) SPlayer(pixelssky.objects.SPlayer) SPlayer(pixelssky.objects.SPlayer)

Example 8 with SPlayer

use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.

the class Inventories method run_createIslandMenu.

public static void run_createIslandMenu(InventoryClickEvent event) {
    try {
        // Nouvelle île
        int slot = event.getSlot();
        Player pl = (Player) event.getWhoClicked();
        SPlayer p = PlayersManager.getSPlayer((Player) event.getWhoClicked());
        if (slot == 8) {
            pl.openInventory(getIslandsList(p));
        }
        Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("PixelsSkyblock"), new Runnable() {

            @Override
            public void run() {
                if (slot < 4 && slot > 0) {
                    if (p.getIsland() != null) {
                        DatabaseManager.deleteIsland(p.getIsland());
                        pl.getInventory().clear();
                        pl.getEnderChest().clear();
                    }
                    DatabaseManager.createIsland(p);
                    p.getIsland().addOrSetData("Creator", pl.getDisplayName());
                    p.getIsland().addOrSetData("admins", p.getID() + ",");
                    if (slot == 1) {
                        p.getIsland().addOrSetData("difficulty", "HARD");
                        try {
                            WEManager.pasteSchematics(Bukkit.getWorld("world"), new File("plugins/PixelsSky/Schematics/hard.island"), p.getIsland().getCenter());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if (slot == 2) {
                        p.getIsland().addOrSetData("difficulty", "NORMAL");
                        try {
                            WEManager.pasteSchematics(Bukkit.getWorld("world"), new File("plugins/PixelsSky/Schematics/normal.island"), p.getIsland().getCenter());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if (slot == 3) {
                        p.getIsland().addOrSetData("difficulty", "EASY");
                        try {
                            WEManager.pasteSchematics(Bukkit.getWorld("world"), new File("plugins/PixelsSky/Schematics/easy.island"), p.getIsland().getCenter());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if (slot == 4) {
                        p.getIsland().addOrSetData("difficulty", "NONE");
                        try {
                            WEManager.pasteSchematics(Bukkit.getWorld("world"), new File("plugins/PixelsSky/Schematics/none.island"), p.getIsland().getCenter());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    pl.teleport(p.getIsland().getSpawn());
                }
            }
        });
    } catch (Exception ex) {
        System.out.println(ex.toString());
    }
}
Also used : Player(org.bukkit.entity.Player) SPlayer(pixelssky.objects.SPlayer) SPlayer(pixelssky.objects.SPlayer) File(java.io.File)

Example 9 with SPlayer

use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.

the class Inventories method run_SubChallengesInventory.

public static void run_SubChallengesInventory(InventoryClickEvent event) {
    Player p = (Player) event.getWhoClicked();
    SPlayer sp = PlayersManager.getSPlayer(p);
    ItemStack i = event.getClickedInventory().getItem(event.getSlot());
    if (i != null) {
        ChallengesManager.getChallenge(event.getInventory().getName().split(":")[1]).getSubChallenges().get(event.getSlot()).complete(p, sp.getIsland());
        p.closeInventory();
    }
}
Also used : Player(org.bukkit.entity.Player) SPlayer(pixelssky.objects.SPlayer) SPlayer(pixelssky.objects.SPlayer) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

SPlayer (pixelssky.objects.SPlayer)9 Player (org.bukkit.entity.Player)8 ItemStack (org.bukkit.inventory.ItemStack)2 File (java.io.File)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 EventHandler (org.bukkit.event.EventHandler)1 Inventory (org.bukkit.inventory.Inventory)1 SkullMeta (org.bukkit.inventory.meta.SkullMeta)1 Challenge (pixelssky.objects.Challenge)1 Island (pixelssky.objects.Island)1