Skip to content

Commit

Permalink
Merge pull request #100 from iquelli/game-start-time
Browse files Browse the repository at this point in the history
World time is now consistent with game time
  • Loading branch information
TiagoFar78 authored Mar 30, 2024
2 parents 0d87a8c + a9eab6f commit a7d3c21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class BukkitWorldEditor {

private static final int SIGN_INDEX = 1;
private static final World WORLD = Bukkit.getWorld(ConfigManager.getInstance().getWorldName());
private static final int DAY_START_TIME = 0;
private static final int NIGHT_START_TIME = 13000;

public static void addSignAboveVault(PrisonEscapeLocation location, String text) {
Location bukkitLocation = new Location(WORLD, location.getX(), location.getY() + 1, location.getZ());
Expand All @@ -39,4 +41,12 @@ public static void deleteVaultAndRespectiveSign(PrisonEscapeLocation location) {
signLocation.getBlock().setType(Material.AIR);
}

public static void changeTimeToDay() {
WORLD.setTime(DAY_START_TIME);
}

public static void changeTimeToNight() {
WORLD.setTime(NIGHT_START_TIME);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.tiagofar78.prisonescape.bukkit.BukkitMessageSender;
import net.tiagofar78.prisonescape.bukkit.BukkitScheduler;
import net.tiagofar78.prisonescape.bukkit.BukkitTeleporter;
import net.tiagofar78.prisonescape.bukkit.BukkitWorldEditor;
import net.tiagofar78.prisonescape.game.phases.Finished;
import net.tiagofar78.prisonescape.game.phases.Phase;
import net.tiagofar78.prisonescape.game.phases.Waiting;
Expand Down Expand Up @@ -339,6 +340,7 @@ private void startDay() {

_dayPeriod = DayPeriod.DAY;
_currentDay++;
BukkitWorldEditor.changeTimeToDay();

_prison.reloadChests();

Expand All @@ -364,6 +366,7 @@ private void startNight() {
}

_dayPeriod = DayPeriod.NIGHT;
BukkitWorldEditor.changeTimeToNight();

for (PrisonEscapePlayer player : _playersOnLobby) {
MessageLanguageManager messages = MessageLanguageManager.getInstanceByPlayer(player.getName());
Expand Down

0 comments on commit a7d3c21

Please sign in to comment.