Staff Messages & Tickets In-Game
Added method for using TextComponents for staff messages Added callback so tickets get reported to staff in-gamemaster
parent
0a7c12536a
commit
0920ecce90
|
@ -64,6 +64,16 @@ public class MCMUtil {
|
||||||
Bukkit.getConsoleSender().sendMessage(message);
|
Bukkit.getConsoleSender().sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void staffMessage(TextComponent message) {
|
||||||
|
log(staffLog, message.getText());
|
||||||
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
if (player.hasPermission("minecraftmanager.staff")) {
|
||||||
|
player.spigot().sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Bukkit.getConsoleSender().sendMessage(message.getText());
|
||||||
|
}
|
||||||
|
|
||||||
public static void globalMessage(String message) {
|
public static void globalMessage(String message) {
|
||||||
log(globalLog, message);
|
log(globalLog, message);
|
||||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package xyz.etztech.minecraftmanager.command;
|
package xyz.etztech.minecraftmanager.command;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -11,6 +14,7 @@ import org.bukkit.entity.Player;
|
||||||
import xyz.etztech.core.web.CoreWeb;
|
import xyz.etztech.core.web.CoreWeb;
|
||||||
import xyz.etztech.core.web.ICallback;
|
import xyz.etztech.core.web.ICallback;
|
||||||
import xyz.etztech.minecraftmanager.MCMAPI;
|
import xyz.etztech.minecraftmanager.MCMAPI;
|
||||||
|
import xyz.etztech.minecraftmanager.MCMUtil;
|
||||||
import xyz.etztech.minecraftmanager.objects.MCMResponse;
|
import xyz.etztech.minecraftmanager.objects.MCMResponse;
|
||||||
import xyz.etztech.minecraftmanager.MinecraftManager;
|
import xyz.etztech.minecraftmanager.MinecraftManager;
|
||||||
|
|
||||||
|
@ -35,6 +39,13 @@ public class CommandTicket implements CommandExecutor {
|
||||||
public void invoke(String s) {
|
public void invoke(String s) {
|
||||||
MCMResponse response = new MCMResponse(s);
|
MCMResponse response = new MCMResponse(s);
|
||||||
player.sendMessage(response.getMCMessage());
|
player.sendMessage(response.getMCMessage());
|
||||||
|
try {
|
||||||
|
JsonObject extra = (JsonObject) response.getExtra();
|
||||||
|
TextComponent message = new TextComponent(ChatColor.GREEN + "New Ticket #" +
|
||||||
|
extra.get("id").getAsString() + ". Click for more info.");
|
||||||
|
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, extra.get("link").getAsString()));
|
||||||
|
MCMUtil.staffMessage(message);
|
||||||
|
} catch (Exception ex) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue