public void onPlayerJoin(PlayerJoinEvent event) {
// When a player joins, add their correct values to the `playerVals` hashmap
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { // Run the database functions async
public void run() {
Player p = event.getPlayer();
UUID id = p.getUniqueId();
String uuid = id.toString();
PreparedStatement stmt = null;
try {
stmt = plugin.getDb().getConnection().prepareStatement("SELECT tse FROM life_system WHERE uuid = " + uuid + " LIMIT 1");
ResultSet set = stmt.executeQuery(); // Get the player with the UUID `uuid`'s life levels from the database
set.next(); // Get the first matching row
playerVals.put(id, set.getString("tse")); // Add the player's values to `playerVals`
} catch (SQLException e) {
e.printStackTrace();
}
}
;
});
}
LifeSystem.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:Locked
作者:
评论列表
文章目录