How can i force the player to run a command ?

Discussion in 'Plugin Development' started by WATWtomanik3, Jun 7, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    WATWtomanik3

    Hello i would like to force a player to run a command when the item grass is clicked in Compassinventory.

    CODE :

    Code:
        // GRASS || COMPASS INTERACT EVENT \\
        public void onInventoryClick(InventoryClickEvent event) {
           
            Player player = (Player) event.getWhoClicked();
            ItemStack clicked = event.getCurrentItem();
            Inventory inventory = event.getInventory();
           
            if (inventory.getName().equals(Compassinventory.getName())) {
               
                if (clicked.getType() == Material.GRASS) {
                   
                    event.setCancelled(true);
                    // HERE I WOULD LIKE TO FORCE A PLAYER TO USE A COMMAND ./server skyblock
                   
                }
            }
           
        }
     
  2. Offline

    Googlelover1234

  3. Offline

    WATWtomanik3

    @Googlelover1234 Do i need to register the command in my plugin.yml ? (the command server skyblock is from bungee)
     
  4. Offline

    Googlelover1234

    @WATWtomanik3
    No, the method will simply force the player to run that command. If the command is registered (or even if it's not) the player will run that command. For BungeeCord, you need to use the link I provided above, as it'll be the only way to send the player to another server.
     
  5. Offline

    timtower Administrator Administrator Moderator

    Locked.
    Bungeecord requires offline mode, offline mode is not supported.
     
Thread Status:
Not open for further replies.

Share This Page