修复了剩余时间估计失效问题
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>
<artifactId>LiteWorldEdit</artifactId>
<version>2.3.5.2</version>
<version>2.3.5.6</version>
<packaging>jar</packaging>
<name>LiteWorldEdit</name>

View File

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

View File

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