Skip to content

Instantly share code, notes, and snippets.

@DarkSeraphim
Created June 6, 2014 14:06
Show Gist options
  • Save DarkSeraphim/7743f8c36180a3832f5e to your computer and use it in GitHub Desktop.
Save DarkSeraphim/7743f8c36180a3832f5e to your computer and use it in GitHub Desktop.
Callbacks for newbies
public void getMeMyMessages(String player)
{
db.execute(String.format("SELECT * FROM `messages` WHERE `player` = '%s'", player), new Callback()
{
@Override
public void callMeMaybe(ResultSet rs)
{
Player p = Bukkit.getPlayer(player);
if(p == null)
return;
p.sendMessage(ChatColor.GOLD+" == Your messages == ");
if(!rs.next())
{
player.sendMessages(ChatColor.RED+"- no messages found-");
return;
}
do
{
player.sendMessage(String.format("%s * %s", ChatColor.GREEN, rs.getString("message")))
}while(rs.next());
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment