nkomarn / harbor

Harbor is a plugin that redefines sleep within your Spigot server!
https://bstats.org/plugin/bukkit/Harbor
MIT License
97 stars 33 forks source link

Sleeping with this plugin prevents rain ? #71

Open vgalin opened 3 years ago

vgalin commented 3 years ago

Hi, I'm part of a small/medium-sized server that uses this plugin. Most of the time, a few people sleep and the night is skipped. Recently some of us were waiting for a thunderstorm (so that we could make charged creepers an gather mob heads) but we realized that we hadn't seen rain since Harbor was installed.

In Vanilla, when you sleep and the night is skipped, the weather is cleared and the next weather-event (rain/thunder) is postponed (most of the time).

By looking at the comments in the Harbor config file, it seemed to us that this behavior was different (because you precised (if it's raining) and (if it's thundering)).

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        

Taking a look at the Harbor source file, it seemed that rain and thunder are cleared no matter what if clear-rain and clear-thunder are respectively set to true in the config file.

if (config.getBoolean("night-skip.clear-rain")) {
    world.setStorm(false);
}

if (config.getBoolean("night-skip.clear-thunder")) {
    world.setThundering(false);
}

At this point I thought that world.setStorm(false); and world.setThundering(false); could potentially reset the time until the next weather-event and that because it was called every night on our server the "bad" weather would always be postponed.

To test this hypothesis, I forked Harbor, and made these tiny changes :

if (config.getBoolean("night-skip.clear-rain") && world.hasStorm()) {
    world.setStorm(false);
}

if (config.getBoolean("night-skip.clear-thunder") && world.isThundering()) {
    world.setThundering(false);
}

The idea behind these changes was :

I pushed the changes to my repo and retrieved the artifact built by the CI, and we tried this version on the server. We purposedly slept every night to see if the modified version of the plugin made any difference, but it didn't, we still had no rain.

The only working solution we have at the moment is only but a workaround : it rains when nobody sleeps for a few nights.

At this point I have no idea what is postponing rain/thunder (note that the only plugins installed are dynmap, Harbor and WorldBorder). Am I missing something ?

nkomarn commented 3 years ago

Hm, interesting. Maybe try enabling instant-skip in the configuration and see if the behavior changes? Otherwise, there's nothing else I can think of at the moment.