Solved Setting up a teams system

Discussion in 'Spigot Plugin Help' started by KyleTheHacker, Oct 13, 2017.

  1. I've been racking my brain for days on a flexible party system. What I have now is a static class that stores party objects, and can only obtain parties via the party host (which kinda sucks if someone in the party is trying to invite someone else). I'm using UUIDs.

    I thought about an ArrayList of players that are hosts, but that wouldn't work because, for example, someone inside the party wants to leave, but you have to type in the name of your host before you leave. Kinda inefficient.

    Anyone have an idea as how I'd go about it?
  2. I mean, you could have a party object, a party leader/owner object, and a party member object.

    And the leader and member object would be inside of the party object,
    So the party always knows who its owner is, who the members are, so
    different actors have access to different party functions.

    Therefore if the owner invites someone, that invited player would
    join the party as soon as they choose to accept the invite.

    Where if a member invites someone, the invite goes to the party
    leader for approval and then goes to the target player before they can
    accept and join.

    Something like that, is how I'd do it.
  3. Im currently using the Parties plugin available here on spigot for a couple projects, its quite flexible and the API is easy to work with you can integrate it into your plugin and probably do most anything you're looking to do!.

    Or as mentioned above create yourself a object that has all the fields you'll need in it, below is a snippet from one of mine where players can create tribes, where there's three ranks, there are a lot of fields in there which you won't need obviously but it should give you an idea of the information you can store on a per party basis.

    just invoke new Tribe(player); and it runs the constructor, sets up the basics and add it to the master Tribe list.
    #3 dNiym, Oct 13, 2017
    Last edited: Oct 13, 2017
  4. As VirusBrandon said. Have a Party object storing all the players, and the leader separately. Then, if you're going to have an invitation system, every party should have a list of invited players. Everytime you do /party join <name> or whatever it'll go through the parties and check if the player is on their invitation list, and if they are add them to the party.
  5. Thank you guys for the suggestions. It, however isn't 100% my answer. How should I store the party? I tried a list already, but it didn't work out as it should. I also tried a HashMap<Integer, Party>, but it was to difficult to retrieve them for the player.
  6. Why is the list idea not working? I made a party system for a server, and I'm using a list for all the parties.
  7. How should I retrieve it? looping through it never works the way I want it to.
  8. Use a normal for loop, in-case a new party is created while you're looping through all the parties. Then get the party by an index in the list.
  9. And I'd retrieve the players in the party by UUID?
  10. To get what party a player is in, loop through the parties and check if that parties list of players contains the one you're looking for.
  11. got it. Thanks!

    aaand...... solved.

Share This Page