Colored Strings?

CanaryMod related discussions

Colored Strings?

Postby Rash_SR » Sun Feb 21, 2016 7:53 pm

hello guys!
I have a simple question..
How i can use colored strings and send it as a ingame text message?
with this code i can send a message in the chatbox as the server:

String msg = "text";
Canary.instance().getServer().broadcastMessage(msg);

but how i can use colors?
Rash_SR
 
Posts: 11
Joined: Mon Jan 18, 2016 5:58 pm

Re: Colored Strings?

Postby Scoin0 » Mon Feb 22, 2016 12:10 am

Rash_SR wrote:hello guys!
I have a simple question..
How i can use colored strings and send it as a ingame text message?
with this code i can send a message in the chatbox as the server:

String msg = "text";
Canary.instance().getServer().broadcastMessage(msg);

but how i can use colors?


If I remember it correctly it's TextFormat.COLOR HERE.
So for you it could be Canary.instance().getServer().broadcastMessage(TextFormat.RED + msg);
I help out when I can. :)
Discord: scoin0
User avatar
Scoin0
 
Posts: 29
Joined: Mon Aug 17, 2015 8:11 pm
Location: Hawaii

Re: Colored Strings?

Postby Rash_SR » Mon Feb 22, 2016 8:51 am

thank you!! it works :))
Rash_SR
 
Posts: 11
Joined: Mon Jan 18, 2016 5:58 pm

Re: Colored Strings?

Postby Scoin0 » Mon Feb 22, 2016 7:50 pm

Don't forget to look at the documentation. If you have a problem such as the TextFormat you could look there. Also here's all the stuff for TextFormat: http://docs.visualillusionsent.net/Cana ... ormat.html.

Cheers.
I help out when I can. :)
Discord: scoin0
User avatar
Scoin0
 
Posts: 29
Joined: Mon Aug 17, 2015 8:11 pm
Location: Hawaii

Re: Colored Strings?

Postby BluXDragon » Wed Mar 02, 2016 8:52 pm

In the latest versions it's ChatFormat, by the way.

DISCLAIMER: Unless I'm pulling some weird fork of Canary that I shouldn't be.
BluXDragon
 
Posts: 1
Joined: Wed Feb 17, 2016 11:03 pm

Re: Colored Strings?

Postby Scoin0 » Sat Mar 05, 2016 9:49 am

BluXDragon wrote:In the latest versions it's ChatFormat, by the way.

DISCLAIMER: Unless I'm pulling some weird fork of Canary that I shouldn't be.


You're probably right. I've just always remembered using TextFormat. I guess it changed a few times. I got confused. :/

EDIT: Also welcome back :D
I help out when I can. :)
Discord: scoin0
User avatar
Scoin0
 
Posts: 29
Joined: Mon Aug 17, 2015 8:11 pm
Location: Hawaii

Re: Colored Strings?

Postby Rash_SR » Wed Mar 09, 2016 10:19 pm

Scoin0 wrote:
BluXDragon wrote:In the latest versions it's ChatFormat, by the way.

DISCLAIMER: Unless I'm pulling some weird fork of Canary that I shouldn't be.


You're probably right. I've just always remembered using TextFormat. I guess it changed a few times. I got confused. :/

EDIT: Also welcome back :D


yeah thats true and i see it in the documentation.
thanks for the help!
Rash_SR
 
Posts: 11
Joined: Mon Jan 18, 2016 5:58 pm


Return to Discussions

Who is online

Users browsing this forum: No registered users and 5 guests

cron