Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler(priority = EventPriority.HIGH)
- public void onInventroyClick(InventoryClickEvent e){
- Player p = (Player) e.getWhoClicked();
- if(e.getSlotType() != SlotType.OUTSIDE){
- if(e.getCurrentItem() != null | e.getCurrentItem().getType() == Material.AIR){
- if(!e.getCurrentItem().hasItemMeta()){
- return;
- }
- if(e.getInventory().getName() == "§9Spiel auswählen"){
- ConfigurationSection publicSection = MainClass.cfg.getConfigurationSection("GamePoints");
- ArrayList<GamePoint> gl = new ArrayList<GamePoint>();
- gl.clear();
- for (String g : publicSection.getKeys(false)){
- String c = "GamePoints." + g + ".";
- String ci = "GamePoints." + g + ".Item.";
- GamePoint gp = new GamePoint(g, null, null, 0);
- gp.setName(g);
- GameItem gi = new GameItem(g, null, 0, null);
- String ChatName = MainClass.cfg.getString(c + "ChatName");
- int Slot = MainClass.cfg.getInt(c + "Slot");
- double x = MainClass.cfg.getDouble(c + "X");
- double y = MainClass.cfg.getDouble(c + "Y");
- double z = MainClass.cfg.getDouble(c + "Z");
- double yaw = MainClass.cfg.getDouble(c + "Yaw");
- double pitch = MainClass.cfg.getDouble(c + "Pitch");
- World w = Bukkit.getWorld(MainClass.cfg.getString(c + "World"));
- Location Loc = new Location(w, x, y, z,(float) yaw,(float) pitch);
- String Displayname = MainClass.cfg.getString(ci + "DisplayName");
- String Lore1 = MainClass.cfg.getString(ci + "Lore1");
- String Lore2 = MainClass.cfg.getString(ci + "Lore2");
- ArrayList<String> Lore = new ArrayList<String>();
- if(Lore1 != null & Lore1 != ""){Lore.add(Lore1);}
- if(Lore2 != null & Lore2 != ""){Lore.add(Lore2);}
- Integer Amount = MainClass.cfg.getInt(ci + "Amount");
- Integer ID = MainClass.cfg.getInt(ci + "Material");
- short Short = (short) MainClass.cfg.getInt(ci + "Short");
- gi.setDisplayName(Displayname.toString());
- gi.setLore(Lore);
- gi.setMaterial(ID);
- gi.setShort(Short);
- gi.setAmount(Amount);
- gp.setChatName(ChatName);
- gp.setSlot(Slot);
- gp.setLocation(Loc);
- gp.setGameItem(gi);
- gl.add(gp);
- Bukkit.broadcastMessage("GL: " + gp);
- }
- ItemStack i = e.getCurrentItem();
- for(GamePoint gp : gl){
- if(gp.getGameItem().getDisplayName() == i.getItemMeta().getDisplayName()){
- p.teleport(gp.getLocation());
- p.sendMessage("§aDu wurdest zum Spiel §e"+gp.getChatName()+"§a teleportiert.");
- return;
- }
- }
- }
- }
- } else {
- p.closeInventory();
- e.setCancelled(true);
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement