2015-08-26 00:35:32 +02:00
|
|
|
package com.plotsquared.bukkit.util;
|
|
|
|
|
|
|
|
import com.intellectualcrafters.plot.object.PlotMessage;
|
|
|
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
|
|
import com.intellectualcrafters.plot.util.ChatManager;
|
2016-02-14 02:01:18 +01:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2015-08-26 00:35:32 +02:00
|
|
|
|
2015-09-13 06:04:31 +02:00
|
|
|
public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
@Override
|
2015-09-13 06:04:31 +02:00
|
|
|
public List<StringBuilder> builder() {
|
2016-02-14 02:01:18 +01:00
|
|
|
return new ArrayList<>();
|
2015-08-26 00:35:32 +02:00
|
|
|
}
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
@Override
|
2016-04-19 22:59:10 +02:00
|
|
|
public void color(PlotMessage message, String color) {
|
|
|
|
List<StringBuilder> parts = message.$(this);
|
2015-08-26 00:35:32 +02:00
|
|
|
parts.get(parts.size() - 1).insert(0, color);
|
|
|
|
}
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
@Override
|
2016-04-30 00:14:12 +02:00
|
|
|
public void tooltip(PlotMessage message, PlotMessage... tooltips) {}
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
@Override
|
2016-04-30 00:14:12 +02:00
|
|
|
public void command(PlotMessage message, String command) {}
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
@Override
|
2016-04-19 22:59:10 +02:00
|
|
|
public void text(PlotMessage message, String text) {
|
|
|
|
message.$(this).add(new StringBuilder(ChatColor.stripColor(text)));
|
2015-08-26 00:35:32 +02:00
|
|
|
}
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
@Override
|
2016-04-19 22:59:10 +02:00
|
|
|
public void send(PlotMessage plotMessage, PlotPlayer player) {
|
2016-03-23 02:41:37 +01:00
|
|
|
StringBuilder built = new StringBuilder();
|
2016-04-19 22:59:10 +02:00
|
|
|
for (StringBuilder sb : plotMessage.$(this)) {
|
2015-08-26 00:35:32 +02:00
|
|
|
built.append(sb);
|
|
|
|
}
|
|
|
|
player.sendMessage(built.toString());
|
|
|
|
}
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
@Override
|
2016-04-30 00:14:12 +02:00
|
|
|
public void suggest(PlotMessage plotMessage, String command) {}
|
2016-02-14 02:01:18 +01:00
|
|
|
|
2015-08-26 00:35:32 +02:00
|
|
|
}
|