Custom Console CommandSender

Discussion in 'Spigot Plugin Development' started by AndrewAubury, Jun 7, 2017.

Thread Status:
Not open for further replies.
  1. Hello so on my most recent plugin i want to have a plugin issue commands as console with a custom name right now it says

    Code (Text):
    CONSOLE issued server command: /give _____Andrew_____ bedrock 64
    but i would like it to show like
    Code (Text):
    plugin_name issued server command: /give _____Andrew_____ bedrock 64
    Here is my code to how i am running commands as console
    Code (Text):
        public void command(String cmd){
           getServer().dispatchCommand(getServer().getConsoleSender(),cmd);
        }
    Is this possible?
     
  2. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "someCommand");

    Is that what you mean?
     
  3. Nooo i mean replace the name of it so it says in the console that Andrew did a command not CONSOLE
     
  4. Mas

    Mas

    In Bukkit.dispatchCommand you provide a CommandSender argument. To do this you would need to create a custom CommandSender (Extending ConsoleCommandSender possibly) and override the getName() method your plugin's name. I'm not 100% sure if this would work.
     
    • Informative Informative x 1
  5. thanks man i didn't think of that but its working with that :)
     
    • Like Like x 1
Thread Status:
Not open for further replies.