-
Notifications
You must be signed in to change notification settings - Fork 33
Communication
##Console
To send a message to the Craftbukkit console just use the console command:
console(message1, ..., messagen) This behaves exactly the same as Kernel#print:
console 'Purugin stopped'##Yourself
The Bukkit API method for this is 'send_message'. This seemed too long and I got annoyed typing it, so I made an alias to a msg:
person.msg 'You have died'##Others
send_message/msg on any object reference to another player:
world.players.each do { |p| p.send_message 'P0wnd' }If you want every one in every world to see your message you can:
server.broadcast_message "All may see this message"##Colors
You can use a variety of colors by including the Purugin::Colors module:
person.msg red('Wicked red error message')You can also use the colorize method:
person.msg colorize("{yellow}mellow{green}apple")You can also use the special hex values for shortening the string (important for things like signs):
sign.text = colorize("&4mellow&dapple")Accepted color values: &0 - {white}, &1 - {orange}, &2 - {magenta}, &3 - {lightblue}, &4 - {yellow}, &5 - {lime}, &6 - {pink}, &7 - {gray}, &8 - {lightgray}, &9 - {cyan}, &a - {purple}, &b - {blue}, &c - {brown}, &d - {green}, &e - {red}, &f - {black}