Ticket notifications

Added feature request notifications for tickets (Create, Response, Status)
This commit is contained in:
Taylor Rhys Brennan 2019-10-21 10:53:36 +01:00
parent 63caaef3db
commit 838d1640ae
3 changed files with 14 additions and 3 deletions

View File

@ -18,16 +18,18 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.songoda.ultimatemoderation.staffchat.*;
public class GUITicket extends AbstractGUI {
private final UltimateModeration plugin;
private StaffChatManager chatManager = UltimateModeration.getInstance().getStaffChatManager();
private final Ticket ticket;
private final OfflinePlayer toModerate;
private int page = 0;
public GUITicket(UltimateModeration plugin, Ticket ticket, OfflinePlayer toModerate, Player player) {
super(player);
this.ticket = ticket;
@ -134,6 +136,8 @@ public class GUITicket extends AbstractGUI {
if (player.hasPermission("um.tickets.openclose")) {
registerClickable(5, ((player1, inventory1, cursor, slot, type) -> {
ticket.setStatus(ticket.getStatus() == TicketStatus.OPEN ? TicketStatus.CLOSED : TicketStatus.OPEN);
// Notify staff of ticket status
chatManager.getChat("ticket").messageAll("&7[UM] &a[Ticket #" + ticket.getTicketId() + " - " + ticket.getType() + " - " + Bukkit.getPlayer(ticket.getVictim()).getDisplayName() + "&a] New Status: &6" + ticket.getStatus());
constructGUI();
}));
}
@ -143,6 +147,8 @@ public class GUITicket extends AbstractGUI {
player.sendMessage(plugin.getLocale().getMessage("gui.ticket.what").getMessage());
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event2 -> {
ticket.addResponse(new TicketResponse(player, event2.getMessage(), System.currentTimeMillis()));
// Notify staff of ticket response.
chatManager.getChat("ticket").messageAll("&7[UM] &a[Ticket #" + ticket.getTicketId() + " - " + ticket.getType() + " - " + Bukkit.getPlayer(ticket.getVictim()).getDisplayName() + "&a] Has a new response!");
constructGUI();
});

View File

@ -9,12 +9,15 @@ import com.songoda.ultimatemoderation.settings.Settings;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import com.songoda.ultimatemoderation.staffchat.*;
import java.util.List;
import org.bukkit.Bukkit;
public class GUITicketType extends AbstractGUI {
private final UltimateModeration plugin;
private StaffChatManager chatManager = UltimateModeration.getInstance().getStaffChatManager();
private final OfflinePlayer toModerate;
private final String subject;
@ -44,6 +47,8 @@ public class GUITicketType extends AbstractGUI {
player.sendMessage(plugin.getLocale().getMessage("gui.tickets.what").getMessage());
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event2 -> {
plugin.getTicketManager().addTicket(ticket);
// Notify staff
chatManager.getChat("ticket").messageAll("&7[UM] &a[Ticket #" + ticket.getTicketId() + " - " + ticket.getType() + " - " + Bukkit.getPlayer(ticket.getVictim()).getDisplayName() + "&a] Has been created!");
if (player == toModerate)
ticket.setLocation(player.getLocation());
ticket.addResponse(new TicketResponse(player, event2.getMessage(), System.currentTimeMillis()));

View File

@ -62,7 +62,7 @@ public class StaffChannel {
.processPlaceholder("message", message).getMessage());
}
private void messageAll(String message) {
public void messageAll(String message) {
chatLog.add(message);
for (Player player : Bukkit.getOnlinePlayers()) {
if (!members.contains(player.getUniqueId()) && !player.hasPermission("um.staffchat.spy")) continue;