-
Notifications
You must be signed in to change notification settings - Fork 14
alkarinv edited this page Aug 24, 2012
·
3 revisions
Example loading the interface. Call loadTracker in your onEnable().
public static TrackerInterface ti = null; public void loadTracker(){ Tracker tracker = (Tracker) Bukkit.getPluginManager().getPlugin("BattleTracker"); if (tracker != null){ ti = Tracker.getInterface("myInterfaceName"); } else { System.out.println("Warning BattleTracker not found. Tracking is disabled"); } }
Example of using the interface.
public void someMethodUsingTracker(){ if (ti != null){ ti.addPlayerRecord("alkarin_v","someOtherGuy", WLT.WIN); /// alkarin wins against someOtherGuy Stat stat = ti.getPlayerRecord("alkarin_v"); System.out.println("Ranking = " + stat.getRanking() +" wins=" + stat.getWins()); } } public void somePrintMethodUsingTracker(CommandSender sender, Command cmd, String label, String[] args){ if (ti != null){ ti.printTopX(sender, StatType.WINS, 10, 1); } }