PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotMessage.java

56 lines
1.4 KiB
Java
Raw Normal View History

2015-08-26 00:35:32 +02:00
package com.intellectualcrafters.plot.object;
2015-08-29 10:47:56 +02:00
import com.intellectualcrafters.plot.config.C;
2015-08-26 00:35:32 +02:00
import com.intellectualcrafters.plot.util.ChatManager;
2015-09-13 06:04:31 +02:00
public class PlotMessage {
2015-09-11 12:09:22 +02:00
private final Object builder;
2015-09-13 06:04:31 +02:00
public PlotMessage() {
2015-09-11 12:09:22 +02:00
builder = ChatManager.manager.builder();
2015-08-26 00:35:32 +02:00
}
2015-09-13 06:04:31 +02:00
public <T> T $(final ChatManager<T> manager) {
2015-08-26 00:35:32 +02:00
return (T) builder;
}
2015-09-13 06:04:31 +02:00
public PlotMessage(final String text) {
2015-08-26 00:35:32 +02:00
this();
text(text);
}
2015-09-13 06:04:31 +02:00
public PlotMessage text(final String text) {
2015-08-26 00:35:32 +02:00
ChatManager.manager.text(this, text);
return this;
}
2015-09-13 06:04:31 +02:00
public PlotMessage tooltip(final PlotMessage... tooltip) {
2015-08-26 00:35:32 +02:00
ChatManager.manager.tooltip(this, tooltip);
return this;
}
2015-09-13 06:04:31 +02:00
public PlotMessage tooltip(final String tooltip) {
2015-08-26 00:35:32 +02:00
return tooltip(new PlotMessage(tooltip));
}
2015-09-13 06:04:31 +02:00
public PlotMessage command(final String command) {
2015-08-26 00:35:32 +02:00
ChatManager.manager.command(this, command);
return this;
}
2015-09-13 06:04:31 +02:00
public PlotMessage suggest(final String command) {
2015-08-26 00:35:32 +02:00
ChatManager.manager.suggest(this, command);
return this;
}
2015-09-13 06:04:31 +02:00
public PlotMessage color(final String color) {
2015-08-29 10:47:56 +02:00
ChatManager.manager.color(this, C.color(color));
2015-08-26 00:35:32 +02:00
return this;
}
2015-09-13 06:04:31 +02:00
public void send(final PlotPlayer player) {
2015-08-26 00:35:32 +02:00
ChatManager.manager.send(this, player);
}
}