Max players per team

Discussion in 'Plugin Development' started by Roadrunner2222, Jun 23, 2015.

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

    Roadrunner2222

    how can i set the max players per team?
     
  2. Online

    timtower Administrator Administrator Moderator

    @Roadrunner2222 Team in what? Just don't add more people when the team is full.
     
  3. Offline

    Roadrunner2222

    yes if the team has reached it max players then no more players can join.

    can you set also per team the max players, so team 1 has get the max. players of 3 and team 2 of 6?


    {{Posts merged by Myrathi}}
     
    Last edited by a moderator: Jun 23, 2015
  4. @Roadrunner2222 Yes, through the magic of not adding them if it would exceed the maximum - players don't just naturally appear in 'teams', it's something you do yourself so a simple if statement to check the size of the team against a maximum is what you want.
     
  5. Offline

    Roadrunner2222

    why the: bukkit.shutdown(); ???

    is it to troll?
     
  6. Offline

    sam_0208

    That is his signature
     
  7. Offline

    Roadrunner2222

    can you send a code to set max players per team?
     
  8. Offline

    sam_0208

    Just use something like an ArrayList and check if the size is ... If not add someone to the team if so do not add someone to the team
     
  9. Offline

    Roadrunner2222

    how do you do that @sam_0208 ? i'm a beginner with programming bukkit plugins, i want to get 1 hunter that go hunt the other players that named the runners.
     
    Last edited: Jun 23, 2015
  10. Offline

    sam_0208

  11. Offline

    Zombie_Striker

    @Roadrunner2222
    Please learn Java. You posted no code and are just asking people to spoonfeed you code.
    Code:
    http://bukkit.org/threads/plugin-dev-sticky-learning-java-where-to-learn.350132/
     
  12. Offline

    Roadrunner2222

    i have already make the code but i need only the code to set the max players and the only thing is how can i make a arraylist to set the max players per team, i dont know the arraylist thats the thing and here is the code i already have:

    Code:
    public class Game {
    
    public static void start() {
    new Team("Hunters");
    new Team("Runners");

    now i want to set the max players per team but if i do this:

    Code:
    public class Game {
    
    public static void start() {
    new Team("Hunters");
          if getOnlinePlayers(Team.Hunters) = 1
                setJoin(false)
    new Team("Runners");
    it doesn't work and it gives an error
     
    Last edited: Jun 23, 2015
  13. Offline

    JaydenKieran

    You can't come here expecting us to spoon feed you code. It's pretty simple. Make an ArrayList for your teams. Create an int with your max players amount. Check to see if the ArrayList size is equal to or greater than your max players amount, then do what you want about it. Learn basic Java. This isn't even a Bukkit question to be honest.

    Also, from the looks of the code you sent (which, by the way, isn't enough for anyone to actually be able to help you), you're using a tutorial, or you have copied and pasted someone else's code, as I doubt you would be able to code that with the lack of Java knowledge that you have. And, if you're trying to use Bukkit's 'getOnlinePlayers' method, I doubt you'll be able to use it in the context you've been trying. getOnlinePlayers returns a collection of Player. It would be strange trying to use it in the way you want, although, you haven't posted your Team class code, so nobody has a clue if you're trying to use Bukkit's method or your own. You haven't inserted the closing } bracket after your void too, which is gonna cause you all kinds of problems. Are you even using an IDE or are you using Notepad? Your indenting is all wrong.

    Please, go and learn Java before attempting to code a Bukkit plugin, especially if you are trying to create a minigame of some sort. It's never gonna happen, so don't come here expecting people to help you if you can't understand the basics of things like an ArrayList.
     
    Zombie_Striker and sam_0208 like this.
Thread Status:
Not open for further replies.

Share This Page