How to Make Teams

Discussion in 'Plugin Development' started by Ty Cleere, Oct 11, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Ty Cleere

    Hey guys how would i go about making a team type thing. I need a way to be able to allow players to team with another player(s) and then when one of them clicks on a sign then they are all teleported to the same spot. So how would i be able to make it so that the player can type a command with a player(1 or more) after the command and then like "hook" them all together or something. Does anyone know what i am talking about? :p LOL Thanks!
     
  2. Offline

    Chactation

    Well, the way I'd go about it would be to make a HashMap which takes a Player as the key and a String (the team name) as the value. Have it so when they enter a command (I'd make it /team) that takes the arg[0] and places it into the HashMap with the sender as the key and the arg[0] as the value. Then when a player clicks the sign, check each online player's HashMap and teleport all players with a matching value (team) as the player who clicked the sign to the same place. I'm fairly certain it isn't the best method, but that's what I would do :)
     
  3. Offline

    Tehmaker

    Hashmap?
     
  4. Offline

    Rocoty

    Ty Cleere I'd make a Team class and work with that. More object oriented than HashMaps...but using HashMaps like Tehmaker said would probably work as well...it all depends on how you want to do it.
     
  5. Offline

    tommycake50

    I use a Team class which holds a HashMap and also a Scoreboard team for name coloring.
     
  6. Offline

    Ty Cleere

    Rocoty I just have no clue where to start. What do i start with? How do i use a hashmap to do teams? I have a teams command. But i dont know how to get players name out of a command that was typed and then be able to like "hook" them together...
     
  7. Offline

    tommycake50

    HashMap<String, String> first string is team second string is player.
     
  8. Offline

    Ty Cleere

    tommycake50 Ok. Should i just make this a new class? Would it be easier?
     
  9. Offline

    tommycake50

    It depends on what way will work best for you and your situation.
     
  10. Offline

    Ty Cleere

    tommycake50 Ok. Ill see what i can do. So the first string is the team and the second is the player?
     
  11. Offline

    tommycake50

    mhm.
     
Thread Status:
Not open for further replies.

Share This Page