apply minecraft server file patches

This commit is contained in:
granny
2025-11-25 22:27:20 -08:00
parent e6561c98ae
commit 757b8d5d42
251 changed files with 1060 additions and 2988 deletions

View File

@@ -0,0 +1,56 @@
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -311,6 +_,7 @@
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end - Configurable player collision
+ org.purpurmc.purpur.task.BossBarTask.addToAll(player); // Purpur - Implement TPSBar
// CraftBukkit start - moved down
LOGGER.info(
"{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", // CraftBukkit - add world name
@@ -431,6 +_,7 @@
}
public net.kyori.adventure.text.@Nullable Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
// Paper end - Fix kick event leave message not being sent
+ org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar
ServerLevel serverLevel = player.level();
player.awardStat(Stats.LEAVE_GAME);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
@@ -770,6 +_,20 @@
}
}
+ // Purpur start - Component related conveniences
+ public void broadcastMiniMessage(@Nullable String message, boolean overlay) {
+ if (message != null && !message.isEmpty()) {
+ this.broadcastMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message), overlay);
+ }
+ }
+
+ public void broadcastMessage(@Nullable net.kyori.adventure.text.Component message, boolean overlay) {
+ if (message != null) {
+ this.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), overlay);
+ }
+ }
+ // Purpur end - Component related conveniences
+
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
for (ServerPlayer serverPlayer : this.players) {
if (serverPlayer.level().dimension() == dimension) {
@@ -863,6 +_,7 @@
case ADMINS -> EntityEvent.PERMISSION_LEVEL_ADMINS;
case OWNERS -> EntityEvent.PERMISSION_LEVEL_OWNERS;
};
+ if (b < EntityEvent.PERMISSION_LEVEL_OWNERS && player.getBukkitEntity().hasPermission("purpur.debug.f3n")) b = EntityEvent.PERMISSION_LEVEL_OWNERS; // Purpur - Add permission for F3+N debug
player.connection.send(new ClientboundEntityEventPacket(player, b));
}
@@ -874,7 +_,7 @@
// Paper start - whitelist verify event / login event
public LoginResult canBypassFullServerLogin(final NameAndId nameAndId, final LoginResult currentResult) {
- final boolean shouldKick = this.players.size() >= this.getMaxPlayers() && !this.canBypassPlayerLimit(nameAndId);
+ final boolean shouldKick = this.players.size() >= this.getMaxPlayers() && !(/*player.hasPermission("purpur.joinfullserver") || */this.canBypassPlayerLimit(nameAndId)); // Purpur - Allow player join full server by permission TODO: this hasn't worked for a while, so comment it out until we can reliably check perms of the player joining
final io.papermc.paper.event.player.PlayerServerFullCheckEvent fullCheckEvent = new io.papermc.paper.event.player.PlayerServerFullCheckEvent(
new com.destroystokyo.paper.profile.CraftPlayerProfile(nameAndId),
io.papermc.paper.adventure.PaperAdventure.asAdventure(currentResult.message),

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/server/players/SleepStatus.java
+++ b/net/minecraft/server/players/SleepStatus.java
@@ -15,7 +_,7 @@
public boolean areEnoughDeepSleeping(int requiredSleepPercentage, List<ServerPlayer> sleepingPlayers) {
// CraftBukkit start
- int i = (int) sleepingPlayers.stream().filter(player -> player.isSleepingLongEnough() || player.fauxSleeping).count();
+ int i = (int) sleepingPlayers.stream().filter(player -> player.isSleepingLongEnough() || player.fauxSleeping || (player.level().purpurConfig.idleTimeoutCountAsSleeping && player.isAfk())).count(); // Purpur - AFK API
boolean anyDeepSleep = sleepingPlayers.stream().anyMatch(Player::isSleepingLongEnough);
return anyDeepSleep && i >= this.sleepersNeeded(requiredSleepPercentage);
// CraftBukkit end
@@ -43,7 +_,7 @@
for (ServerPlayer serverPlayer : players) {
if (!serverPlayer.isSpectator()) {
this.activePlayers++;
- if (serverPlayer.isSleeping() || serverPlayer.fauxSleeping) { // CraftBukkit
+ if (serverPlayer.isSleeping() || serverPlayer.fauxSleeping || (serverPlayer.level().purpurConfig.idleTimeoutCountAsSleeping && serverPlayer.isAfk())) { // CraftBukkit // Purpur - AFK API
this.sleepingPlayers++;
}
// CraftBukkit start