use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.
the class EventListener method loginEvent.
@EventHandler(priority = EventPriority.HIGH)
public void loginEvent(PlayerLoginEvent event) {
Player pl = event.getPlayer();
SPlayer p = DatabaseManager.getPlayer(pl.getUniqueId().toString());
PlayersManager.setPlayer(p);
p.addOrSetData("Donnee 1", "3842");
}
use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.
the class IsCommand method onCommand.
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
// Sous commandes : go, h, home, spawn, l, level, lvl, sethome, top, rank, reset
try {
Player pl = (Player) arg0;
SPlayer p = PlayersManager.getSPlayer(pl);
if (arg3.length == 0) {
if (p.getIsland() == null) {
// ouvrir pour cr�er �le
pl.openInventory(Inventories.getCreateIslandMenu(p));
pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_XYLOPHONE, 100, 1000);
} else {
// Ouvrir inventaire de base
pl.openInventory(Inventories.getIslandMenu(p));
pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_GUITAR, 100, 100);
}
} else if (arg3[0].equals("create")) {
if (p.getIsland() != null) {
pl.openInventory(Inventories.getConfirmCreateIsland());
pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_XYLOPHONE, 100, 1000);
} else {
pl.openInventory(Inventories.getCreateIslandMenu(p));
pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_XYLOPHONE, 100, 1000);
}
} else if (arg3[0].equals("h")) {
pl.sendTitle("�aBienvenue sur votre �le :)", "�cNe tombez pas !", 10, 20, 10);
pl.teleport(p.getIsland().getSpawn());
} else if (arg3[0].equals("sethome")) {
pl.sendTitle("�aMise � jour effectu�e :)", "�cVotre home a chang� !", 10, 20, 10);
p.getIsland().setHome(pl.getLocation());
} else if (arg3[0].equals("top")) {
pl.sendMessage("Is top : ");
for (String i : Classement.getTop()) {
pl.sendMessage("ISLAND : " + i);
}
} else if (arg3[0].equals("level")) {
p.getIsland().calculateLevel(pl);
} else if (arg3[0].equals("invite")) {
pl.openInventory(Inventories.getPlayersInventory_invite(p));
} else if (arg3[0].equals("accept")) {
pl.sendTitle("�aVous venez d'accepter l'invation :p", "�cC'est parti!!!", 10, 20, 10);
p.setIsland(IslandsManager.getIsland(p.getLastIsInvite()));
p.getIsland().getMembers().add(p.getID());
pl.teleport(p.getIsland().getSpawn());
pl.playSound(pl.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 100, 100);
} else if (arg3[0].equals("try")) {
Challenge c = ChallengesManager.challenges.get(0).getSubChallenges().get(0);
c.complete(pl, p.getIsland());
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
return true;
}
use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.
the class DatabaseManager method getPlayer.
public static SPlayer getPlayer(String UUID) {
// TODO : renvoyer les donn�es du joueur
// cr�ation joueur vide
SPlayer p = new SPlayer("");
try {
// Connection
conn = DriverManager.getConnection(BDD_host, BDD_username, BDD_password);
stmt = conn.createStatement();
// Request
ResultSet res = stmt.executeQuery("SELECT * FROM `players` WHERE `UUID` LIKE '" + UUID + "';");
if (!res.isBeforeFirst()) {
// Si le joueur n'existe pas dans la BDD on le cr��
p.init(0, UUID, -1);
p.addOrSetData("Donn�eVide", null);
p.addRight(Right.getRight("island.invite"));
System.out.println("4");
stmt.executeUpdate("INSERT INTO `players` (`ID`, `UUID`, `ISLAND_ID`) VALUES (NULL, '" + p.getUUID() + "', '-1');");
System.out.println("5");
conn.close();
return getPlayer(UUID);
} else {
// Chargement des �l�ments de base
while (res.next()) {
p.init(res.getInt("ID"), UUID, res.getInt("ISLAND_ID"));
readPlayerData(p);
}
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("ERREUR GETPLAYER : " + e.toString());
}
return p;
}
use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.
the class Inventories method run_challengesMainInventory.
public static void run_challengesMainInventory(InventoryClickEvent event) {
Player p = (Player) event.getWhoClicked();
SPlayer sp = PlayersManager.getSPlayer(p);
ItemStack i = event.getClickedInventory().getItem(event.getSlot());
if (i != null) {
p.openInventory(getSubChallengeInventory(ChallengesManager.getChallenge(i.getI18NDisplayName()), sp.getIsland()));
}
}
use of pixelssky.objects.SPlayer in project PixelsSkyblock by dudullle.
the class Inventories method getPlayersInventory_invite.
public static Inventory getPlayersInventory_invite(SPlayer pl) {
Island i = pl.getIsland();
Inventory inv = Bukkit.createInventory(null, ((Bukkit.getOnlinePlayers().size()) / 9 + 1) * 9, "§6✉ §3Inviter des joueurs");
for (Player p : Bukkit.getOnlinePlayers()) {
if (!i.getMembers().contains(PlayersManager.getSPlayer(p).getID())) {
inv.addItem(Items.getHead(p));
}
}
return inv;
}
Aggregations