Sanity 436 Posted September 28, 2017 Report Share Posted September 28, 2017 Ticket system where a player requests a ticket, a message would then be sent to the staff online and could then be accepted. package com.elvarg.game.content.ticket; import com.elvarg.game.World; import com.elvarg.game.entity.impl.player.Player; import com.elvarg.util.Misc; import java.util.*; import java.util.stream.Collectors; public class TicketManager { private final Queue<TicketEntry> entries = new ArrayDeque<>(); public static final TicketManager INSTANCE = new TicketManager(); public void acceptRequest(Player staff) { if (entries.peek() == null) { staff.getPacketSender().sendMessage("No tickets have been requested."); return; } TicketEntry entry = entries.peek(); entries.poll(); Player player = entry.getRequester(); player.getPacketSender().sendMessage(staff.getUsername() + " has accepted your ticket"); staff.getPacketSender().sendMessage("Teleporting to " + player.getUsername()); staff.moveTo(player.getPosition().copy()); staff.forceChat("How may I help you " + Misc.capitalize(player.getUsername()) + "?"); } package com.elvarg.game.content.ticket; import com.elvarg.game.entity.impl.player.Player; public final class TicketEntry { private final Player requester; public TicketEntry(Player requester) { this.requester = requester; } public Player getRequester() { return requester; } } Add this OwnerCommands if (parts[0].startsWith("acceptticket")) { TicketManager.INSTANCE.acceptRequest(player); } Add this under PlayerCommands if (parts[0].startsWith("request")) { TicketManager.INSTANCE.requestTicket(player); } Link to comment Share on other sites More sharing options...
Macca187 8 Posted January 11, 2019 Report Share Posted January 11, 2019 Friendly bump Link to comment Share on other sites More sharing options...
Ary3x 0 Posted February 14, 2022 Report Share Posted February 14, 2022 Very cool will use! Link to comment Share on other sites More sharing options...
Delusional 5 Posted April 20, 2023 Report Share Posted April 20, 2023 Thanks for the release ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now