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) {
}
}
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
}
}
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());
}
}
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();
}
}
Aggregations