Need Some help...

Discussion in 'Plugin Development' started by Rmarmorstein, Apr 24, 2013.

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

    Rmarmorstein

    I need some help. I am working on a Custom Staff chat plugin for my server, as a practice with java.

    It is Very Simple at the moment, and I am sure this question is going to seem very, very noobish, but, I'm asking anyway. Please don't tell me to go and learn java, I am currently learning it, so please try and help me :p

    This is my Command Executor Class, so far... http://pastebin.com/dB8Z5VyZ

    It sends, and it works exactly like it is supposed to in the code, but not the way that I want it.

    This is how it currently works..
    [​IMG]

    You can probably intend that I want to keep it all on one line. How is this possible? After i figure this out, it is just simple formatting. Thank you!
     
  2. Offline

    Darq

  3. Offline

    Rmarmorstein

    This makes it easier, but the message has to be a string. The thing that I am trying to get at, is how do i get the,

    Code:
    public boolean onCommand(CommandSender sndr, Command cmd, String label, String[] args)
    The arguments, to be all together, so that I can use all of them.

    So, if a user does /sc hello

    it will print to the users with the permission hello

    and if they do /sc hello world

    it will tell them hello world.

    The broadcast that you gave me, makes that easier, but I am still having trouble getting the arguments into a format that they can go into the Bukkit.broadcast.

    Do you understand, I may not be explaining this well..
     
  4. Offline

    kreashenz

    Bukkit.broadcastMessage(msg);.
     
  5. Offline

    ZeusAllMighty11 Retired Staff

    Code:
    if(commandLabel.equalsIgnoreCase("all")) {
        if(!(sender instanceof Player))
            return false;
        if (args.length == 0)
            return false;
           
        Player player = (Player) sender;
           
        String msg = StringUtils.join(args, " ");
        Bukkit.broadcastMessage("[All] <" + player.getDisplayName() + "> " + msg);
    }
    
    Or stringbuilder

    Code:
    StringBuilder sb = new StringBuilder;
    for(int i = 0; i < args.length; i++){
    sb.append(args).append(" ");
    }
    String messagetobroadcast = sb.toString();
    
     
    Rmarmorstein likes this.
  6. Offline

    Rmarmorstein

Thread Status:
Not open for further replies.

Share This Page