Created
November 25, 2012 10:30
-
-
Save syamn/4143020 to your computer and use it in GitHub Desktop.
MCBans Player Lookup API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package yourdomain.yourpackage; | |
import org.bukkit.Bukkit; | |
import org.bukkit.plugin.Plugin; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import com.mcbans.firestar.mcbans.MCBans; | |
import com.mcbans.firestar.mcbans.api.MCBansAPI; | |
import com.mcbans.firestar.mcbans.api.data.PlayerLookupData; | |
import com.mcbans.firestar.mcbans.callBacks.LookupCallback; | |
public class TestClass{ | |
private MCBansAPI mcbansAPI; | |
public void getAPI(){ | |
Plugin plugin = plugin.getServer().getPluginManager().getPlugin("MCBans"); | |
if (plugin == null){ | |
System.out.print("MCBans plugin not found!"); | |
}else{ | |
mcbansAPI = ((MCBans) plugin).getAPI(plugin); | |
System.out.print("MCBans plugin found!"); | |
} | |
} | |
public void testLookup(final String player, final String sender){ | |
mcbansAPI.lookup(player, sender, new LookupCallback(){ | |
@Override | |
public void success(PlayerLookupData data){ | |
System.out.print(data.getPlayerName() + "'s Data! TotalBans: " + data.getTotal() + " REP: " + data.getReputation()); | |
for (String line : data.getGlobals()){ | |
System.out.print("G-BAN: " + line); | |
} | |
for (String line : data.getLocals()){ | |
System.out.print("L-BAN: " + line); | |
} | |
for (String line : data.getOthers()){ | |
System.out.print("Other: " + line); | |
} | |
} | |
@Override | |
public void error(String message){ | |
System.out.print("Could not lookup player " + player + "! " + message); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment