Solved Teleport to ArmorStand with name of var

Discussion in 'Plugin Development' started by MrLucTV, Sep 21, 2018.

Thread Status:
Not open for further replies.
  1. Hello,

    I want the player to be teleported to the ArmorStand linked with the Item (Name is the number after the name).
    But I couldn't work out how I can tp the player to an Entity or ArmorStand with a specific Name.
    Could you help me?

    Code:

    Code:
     @EventHandler
        public void onCamClick(InventoryClickEvent e) {
            Player player = (Player) e.getWhoClicked();
         
            if(!e.getInventory().getTitle().equals("§1§6§nUI")) {
                e.setCancelled(true);
            }
         
            if(e.getCurrentItem().getType().equals(Material.OBSERVER)) {
                Bukkit.broadcastMessage("click");
                String camItemName = e.getCurrentItem().getItemMeta().getDisplayName();
                String[] splittedCamItemName = camItemName.split(" ");
                String camStringNum = splittedCamItemName[1];
                int camNum = Integer.parseInt(camStringNum);
                Bukkit.broadcastMessage(camStringNum);
                //go on here
    SOLVED: I made a Command that is executed when clicked on the Item which tps you to an ArmorStand with the name "cam + camNum" and pass the vars!
    And I had to move the if(!e.getInv...) below the if(e.getCurrentItem...) ^^
     
    Last edited: Sep 21, 2018
Thread Status:
Not open for further replies.

Share This Page