Implementing Scoreboard Teams to Custom Team Class

Discussion in 'Plugin Development' started by robertcarr22, Nov 8, 2013.

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

    robertcarr22

    I am making a mini game plugin and have a CustomTeam class that has the teams spawn point etc.

    Is there anyway I can implement the scoreboard team class into this so i can set prefix's for the teams and turn off friendly fire etc.

    Any help would be greatly appreciated and if you need any more information let me know!
     
  2. Offline

    robertcarr22

  3. Offline

    robertcarr22

  4. Offline

    Garris0n

    What exactly do you mean by "implement" the teams? You could save the name of the team inside your CustomTeam class and then create methods in said class to edit the teams.
     
  5. Offline

    robertcarr22


    this is the custom team class i have:
    Code:java
    1. package io.github.robertcarr22.swbf.game;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5. import org.bukkit.Location;
    6.  
    7. public class CustomTeam{
    8.  
    9. String name;
    10. String displayName;
    11. Location spawn = null;
    12. List<String> players = new ArrayList<String>();
    13.  
    14. public CustomTeam(String name, String displayName){
    15. this.name = name;
    16. this.displayName = displayName;
    17. }
    18.  
    19.  
    20. public String getDisplayName(){
    21. return this.displayName;
    22. }
    23.  
    24. public String getName(){
    25. return this.name;
    26. }
    27.  
    28. public List<String> getPlayerNames(){
    29. return this.players;
    30. }
    31.  
    32. public int getPlayerNum(){
    33. List<String> playerList = this.players;
    34. int num = playerList.size();
    35. return num;
    36. }
    37.  
    38.  
    39. }
    40.  


    but I want to add stuff like the prefixes and stuff that the scoreboard teams have so is there anyway to like extend the Team class from the scoreboard?
     
  6. Offline

    Garris0n

     
  7. Offline

    robertcarr22

    sorry not really sure what you mean by that. Do you mean create all the methods the scoreboard team has then set them to call the scoreboard team methods?
     
  8. Offline

    Garris0n

    Assuming you have your scoreboard saved somewhere, save the name of the team in your CustomTeam and get it from the board whenever you need it. Then do whatever you want to it.
     
  9. Offline

    robertcarr22

    right I think i get what you mean :p
     
  10. Offline

    Garris0n

    Feel free to tag me if you have further issues.
     
Thread Status:
Not open for further replies.

Share This Page