Skip to content

Commit 03a579e

Browse files
katekerllenevichgranny
authored andcommitted
Config for skipping night
1 parent 9b94690 commit 03a579e

3 files changed

Lines changed: 11 additions & 39 deletions

File tree

patches/server/0138-Config-for-skipping-night.patch

Lines changed: 0 additions & 39 deletions
This file was deleted.

purpur-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
}
4444

4545
// Paper start
46+
@@ -727,7 +_,7 @@
47+
}
48+
49+
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
50+
- if (this.sleepStatus.areEnoughSleeping(_int) && this.sleepStatus.areEnoughDeepSleeping(_int, this.players)) {
51+
+ if (this.purpurConfig.playersSkipNight && this.sleepStatus.areEnoughSleeping(_int) && this.sleepStatus.areEnoughDeepSleeping(_int, this.players)) { // Purpur - Config for skipping night
52+
// Paper start - create time skip event - move up calculations
53+
final long newDayTime = this.levelData.getDayTime() + 24000L;
54+
org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent(
4655
@@ -846,6 +_,13 @@
4756
this.serverLevelData.getScheduledEvents().tick(this.server, l);
4857
Profiler.get().pop();

purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ private void playerNetheriteFireResistance() {
343343
public boolean playerFixStuckPortal = false;
344344
public boolean creativeOnePunch = false;
345345
public boolean playerSleepNearMonsters = false;
346+
public boolean playersSkipNight = true;
346347
private void playerSettings() {
347348
if (PurpurConfig.version < 19) {
348349
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
@@ -361,6 +362,7 @@ private void playerSettings() {
361362
playerFixStuckPortal = getBoolean("gameplay-mechanics.player.fix-stuck-in-portal", playerFixStuckPortal);
362363
creativeOnePunch = getBoolean("gameplay-mechanics.player.one-punch-in-creative", creativeOnePunch);
363364
playerSleepNearMonsters = getBoolean("gameplay-mechanics.player.sleep-ignore-nearby-mobs", playerSleepNearMonsters);
365+
playersSkipNight = getBoolean("gameplay-mechanics.player.can-skip-night", playersSkipNight);
364366
}
365367

366368
public boolean silkTouchEnabled = false;

0 commit comments

Comments
 (0)