@@ -0,0 +1,2097 @@
+package me.Swedz.jca.match;%0A%0Aimport java.util.HashMap;%0A%0Aimport me.Swedz.jca.JCA;%0Aimport me.Swedz.jca.web.Web;%0A%0A/*%0A * Everything in this class requires the tournament to be active%0A */%0Apublic class Matches implements iMatches %7B%0A%09/*%0A%09 * Get all matches from the tournament in JSON as a String%0A%09 * (Soon to be JSONObject)%0A%09 */%0A%09public String getAllMatches() throws Exception %7B%0A%09%09return Web.get(%22https://api.challonge.com/v1/tournaments/%22 + JCA.tournament + %22/matches.json%22, 30*1000, false);%0A%09%7D%0A%09%0A%09/*%0A%09 * Get data of match from id specified in JSON as a String%0A%09 * (Soon to be JSONObject)%0A%09 */%0A%09public String getMatch(int matchID) throws Exception %7B%0A%09%09return Web.get(%22https://api.challonge.com/v1/tournaments/%22 + JCA.tournament + %22/matches/%22 + matchID + %22.json%22, 30*1000, false);%0A%09%7D%0A%09%0A%09/*%0A%09 * Gets unique id for match id%0A%09 */%0A%09public static HashMap%3CInteger, Integer%3E matchIDs = new HashMap%3CInteger, Integer%3E();%0A%09public int getUniqueMatchID(int match) throws Exception %7B%0A%09%09return matchIDs.get(match);%0A%09%7D%0A%09%0A%09/*%0A%09 * Sets winner in match specified%0A%09 */%0A%09public void winner(int matchID, String winnerName) throws Exception %7B%0A%09%09System.out.println(%22match: %22 + getUniqueMatchID(matchID));%0A%09%09System.out.println(%22id: %22 + JCA.participants().id(winnerName));%0A%09%09Web.put(%22https://api.challonge.com/v1/tournaments/%22 + JCA.tournament + %22/matches/%22 + getUniqueMatchID(matchID) + %22.json%22,%0A%09%09%09%22%7B%5C%22match%5C%22: %7B%5C%22scores_csv%5C%22: %5C%221-0%5C%22, %5C%22winner_id%5C%22: %22 + JCA.participants().id(winnerName) + %22%7D%7D%22, 30*1000);%0A%09%7D%0A%09%0A%09/*%0A%09 * Sets the match to be tied (sets player with higher seed to win)%0A%09 */%0A%09public void tie(int matchID, String player1, String player2) throws Exception %7B%0A%09%09int seed1 = JCA.participants().seed(player1);%0A%09%09int seed2 = JCA.participants().seed(player2);%0A%09%09String winner = null;%0A%09%09if(seed1 %3E seed2) %7B%0A%09%09%09winner = player1;%0A%09%09%7D else %7B%0A%09%09%09winner = player2;%0A%09%09%7D int id = JCA.participants().id(winner);%0A%09%09%0A%09%09Web.post(%22https://api.challonge.com/v1/tournaments/%22 + JCA.tournament + %22/matches/%22 + getUniqueMatchID(matchID) + %22.json%22,%0A%09%09%09%09%22%7B%5C%22match%5C%22: %7B%5C%22scores_csv%5C%22: %5C%220-0%5C%22, %5C%22winner_id%5C%22: %22 + id + %22%7D%7D%22, 30*1000);%0A%09%7D%0A%7D%0A

Create Matches.java