修复了剩余时间估计失效问题
All checks were successful
Java CI-CD with Maven / build (push) Successful in 25m41s

增强:放置可在流体方块放置
This commit is contained in:
zhangyuheng 2024-03-03 21:09:08 +08:00
parent 4780ede21f
commit d978fcab50
3 changed files with 17 additions and 9 deletions

View File

@ -6,7 +6,7 @@
<groupId>site.deercloud</groupId> <groupId>site.deercloud</groupId>
<artifactId>LiteWorldEdit</artifactId> <artifactId>LiteWorldEdit</artifactId>
<version>2.3.5.2</version> <version>2.3.5.6</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>LiteWorldEdit</name> <name>LiteWorldEdit</name>

View File

@ -35,8 +35,8 @@ public class Place extends Job {
} }
// 跳过非空气方块 // 跳过非空气方块
Block raw_block = _world.getBlockAt(_location); Block raw_block = _world.getBlockAt(_location);
if (!raw_block.isEmpty()) { if (!raw_block.isEmpty() && !raw_block.isLiquid()) {
LoggerX.debug("目标方块不是空气"); LoggerX.debug("目标方块不是空气或流体");
return JobErrCode.NOT_AIR_BLOCK; return JobErrCode.NOT_AIR_BLOCK;
} }
// 获取到玩家物品中材料的第一个堆叠 // 获取到玩家物品中材料的第一个堆叠

View File

@ -20,6 +20,10 @@ public class JobQueue {
int total = 0; int total = 0;
int ms_last_pop; int ms_last_pop;
int time_remain_count = 0;
int time_s_remaining = 0;
int time_m_remaining = 0;
Player player; Player player;
@ -44,7 +48,6 @@ public class JobQueue {
} }
Job job = queue.pop(); Job job = queue.pop();
updateBarProgressBar(); updateBarProgressBar();
ms_last_pop = (int) System.currentTimeMillis();
return job; return job;
} }
@ -76,11 +79,16 @@ public class JobQueue {
private void updateBarProgressBar() { private void updateBarProgressBar() {
bar.setProgress((total - queue.size()) * 1.0 / total); bar.setProgress((total - queue.size()) * 1.0 / total);
int delta_time_ms = (int) System.currentTimeMillis() - ms_last_pop; time_remain_count++;
int time_s_remaining = queue.size() * delta_time_ms / 1000; if (time_remain_count >= 100) {
int time_m_remaining = time_s_remaining / 60; time_remain_count = 0;
int time_s_remaining_mod = time_s_remaining % 60; int delta_time_ms = (int) System.currentTimeMillis() - ms_last_pop;
bar.setTitle("§a§lLiteWorldEdit [正在运行] 剩余任务: " + queue.size() + " 预计剩余时间: " + time_m_remaining + "" + time_s_remaining_mod + ""); time_s_remaining = queue.size() * delta_time_ms / 100 / 1000;
time_m_remaining = time_s_remaining / 60;
time_s_remaining = time_s_remaining % 60;
ms_last_pop = (int) System.currentTimeMillis();
}
bar.setTitle("§a§lLiteWorldEdit [正在运行] 剩余任务: " + queue.size() + " 预计剩余时间: " + time_m_remaining + "" + time_s_remaining + "");
bar.setVisible(queue.size() != 0); bar.setVisible(queue.size() != 0);
} }