Execute a command from another plugin.

Discussion in 'Plugin Development' started by MeTim, Jul 2, 2013.

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

    MeTim

    Is this possible? Because i have no clue how to do it...
     
  2. Offline

    MP5K

    Hello MeTim,
    Yes it is by using:
    Code:java
    1. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "say My Command got executed!");

    but are you sure you don't want to hook in the other Plugin and using it's API to achieve your goal?
     
  3. Offline

    ProtoTempus

    Yes! if you have the Player class, use .performCommand("command");
     
  4. Offline

    MeTim

    MP5K Can the consoleSender be a player? i mean:
    Code:
    Bukkit.getServer().dispatchCommand("playerhere", "heal");
    ProtoTempus That should work thanks :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  5. Offline

    MP5K

    Code:java
    1. Bukkit.getServer().dispatchCommand(Bukkit.getPlayerExact("playerhere"), "heal");

    or just:
    Code:java
    1. Bukkit.getPlayerExact("player")..performCommand("heal")"

    or if you want to heal the player just:
    Code:java
    1. PLAYER_OBJECT.setHealth(PLAYER_OBJECT.getMaxHealth());
     
Thread Status:
Not open for further replies.

Share This Page