mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-22 01:58:54 +00:00
修复异步载入商店信息未刷新的问题...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
8c26cd6fa4
commit
2397e33d35
4
pom.xml
4
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.maxgamer</groupId>
|
||||
<artifactId>QuickShop</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<version>1.6.6.1</version>
|
||||
<description>快捷商店重置版本...</description>
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
@ -55,7 +55,7 @@
|
||||
<properties>
|
||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||
<env.BUILD_NUMBER>DEBUG</env.BUILD_NUMBER>
|
||||
<update.description>&c修改本地化工具载入为异步(&a妈妈再也不担心卡服啦&c)...</update.description>
|
||||
<update.description>&c修复异步载入商店信息未刷新的问题...</update.description>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
@ -8,6 +8,7 @@ import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -150,32 +151,31 @@ public class QuickShop extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void loadShop() {
|
||||
loadShop(false);
|
||||
}
|
||||
|
||||
public void loadShop(final boolean async) {
|
||||
if (!async && !LocalUtil.isInit()) {
|
||||
this.getLogger().warning("本地化工具尚未初始化完成 商店将在稍后载入...");
|
||||
if (!LocalUtil.isInit()) {
|
||||
this.getLogger().warning("本地化工具尚未初始化完成 商店汉化信息将在稍后刷新...");
|
||||
this.getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadShop(true);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
while (LocalUtil.isInit()) {
|
||||
while (!LocalUtil.isInit()) {
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (final InterruptedException e) {
|
||||
}
|
||||
}
|
||||
/* Load shops from database to memory */
|
||||
int count = 0; // Shops count
|
||||
getLogger().info("本地化工具载入完成 刷新汉化信息...");
|
||||
final Iterator<Shop> shops = shopManager.getShopIterator();
|
||||
while (shops.hasNext()) {
|
||||
shops.next().onClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/* 从数据库载入商店信息到内存 */
|
||||
int count = 0; // 商店个数
|
||||
int unload = 0;
|
||||
Connection con;
|
||||
try {
|
||||
getLogger().info("本地化工具载入完成 从数据库载入商店数据...");
|
||||
getLogger().info("开始从数据库载入商店数据...");
|
||||
con = database.getConnection();
|
||||
final PreparedStatement ps = con.prepareStatement("SELECT * FROM shops");
|
||||
final ResultSet rs = ps.executeQuery();
|
||||
|
Loading…
Reference in New Issue
Block a user