Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How can I have a player be "on" two teams at a time?

Writer Sebastian Wright

I know that the question might be phrased in a way that confuses people, so please suggest edits.

My dilemma is this: I have teams, set up with a scoreboard. These are Winner and Player, for a PvP minigame in development.

I also want to add classes, however. My way of doing this now would be to create a team like classUnlocked and put players onto it as they unlock a certain class.

Sadly, minecraft can only have a player be on one team at once. How would I keep the Winner/Player system and also add Classes that can be permanently unlocked for a specific group of players? (the ones who purchased it)

2 Answers

Use the right tool for the job

Scoreboard teams have some unique features in that any player can only be in one team, they have special treatment for /spreadplayers and a variety of options regarding visibility and other things.

None of what you are doing truly seems to require teams at all. Why is there a player team? Why is there a Winner team? As in: In how far do you benefit from making them teams rather than something else (see below). The same is true for your class unlocks.

Use scoreboard objectives or tags instead

Both serve the purpose of adding an arbitarily high amount of properties to a player. Using objectives for this is a bit strange, however, which is the primary reason why Mojang introduced scoreboard tags in Minecraft 1.9.

If you are using 1.9 and can therefore use tags, it's as simple as

scoreboard players tag <targetSelector> add unlockKnight

You can now use @a[tag=unlockKnight] or @a[tag=!unlockKnight] as selectors in your other commands.

Note that you can't select a player by two tags at once, i.e. @a[tag=unlockKnight,tag=Winner] doesn't work. If such double-tagging is necessary for whatever reason, I suggest you turn one of the tags into an objective instead.

In 1.8, you can create a dummy-type objective for every unlock and set it to 1 for players who did unlock it.

4

Perhaps add teams that have the same privileges and functions of the two teams(eg. PlayerWinner) and add corresponding players to those teams. This would be the closest thing I can think of to be on two teams at once.