Need Some help...

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

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


    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...

    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..

    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


  3. Offline


    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,

    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


  5. Offline

    ZeusAllMighty11 Retired Staff

    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

    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


Thread Status:
Not open for further replies.

Share This Page