promotional bannermobile promotional banner

TeamAPI

Abandoned
Want to make simple minigames but aren't familiar with instances and constructors? Then this is the API for you!

TeamAPI

About

TeamAPI is a small library that allows developers to create teams, store values, store custom data for players, and easily retrieve this data!

Commands/Permissions

NONE

Adding to plugin

Add this API to your build path, and if you put the plugin on Bukkit, make sure to mark TeamAPI as a dependency.

Usage

How to store API data

List<Participant> players = new ArrayList<Participant>();
List<Team> team = new ArrayList<Team>();

Creating a Team

TeamAPI api = new TeamAPI();
Team team = api.createTeam("Warrior", Color.BLUE);
// Create a team with the name Warrior and blue armor

Getting team armor

public void setArmor(Participant p){
  Player player = p.getPlayer(); // get the player behind a participant
  ItemStack[] armor = p.getTeam().getArmor(); // get the team's armor
  player.setArmorContents(armor);
}

Adding points to a participant

public void addFivePoints(Participant p){
  p.addPoints(5);
}

Getting a participant's points

// this assumes you have a Participant variable called p
Integer points = p.getPoints();

Removing a participant's points

public void takeFivePoints(Participant p){
  p.removePoints(5);
}

Reset a participant's points

public void reset(Participant p){
  p.resetPoints();
}

Get a team's colored names

public String getTeamName(Team t){
  return t.getColoredName();
}

Get a team's points

public Integer getPoints(Team t){
  return t.getPoints();
}

Manipulate a team's points

// this assumes you have a Team called t
t.addPoints(10); // add 10 points
t.removePoints(8); // remove 8 points
t.resetPoints(); // reset their points

Add / Remove Players

public void swapOut(Participant in, Participant out){
  Team inTeam = in.getTeam();
  Team outTeam = out.getTeam(); 
  inTeam.addPlayer(out); // add out to in's team
  outTeam().addPlayer(in); // add in to out's team
  inTeam.removePlayer(in); // remove in from their team
  outTeam().removePlayer(out); // remove out from their team
}

Get a team's color

public Color byPlayer(Participant e){
  return e.getTeam().getColor();
}
public Color byTeam(Team t){
  return t.getColor();
}

Get a list of players on a team

public List<Participant> byTeam(Team t){
  return t.getPlayers();
}
public List<Participant> byPlayer(Participant e){
  return e.getTeam().getPlayers();
}

Convert a player into participant

public Participant find(Player p, List<Participant> players){
  TeamAPI api = new TeamAPI();
  Participant e = api.findPlayer(players, p);
  return e;
}


More examples will be added as needed!
Have a question? Post a comment!

The TeamAPI Team

profile avatar
  • 17
    Projects
  • 44.8K
    Downloads

More from _ForgeUser11591311View all

  • FriendMe project image

    FriendMe

    • 32.8K
    • Bukkit Plugins

    FriendMe

    • 32.8K
    • April 16, 2015
    • Bukkit Plugins
    • +1
  • SQL API project image

    SQL API

    • 777
    • Bukkit Plugins

    MySQL API for Bukkit

    • 777
    • December 14, 2014
    • Bukkit Plugins
  • Mine Chatter project image

    Mine Chatter

    • 558
    • Bukkit Plugins

    Mine Chatter

    • 558
    • March 9, 2014
    • Bukkit Plugins
  • Firework API project image

    Firework API

    • 0
    • Bukkit Plugins

    Want to easily spawn fireworks without using lengthy builders? Then FireworkAPI is for you!

    • 0
    • February 13, 2014
    • Bukkit Plugins
  • FriendMe project image

    FriendMe

    • 32.8K
    • Bukkit Plugins

    FriendMe

    • 32.8K
    • April 16, 2015
    • Bukkit Plugins
    • +1
  • SQL API project image

    SQL API

    • 777
    • Bukkit Plugins

    MySQL API for Bukkit

    • 777
    • December 14, 2014
    • Bukkit Plugins
  • Mine Chatter project image

    Mine Chatter

    • 558
    • Bukkit Plugins

    Mine Chatter

    • 558
    • March 9, 2014
    • Bukkit Plugins
  • Firework API project image

    Firework API

    • 0
    • Bukkit Plugins

    Want to easily spawn fireworks without using lengthy builders? Then FireworkAPI is for you!

    • 0
    • February 13, 2014
    • Bukkit Plugins