Merge pull request 'Paper 1.21.4 & Hardfork' (#1) from init into main

Reviewed-on: https://steamwar.de/devlabs/SteamWar/Paper/pulls/1
This commit is contained in:
Lixfel
2024-12-26 10:49:10 +01:00
9 changed files with 269 additions and 9 deletions

View File

@@ -0,0 +1,72 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chaoscaot <chaos@chaoscaot.de>
Date: Wed, 25 Dec 2024 12:18:00 +0100
Subject: [PATCH] SW Remove Worldlock and Symlink Check
diff --git a/net/minecraft/world/level/storage/LevelStorageSource.java b/net/minecraft/world/level/storage/LevelStorageSource.java
index de43e54698125ce9f319d4889dd49f7029fe95e0..e21d744040bcf58b391f002f2dd1129e532ff1b6 100644
--- a/net/minecraft/world/level/storage/LevelStorageSource.java
+++ b/net/minecraft/world/level/storage/LevelStorageSource.java
@@ -343,7 +343,7 @@ public class LevelStorageSource {
public LevelStorageSource.LevelStorageAccess validateAndCreateAccess(String saveName, ResourceKey<LevelStem> dimensionType) throws IOException, ContentValidationException { // CraftBukkit
Path levelPath = this.getLevelPath(saveName);
- List<ForbiddenSymlinkInfo> list = Boolean.getBoolean("paper.disableWorldSymlinkValidation") ? List.of() : this.worldDirValidator.validateDirectory(levelPath, true); // Paper - add skipping of symlinks scan
+ List<ForbiddenSymlinkInfo> list = List.of(); // Paper - add skipping of symlinks scan
if (!list.isEmpty()) {
throw new ContentValidationException(levelPath, list);
} else {
@@ -420,7 +420,6 @@ public class LevelStorageSource {
}
public class LevelStorageAccess implements AutoCloseable {
- final DirectoryLock lock;
public final LevelStorageSource.LevelDirectory levelDirectory;
private final String levelId;
private final Map<LevelResource, Path> resources = Maps.newHashMap();
@@ -432,7 +431,6 @@ public class LevelStorageSource {
// CraftBukkit end
this.levelId = levelId;
this.levelDirectory = new LevelStorageSource.LevelDirectory(levelDir);
- this.lock = DirectoryLock.create(levelDir);
}
public long estimateDiskSpace() {
@@ -476,9 +474,7 @@ public class LevelStorageSource {
}
private void checkLock() {
- if (!this.lock.isValid()) {
- throw new IllegalStateException("Lock is no longer valid");
- }
+ //nope
}
public PlayerDataStorage createPlayerStorage() {
@@ -532,7 +528,7 @@ public class LevelStorageSource {
}
public Optional<Path> getIconFile() {
- return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile());
+ return Optional.of(this.levelDirectory.iconFile());
}
public void deleteLevel() throws IOException {
@@ -561,7 +557,6 @@ public class LevelStorageSource {
throw exception;
} else {
if (dir.equals(LevelStorageAccess.this.levelDirectory.path())) {
- LevelStorageAccess.this.lock.close();
Files.deleteIfExists(path);
}
@@ -645,7 +640,7 @@ public class LevelStorageSource {
@Override
public void close() throws IOException {
- this.lock.close();
+ //ignored
}
public boolean restoreLevelDataFromOld() {

View File

@@ -0,0 +1,152 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chaoscaot <chaos@chaoscaot.de>
Date: Wed, 25 Dec 2024 12:31:02 +0100
Subject: [PATCH] SW Disable Commands
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 19ccf3abf14c67f72a1ca065e4a304f50e645ef4..86d2a9b1cbe6e03066ea4a2034e2dd611bff67cb 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -150,66 +150,66 @@ public class Commands {
private final CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>();
public Commands(Commands.CommandSelection selection, CommandBuildContext context) {
- AdvancementCommands.register(this.dispatcher);
- AttributeCommand.register(this.dispatcher, context);
- ExecuteCommand.register(this.dispatcher, context);
- BossBarCommands.register(this.dispatcher, context);
+ //AdvancementCommands.register(this.dispatcher);
+ //AttributeCommand.register(this.dispatcher, context);
+ //ExecuteCommand.register(this.dispatcher, context);
+ //BossBarCommands.register(this.dispatcher, context);
ClearInventoryCommands.register(this.dispatcher, context);
- CloneCommands.register(this.dispatcher, context);
- DamageCommand.register(this.dispatcher, context);
- DataCommands.register(this.dispatcher);
- DataPackCommand.register(this.dispatcher);
- DebugCommand.register(this.dispatcher);
- DefaultGameModeCommands.register(this.dispatcher);
- DifficultyCommand.register(this.dispatcher);
+ //CloneCommands.register(this.dispatcher, context);
+ //DamageCommand.register(this.dispatcher, context);
+ //DataCommands.register(this.dispatcher);
+ //DataPackCommand.register(this.dispatcher);
+ //DebugCommand.register(this.dispatcher);
+ //DefaultGameModeCommands.register(this.dispatcher);
+ //DifficultyCommand.register(this.dispatcher);
EffectCommands.register(this.dispatcher, context);
- EmoteCommands.register(this.dispatcher);
+ //EmoteCommands.register(this.dispatcher);
EnchantCommand.register(this.dispatcher, context);
- ExperienceCommand.register(this.dispatcher);
- FillCommand.register(this.dispatcher, context);
+ //ExperienceCommand.register(this.dispatcher);
+ //FillCommand.register(this.dispatcher, context);
FillBiomeCommand.register(this.dispatcher, context);
- ForceLoadCommand.register(this.dispatcher);
- FunctionCommand.register(this.dispatcher);
+ //ForceLoadCommand.register(this.dispatcher);
+ //FunctionCommand.register(this.dispatcher);
GameModeCommand.register(this.dispatcher);
GameRuleCommand.register(this.dispatcher, context);
GiveCommand.register(this.dispatcher, context);
- HelpCommand.register(this.dispatcher);
- ItemCommands.register(this.dispatcher, context);
+ //HelpCommand.register(this.dispatcher);
+ //ItemCommands.register(this.dispatcher, context);
KickCommand.register(this.dispatcher);
KillCommand.register(this.dispatcher);
- ListPlayersCommand.register(this.dispatcher);
- LocateCommand.register(this.dispatcher, context);
- LootCommand.register(this.dispatcher, context);
- MsgCommand.register(this.dispatcher);
- ParticleCommand.register(this.dispatcher, context);
- PlaceCommand.register(this.dispatcher);
- PlaySoundCommand.register(this.dispatcher);
- RandomCommand.register(this.dispatcher);
- ReloadCommand.register(this.dispatcher);
- RecipeCommand.register(this.dispatcher);
- ReturnCommand.register(this.dispatcher);
- RideCommand.register(this.dispatcher);
+ //ListPlayersCommand.register(this.dispatcher);
+ //LocateCommand.register(this.dispatcher, context);
+ //LootCommand.register(this.dispatcher, context);
+ //MsgCommand.register(this.dispatcher);
+ //ParticleCommand.register(this.dispatcher, context);
+ //PlaceCommand.register(this.dispatcher);
+ //PlaySoundCommand.register(this.dispatcher);
+ //RandomCommand.register(this.dispatcher);
+ //ReloadCommand.register(this.dispatcher);
+ //RecipeCommand.register(this.dispatcher);
+ //ReturnCommand.register(this.dispatcher);
+ //RideCommand.register(this.dispatcher);
RotateCommand.register(this.dispatcher);
- SayCommand.register(this.dispatcher);
- ScheduleCommand.register(this.dispatcher);
- ScoreboardCommand.register(this.dispatcher, context);
- SeedCommand.register(this.dispatcher, selection != Commands.CommandSelection.INTEGRATED);
- SetBlockCommand.register(this.dispatcher, context);
- SetSpawnCommand.register(this.dispatcher);
+ //SayCommand.register(this.dispatcher);
+ //ScheduleCommand.register(this.dispatcher);
+ //ScoreboardCommand.register(this.dispatcher, context);
+ //SeedCommand.register(this.dispatcher, selection != Commands.CommandSelection.INTEGRATED);
+ //SetBlockCommand.register(this.dispatcher, context);
+ //SetSpawnCommand.register(this.dispatcher);
SetWorldSpawnCommand.register(this.dispatcher);
SpectateCommand.register(this.dispatcher);
- SpreadPlayersCommand.register(this.dispatcher);
- StopSoundCommand.register(this.dispatcher);
+ //SpreadPlayersCommand.register(this.dispatcher);
+ //StopSoundCommand.register(this.dispatcher);
SummonCommand.register(this.dispatcher, context);
- TagCommand.register(this.dispatcher);
- TeamCommand.register(this.dispatcher, context);
- TeamMsgCommand.register(this.dispatcher);
+ //TagCommand.register(this.dispatcher);
+ //TeamCommand.register(this.dispatcher, context);
+ //TeamMsgCommand.register(this.dispatcher);
TeleportCommand.register(this.dispatcher);
- TellRawCommand.register(this.dispatcher, context);
+ //TellRawCommand.register(this.dispatcher, context);
TickCommand.register(this.dispatcher);
TimeCommand.register(this.dispatcher);
- TitleCommand.register(this.dispatcher, context);
- TriggerCommand.register(this.dispatcher);
+ //TitleCommand.register(this.dispatcher, context);
+ //TriggerCommand.register(this.dispatcher);
WeatherCommand.register(this.dispatcher);
WorldBorderCommand.register(this.dispatcher);
if (JvmProfiler.INSTANCE.isAvailable()) {
@@ -230,20 +230,20 @@ public class Commands {
}
if (selection.includeDedicated) {
- BanIpCommands.register(this.dispatcher);
- BanListCommands.register(this.dispatcher);
- BanPlayerCommands.register(this.dispatcher);
- DeOpCommands.register(this.dispatcher);
- OpCommand.register(this.dispatcher);
- PardonCommand.register(this.dispatcher);
- PardonIpCommand.register(this.dispatcher);
- PerfCommand.register(this.dispatcher);
+ //BanIpCommands.register(this.dispatcher);
+ //BanListCommands.register(this.dispatcher);
+ //BanPlayerCommands.register(this.dispatcher);
+ //DeOpCommands.register(this.dispatcher);
+ //OpCommand.register(this.dispatcher);
+ //PardonCommand.register(this.dispatcher);
+ //PardonIpCommand.register(this.dispatcher);
+ //PerfCommand.register(this.dispatcher);
SaveAllCommand.register(this.dispatcher);
SaveOffCommand.register(this.dispatcher);
SaveOnCommand.register(this.dispatcher);
- SetPlayerIdleTimeoutCommand.register(this.dispatcher);
+ //SetPlayerIdleTimeoutCommand.register(this.dispatcher);
StopCommand.register(this.dispatcher);
- TransferCommand.register(this.dispatcher);
+ //TransferCommand.register(this.dispatcher);
WhitelistCommand.register(this.dispatcher);
}

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chaoscaot <chaos@chaoscaot.de>
Date: Wed, 25 Dec 2024 12:36:40 +0100
Subject: [PATCH] SW Remove Debug Message
diff --git a/net/minecraft/server/players/StoredUserList.java b/net/minecraft/server/players/StoredUserList.java
index d445e8f126f077d8419c52fa5436ea963a1a42a4..dfb0d766b5244646d18ddec5d8b91eddb69d9e97 100644
--- a/net/minecraft/server/players/StoredUserList.java
+++ b/net/minecraft/server/players/StoredUserList.java
@@ -12,6 +12,7 @@ import com.mojang.logging.LogUtils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
@@ -103,6 +104,8 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
try (BufferedWriter writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) {
GSON.toJson(jsonArray, GSON.newJsonWriter(writer));
+ } catch (FileNotFoundException e) {
+ return;
}
}

View File

@@ -92,7 +92,7 @@ public enum VersionHistoryManager {
)) { )) {
gson.toJson(currentData, writer); gson.toJson(currentData, writer);
} catch (final IOException e) { } catch (final IOException e) {
logger.log(Level.SEVERE, "Failed to write to version history file", e); // logger.log(Level.SEVERE, "Failed to write to version history file", e);
} }
} }

View File

@@ -112,7 +112,7 @@ public abstract class Configurations<G, W> {
loader.save(node); loader.save(node);
} catch (ConfigurateException ex) { } catch (ConfigurateException ex) {
if (ex.getCause() instanceof AccessDeniedException) { if (ex.getCause() instanceof AccessDeniedException) {
LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex); //LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
} else throw ex; } else throw ex;
} }
} }

View File

@@ -463,8 +463,6 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
// Symlinks are not correctly checked in createDirectories // Symlinks are not correctly checked in createDirectories
static void createDirectoriesSymlinkAware(Path path) throws IOException { static void createDirectoriesSymlinkAware(Path path) throws IOException {
if (!Files.isDirectory(path)) { // do nothing
Files.createDirectories(path);
}
} }
} }

View File

@@ -517,7 +517,7 @@ public final class CraftServer implements Server {
try { try {
this.configuration.save(this.getConfigFile()); this.configuration.save(this.getConfigFile());
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex); //Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex);
} }
} }
@@ -525,7 +525,7 @@ public final class CraftServer implements Server {
try { try {
this.commandsConfiguration.save(this.getCommandsConfigFile()); this.commandsConfiguration.save(this.getCommandsConfigFile());
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex); //Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex);
} }
} }
@@ -615,7 +615,7 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions(); DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions();
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper
this.helpMap.initializeCommands(); //this.helpMap.initializeCommands();
this.syncCommands(); this.syncCommands();
} }
} }

View File

@@ -97,7 +97,7 @@ public class SpigotConfig {
try { try {
SpigotConfig.config.save(SpigotConfig.CONFIG_FILE); SpigotConfig.config.save(SpigotConfig.CONFIG_FILE);
} catch (IOException ex) { } catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex); //Bukkit.getLogger().log(Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex);
} }
} }

11
steamwarci.yml Normal file
View File

@@ -0,0 +1,11 @@
build:
- "JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew applyPatches"
- "JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew createMojmapBundlerJar"
- "JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew --stop"
artifacts:
"/binarys/paper-1.21.4.jar": "paper-server/build/libs/paper-bundler-1.21.4-R0.1-SNAPSHOT-mojmap.jar"
"/binarys/spigot-1.21.4-inner.jar": "paper-server/build/libs/paper-server-1.21.4-R0.1-SNAPSHOT.jar"
release:
- "mvn deploy:deploy-file -DgroupId=de.steamwar -DartifactId=spigot -Dversion=1.21.4 -Dpackaging=jar -Dfile=paper-server/build/libs/paper-server-1.21.4-R0.1-SNAPSHOT.jar -Durl=file:///var/www/html/maven/"