Solved Programming something like a bot

Discussion in 'Plugin Development' started by Typ, Feb 23, 2017.

Thread Status:
Not open for further replies.
  1. Hello,
    I want to make a bot (or how you name it). It has to check some commands, after Serverrestart, if they are working fine, so I mean only commands, that send a message.
    How can I do that, do I really Need a bot, or a virtual Player or can I do that somehow else?

    greetings Typ
     
  2. Offline

    MrGeneralQ

    That my friend in bukkit is what we call "A plugin" :p
     
  3. Offline

    timtower Administrator Administrator Moderator

    @Typ How would it check if the commands ran succesfull?
     
  4. Maybe if it is like a real Player and executes a command, for example it makes /ping and if the Server answers with "unknown command", it knows, this command doesn't work, else is knows the command works.
    The Problem is, that many commands only work, if a Player sent them... So how can I do that?
     
  5. Offline

    Zombie_Striker

    @Typ
    To check if a sender is a player, use
    Code:
    if(*sender* instanceof Player){
     sender.sendMessage("Only players can use this command.");
     return true;
    }
    Where *sender* is the CommandSender instance.
     
  6. I know how to check, if ist a Player. And there's also the Problem: Most plugin-commands only can be used by a Player, so if I want to check with a plugin, if the commands a working, i can't use console to send this command, I Need a not real Player, which types in the command an checks out, what it gets as answer
     
  7. Offline

    Zombie_Striker

    @Typ
    So, if I deciphered your post correctly, you want a way to access player commands through a console by creating a fake player. Is this correct? If so, then I have to tell you this cannot be done. You need real player instances in order to send commands, so there is no way to create a fake player for this.

    What is the purpose of this? Is this meant for all commands, or for a few specific ones? Most likely, there is a better way of doing this.
     
  8. Yes, this is what I wanted to do, but I found another solution now, thanks very much :D
     
  9. Offline

    MrGeneralQ

    Feel free to share the solution with the community so everyone knows ;)
     
Thread Status:
Not open for further replies.

Share This Page