From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <me@notom3ga.me>
Date: Thu, 18 Mar 2021 06:22:40 -0400
Subject: [PATCH] Config for skipping night


diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 9a2cc5dfcfaefc8a257a85c0bc09456074ff76c2..1b15216d6a03c1031d2bbea2e0243a0de9a9199f 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1028,7 +1028,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
         }
         // CraftBukkit end
 
-        if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
+        if (this.purpurConfig.playersSkipNight && this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> { // Purpur
             return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping && !(purpurConfig.idleTimeoutCountAsSleeping && entityplayer.isAfk()); // CraftBukkit // Purpur
         })) {
             // CraftBukkit start
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 0e1f6e0bda27547a59c2116f9eec3e29be9f36eb..8bb134ee7be7ff52cda4807f7c9a393f92b8fbc1 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -289,6 +289,7 @@ public class PurpurWorldConfig {
     public int animalBreedingCooldownSeconds = 0;
     public boolean creativeOnePunch = false;
     public boolean playerSleepNearMonsters = false;
+    public boolean playersSkipNight = true;
     private void miscGameplayMechanicsSettings() {
         useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
         alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
@@ -308,6 +309,7 @@ public class PurpurWorldConfig {
         animalBreedingCooldownSeconds = getInt("gameplay-mechanics.animal-breeding-cooldown-seconds", animalBreedingCooldownSeconds);
         creativeOnePunch = getBoolean("gameplay-mechanics.player.one-punch-in-creative", creativeOnePunch);
         playerSleepNearMonsters = getBoolean("gameplay-mechanics.player.sleep-ignore-nearby-mobs", playerSleepNearMonsters);
+        playersSkipNight = getBoolean("gameplay-mechanics.player.can-skip-night", playersSkipNight);
     }
 
     public boolean catSpawning;
