Jump to content
Existing user? Sign In

Sign In



Sign Up

[Elvarg]Ticket System


Sanity

Recommended Posts

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

  • 1 year later...
  • 3 years later...
  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Contact

[email protected]

astra.security

What is a RSPS?

A RSPS, also known as RuneScape private server, is an online game based on RuneScape, and controlled by independent individuals.

Popular RSPS Servers

Runewild Ikov RedemptionRSPS

Disclaimer

Runesuite is not affiliated with runescape, jagex in any way & exists solely for educational purposes.

×
×
  • Create New...