mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: a4880d8 Fix NPE from using wrong ProtoChunk ctor (#6147) 55d5c16 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6149) 70ea1b2 Fix command signs (#6139)
This commit is contained in:
@@ -5,36 +5,10 @@ Subject: [PATCH] Customizable sleeping actionbar messages
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index bfcd0def5ed81c8579f7fbbbb580797439c4cfc5..4d921ac4d064b02416e43bba93b70406ff0417eb 100644
|
||||
index cee1f74edf069da54d15b7fc7d10c437afa47b2a..92b1709b96fe1e8d71e4de675e4c11f5c3f1469e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -4,6 +4,7 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
import co.aikar.timings.TimingHistory; // Paper
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
@@ -34,6 +35,9 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.DefaultedRegistry;
|
||||
@@ -158,6 +162,7 @@ import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.BooleanOp;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -1089,11 +1094,29 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
@@ -1049,11 +1049,29 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (this.canSleepThroughNights()) {
|
||||
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
|
||||
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
@@ -43,23 +17,23 @@ index bfcd0def5ed81c8579f7fbbbb580797439c4cfc5..4d921ac4d064b02416e43bba93b70406
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i)) {
|
||||
+ // Purpur start
|
||||
+ if (PurpurConfig.sleepSkippingNight.isBlank()) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.sleepSkippingNight.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = PaperAdventure.asVanilla(MiniMessage.get().parse(PurpurConfig.sleepSkippingNight));
|
||||
+ if (!net.pl3x.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(net.pl3x.purpur.PurpurConfig.sleepSkippingNight));
|
||||
+ } else
|
||||
+ // Purpur
|
||||
+ // Purpur end
|
||||
chatmessage = new TranslatableComponent("sleep.skipping_night");
|
||||
} else {
|
||||
+ // Purpur start
|
||||
+ if (PurpurConfig.sleepingPlayersPercent.isBlank()) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = PaperAdventure.asVanilla(MiniMessage.get().parse(PurpurConfig.sleepingPlayersPercent,
|
||||
+ Template.of("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||
+ Template.of("total", Integer.toString(this.sleepStatus.sleepersNeeded(i)))));
|
||||
+ if (!net.pl3x.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(net.pl3x.purpur.PurpurConfig.sleepingPlayersPercent,
|
||||
+ net.kyori.adventure.text.minimessage.Template.of("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||
+ net.kyori.adventure.text.minimessage.Template.of("total", Integer.toString(this.sleepStatus.sleepersNeeded(i)))));
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
chatmessage = new TranslatableComponent("sleep.players_sleeping", new Object[]{this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i)});
|
||||
|
||||
Reference in New Issue
Block a user