Java] why is it displayed like this?

En
- in Plugins
7

I currently program a Minecraft plugin, which now also has a so-called "team chat".

However, the API was probably changed, or I overlook any error.

Here is the code:

And the following is output as soon as you enter "/ tc abc":

">> Team | NAME >> [Ljava.lang.String; @ 5d1cbfa3"

What do I have to do, so that the following is given out?:

">> Team | NAME >> abc"

Ja

I recommend you to remove the sound. And why did you import the listener if you do not use it?

co

An array is output instead of a string.

args is an array.

You have to z.b. Use Arrays.toString (args).

En

Ou… Have not noticed that the listener is still there.

And why should I remove the sound? He does not bother and gives the whole thing a rounding off.

Ti

The args are in this case probably your chat message that you want to spend on all players. Of course you have to put them together again to a string.

Instead of

t.sendMessage (Main.Teampref + "§c" + p.getName () + "§8" §7 "+ args);

Try it with:

t.sendMessage (Main.Teampref + "§c" + p.getName () + "§8" §7 "+ args.join (" "));

For the sake of performance, you should create the string before the loop, so that .join () is not executed anew each time you run it.

Ja

Mmn the sound is extremely annoying to hear an explosion every time I enter a command, I do not feel as nice

En

I understand your view. However, we soon add that the sound only comes once in a certain time.

En

Thank you for your answer.

I have solved it this way:

String msg = "";

for (int i = 0; i msg = msg + args [i] + "";
}

And then I do not issue "args", but "msg".