Get full command

Discussion in 'Plugin Development' started by Proxygames14, Jul 1, 2017.

Thread Status:
Not open for further replies.
  1. Im making a part! And I already got this


    Code:
     
       @EventHandler
         public void AddFormat(PlayerCommandPreprocessEvent event) {
             if(event.getMessage().startsWith("/shout") ) {
                 MainForm.a(event.getMessage());
             }
         }
    
    So for example I type [/shout hey] (It returns "hey")
    But If I want multiple spaces after each other like [/shout hey] (It returns " hey")
    Is there any way for me to create a shout command that gets all the spaces in the command so I can 100% send the exact message to everyone with multiple spaces?

    IS this possbile Yes? How?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Proxygames14 1. Use the onCommand method please instead of the event.
    2. Get all arguments, add them together to the same string, do add spaces though.
     
  3. I know how to add them in the StringBuilder But could you give me an example of adding spaces? Instead of 1 each Because sometimes I use 2 bewteen agrument
     
  4. Offline

    timtower Administrator Administrator Moderator

    @Proxygames14 Just append a space.
    Don't know how the arguments look at double spaces.
     
  5. Server hive has that system! They cound the spaces
     
  6. Offline

    timtower Administrator Administrator Moderator

    @Proxygames14 There probably are ways, I am just saying that I don't know how Bukkit handles it.
    Print all arguments to the console when using double spaces, curious about the result.
     
Thread Status:
Not open for further replies.

Share This Page