Fix time command

This commit is contained in:
Josh Roy 2023-07-27 19:59:56 -04:00
parent d4ebaf61d4
commit 0c8bc16c3d
No known key found for this signature in database
GPG Key ID: 86A69D08540BC29A

View File

@ -81,15 +81,17 @@ public class Commandtime extends EssentialsCommand {
}
final StringJoiner joiner = new StringJoiner(", ");
final boolean timeAdd = add;
for (final World world : worlds) {
long time = world.getTime();
if (!add) {
time -= time % 24000;
}
world.setTime(time + (add ? 0 : 24000) + timeTick);
joiner.add(world.getName());
ess.scheduleLocationDelayedTask(world.getSpawnLocation(), () -> {
long time = world.getTime();
if (!timeAdd) {
time -= time % 24000;
}
world.setTime(time + (timeAdd ? 0 : 24000) + timeTick);
});
}
sender.sendMessage(tl(add ? "timeWorldAdd" : "timeWorldSet", DescParseTickFormat.formatTicks(timeTick), joiner.toString()));
}