Created
June 6, 2014 14:06
-
-
Save DarkSeraphim/7743f8c36180a3832f5e to your computer and use it in GitHub Desktop.
Callbacks for newbies
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
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