Files
Purpur/patches/server/0172-Config-for-skipping-night.patch
William Blake Galbreath 31306b4b0e Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
b79bc31 Fix MerchantOffer BuyB Only AssertionError (#6206)
d6c81c8 Don't apply cramming damage to players (#5903)
12942dc Add rate options and timings for sensors and behaviors (#6027)
fc47872 Use mapped names for sensor and behavior timings/config (#6228)
c75a837 Don't expose ASM in API (#6229)
c225bf9 Fix book title and author being improperly serialized as components (#6190)
f25facb Update email & name (DenWav)
44516b1 [ci skip] Put mappings util in a separate class to the stacktrace deobfuscator
2021-07-21 10:49:20 -05:00

40 lines
2.6 KiB
Diff

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/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3bc63f24bf8c07b89562887bdc8cf7569d7b33b4..27d41f7e03404d349a465848235c63b1f5e3200c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -717,7 +717,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit end
i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
- if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
+ if (this.purpurConfig.playersSkipNight && this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
// CraftBukkit start
long l = this.levelData.getDayTime() + 24000L;
TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index b4fa4646e240ffe93365f47cd7c3ec46b59cf826..c994f82b392e26a55f1e0d8f1d95a9b68d6b3ad3 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -310,6 +310,7 @@ public class PurpurWorldConfig {
public boolean playerFixStuckPortal = false;
public boolean creativeOnePunch = false;
public boolean playerSleepNearMonsters = false;
+ public boolean playersSkipNight = true;
private void playerSettings() {
idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick);
idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities);
@@ -324,6 +325,7 @@ public class PurpurWorldConfig {
playerFixStuckPortal = getBoolean("gameplay-mechanics.player.fix-stuck-in-portal", playerFixStuckPortal);
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 int snowballDamage = -1;