Source code for DayNight Bukkit plugin
If you would like the plugin without compiling:
CurseForge: https://www.curseforge.com/minecraft/bukkit-plugins/daynight
Bukkit: https://dev.bukkit.org/projects/daynight
You would get the source code if you would want to understand the plugin