#Get String from 2+ arguments

1 messages · Page 1 of 1 (latest)

crude moat
#

Hello, how I can get a string like "yes this is a string" from /test yes this is a string ?

#

Get String from 2+ arguments

broken pendant
#

String.join

thorn spire
#

String.join

crude moat
#

too easy and complicated at same time

thorn spire
#
@Override
    public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
        
        if(String.join(" ",args).equals("yes this is a string")) {
            System.out.println("This seems to be a String.");
        }
    }
#

lol

crude moat
#

now better, thanks 😂

crude moat
#

I need something like this

#

and this code does really nothing

#

I should save string.join in another string ?

wooden lichen
#

What does it print?

crude moat
#

nothing

#

I tried this too

#

and again nothing

wooden lichen
#

Try converting args to list

crude moat
#

I'm really new to spigot and java

wooden lichen
#

Check if the block is even evaluated

#

Did you set executor

#

Or is this method in your main class

crude moat
#

yea command works

wooden lichen
#

How did you ensure that

crude moat
#

with this

wooden lichen
#

Ah ok

wooden lichen
#

Arrays.asList()

crude moat
#

thanks

wooden lichen
crude moat
#

yea i find the problem

#

this works fine

#

thanks all for help

crude moat
wooden lichen
#

Huh how does that work when the previous version doesnt print anything

crude moat
#

and some bad thing .. nvm