Send cmd from console?

Discussion in 'Plugin Development' started by Condolent, Jul 3, 2014.

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

    Condolent

    How do I set so commands can be sent from console?

    Example: I need to make so my reload command reloads my config-files, can be done in the console
     
  2. Offline

    MineCrashKoen

    If you create a command, by default it also works if the Console sends it. So what is the problem?
     
    Traks likes this.
  3. Offline

    Dubehh

    Condolent
    Like MineCrashKoen said, if you don't cast the sender to anything you'll be able to send the commands from the console.

    If you can't manage it to work, you've probably casted the sender to a player.
     
  4. Offline

    HungerCraftNL

    PHP:
    getSever().dispatchCommand(getServer().getConsoleSender"Command");
    you mean this?
     
  5. Offline

    Condolent

    MineCrashKoen Dubehh I get a long error, but I guess if I don't do anything like Player player = (Player) sender; it'll work?

    If it's that easy, here is the next question: how do I send a message to the console? Like instead of player.sendMessage("");
    What's the variable for Console, I guess.
     
  6. Offline

    Epixpenguin

    Condolent
    Usually you can send a message through the console by using System.out.println("Message"); but otherwisse you can use getServer().getLogger().info("Message");
     
  7. Offline

    MineCrashKoen

  8. Offline

    Condolent

    MineCrashKoen so how do I set sender as console? Like replace Player player = (Player) sender; What's the right variable that I should replace Player with??
     
  9. Offline

    Gater12

    Condolent
    You could do sender.sendMessage
     
  10. Offline

    Condolent

    Gater12 oh, so if it's from the console, I simply just do sender.sendMessage and skip the definition of sender?
     
Thread Status:
Not open for further replies.

Share This Page