Make ReportNotification capable of sending json messages.

This commit is contained in:
Keir 2015-10-27 22:26:02 +00:00
parent cb1c779f37
commit 4ceb8f20aa
1 changed files with 12 additions and 5 deletions

View File

@ -1,20 +1,26 @@
package mineplex.core.report.command;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.UtilServer;
import mineplex.core.report.ReportManager;
import mineplex.serverdata.commands.ServerCommand;
public class ReportNotification extends ServerCommand
{
// TODO: Encode in JSON-interactive chat message
private String notification;
private String _notification;
public ReportNotification(String notification)
{
this(new JsonMessage(notification));
}
public ReportNotification(JsonMessage notification)
{
super(); // Send to all servers
this._notification = notification.toString();
}
public void run()
@ -24,7 +30,8 @@ public class ReportNotification extends ServerCommand
{
if (ReportManager.getInstance().hasReportNotifications(player))
{
player.sendMessage(notification);
Server server = UtilServer.getServer();
server.dispatchCommand(server.getConsoleSender(), "tellraw " + player.getName() + " " + _notification);
}
}
}