mirror of
https://github.com/nkomarn/harbor.git
synced 2025-01-08 00:38:26 +01:00
⏱ Proportional acceleration
This commit is contained in:
parent
35407752c9
commit
f727f2738e
@ -47,10 +47,10 @@ public class HarborCommand implements TabExecutor {
|
|||||||
new AccelerateNightTask(world).runTaskTimer(Harbor.getHarbor(), 0L, 1);
|
new AccelerateNightTask(world).runTaskTimer(Harbor.getHarbor(), 0L, 1);
|
||||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix
|
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix
|
||||||
+ "&7Forcing night skip in your world."));
|
+ "&7Forcing night skip in your world."));
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix
|
||||||
|
+ Config.getString("messages.miscellaneous.unrecognized-command")));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix
|
|
||||||
+ Config.getString("messages.miscellaneous.unrecognized-command")));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,13 @@ public class AccelerateNightTask extends BukkitRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
final long time = world.getTime();
|
final long time = world.getTime();
|
||||||
final int dayTime = Config.getInteger("night-skip.daytime-ticks");
|
final int dayTime = Config.getInteger("night-skip.daytime-ticks");
|
||||||
final int timeRate = Config.getInteger("night-skip.time-rate");
|
final int sleeping = Checker.getSleeping(world).size();
|
||||||
|
double timeRate = Config.getInteger("night-skip.time-rate");
|
||||||
|
|
||||||
|
if (Config.getBoolean("night-skip.proportional-acceleration")) {
|
||||||
|
if (sleeping != 0) timeRate = Math.min(timeRate, Math.round(timeRate /
|
||||||
|
world.getPlayers().size() * sleeping));
|
||||||
|
}
|
||||||
|
|
||||||
if (time >= (dayTime - timeRate * 1.5) && time <= dayTime) {
|
if (time >= (dayTime - timeRate * 1.5) && time <= dayTime) {
|
||||||
if (Config.getBoolean("night-skip.clear-rain")) {
|
if (Config.getBoolean("night-skip.clear-rain")) {
|
||||||
@ -39,7 +45,7 @@ public class AccelerateNightTask extends BukkitRunnable {
|
|||||||
Messages.sendRandomChatMessage(world, "messages.chat.night-skipped");
|
Messages.sendRandomChatMessage(world, "messages.chat.night-skipped");
|
||||||
this.cancel();
|
this.cancel();
|
||||||
} else {
|
} else {
|
||||||
world.setTime(time + timeRate);
|
world.setTime(time + (int) timeRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,7 @@ night-skip:
|
|||||||
time-rate: 70 # The amount of ticks added to the current time every tick when skipping the night
|
time-rate: 70 # The amount of ticks added to the current time every tick when skipping the night
|
||||||
daytime-ticks: 1200 # The time in ticks that Harbor considers day
|
daytime-ticks: 1200 # The time in ticks that Harbor considers day
|
||||||
instant-skip: false # Instantly skip the night instead of showing the full animation
|
instant-skip: false # Instantly skip the night instead of showing the full animation
|
||||||
variable-rate: false # Increase the night skipping speed based on the amount of sleeping players
|
proportional-acceleration: false # Increase the night skipping speed based on the amount of sleeping players
|
||||||
rate-multiplier: 0.5 # Multiplier used for variable night skipping (TODO explain formula)
|
|
||||||
clear-rain: true # Clear rain (if it's raining) when the night is skipped
|
clear-rain: true # Clear rain (if it's raining) when the night is skipped
|
||||||
clear-thunder: true # Clear thunder (if it's thundering) when the night is skipped
|
clear-thunder: true # Clear thunder (if it's thundering) when the night is skipped
|
||||||
reset-phantom-statistic: true # Treats everyone online as if they have slept in the last 3 days after the night is skipped (check out /gamerule doInsomnia on 1.15+)
|
reset-phantom-statistic: true # Treats everyone online as if they have slept in the last 3 days after the night is skipped (check out /gamerule doInsomnia on 1.15+)
|
||||||
|
Loading…
Reference in New Issue
Block a user