mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-22 16:29:16 +00:00
All source patches applied and starts
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
@@ -61,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isBrandCompatible(final @NotNull Key brandId) {
|
||||
- return brandId.equals(this.brandId);
|
||||
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Sakura - branding changes
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
@@ -94,7 +_,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
- static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) {
|
||||
+ public static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) { // Sakura - package-protected -> public
|
||||
return node -> {
|
||||
ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type));
|
||||
ObjectMapper.Mutable<T> mutable = (ObjectMapper.Mutable<T>) factory.get(type);
|
||||
@@ -229,7 +_,7 @@
|
||||
.path(worldConfigFile)
|
||||
.build();
|
||||
final ConfigurationNode worldNode = worldLoader.load();
|
||||
- if (newFile) { // set the version field if new file
|
||||
+ if (newFile && this instanceof PaperConfigurations) { // Sakura - hack this into working // set the version field if new file
|
||||
worldNode.node(Configuration.VERSION_FIELD).set(this.worldConfigVersion());
|
||||
} else {
|
||||
this.verifyWorldConfigVersion(contextMap, worldNode);
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -169,7 +_,7 @@
|
||||
.defaultOptions(PaperConfigurations::defaultOptions);
|
||||
}
|
||||
|
||||
- private static ConfigurationOptions defaultOptions(ConfigurationOptions options) {
|
||||
+ public static ConfigurationOptions defaultOptions(ConfigurationOptions options) { // Sakura - sakura configuration files
|
||||
return options.serializers(builder -> builder
|
||||
.register(MapSerializer.TYPE, new MapSerializer(false))
|
||||
.register(new EnumValueSerializer())
|
||||
@@ -466,7 +_,7 @@
|
||||
}
|
||||
|
||||
// Symlinks are not correctly checked in createDirectories
|
||||
- static void createDirectoriesSymlinkAware(Path path) throws IOException {
|
||||
+ public static void createDirectoriesSymlinkAware(Path path) throws IOException { // Sakura - package-protected -> public
|
||||
if (!Files.isDirectory(path)) {
|
||||
Files.createDirectories(path);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1087,6 +_,7 @@
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
+ this.console.sakuraConfigurations.reloadConfigs(this.console); // Sakura - sakura configuration files; missing comment above :<
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1118,6 +_,7 @@
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
+ me.samsuik.sakura.command.SakuraCommands.registerCommands(this.console); // Sakura - sakura configuration files
|
||||
this.spark.registerCommandBeforePlugins(this); // Paper - spark
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -285,6 +_,12 @@
|
||||
).isValid();
|
||||
}
|
||||
// Paper end
|
||||
+ // Sakura start - local config and property storage
|
||||
+ @Override
|
||||
+ public final me.samsuik.sakura.local.storage.LocalStorageHandler getStorageHandler() {
|
||||
+ return this.getHandle().localConfig();
|
||||
+ }
|
||||
+ // Sakura end - local config and property storage
|
||||
|
||||
private static final Random rand = new Random();
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -176,6 +_,14 @@
|
||||
.describedAs("Jar file");
|
||||
// Paper end
|
||||
|
||||
+ // Sakura start - sakura configuration files
|
||||
+ acceptsAll(asList("sakura-dir", "sakura-settings-directory"), "Directory for Sakura settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File(me.samsuik.sakura.configuration.SakuraConfigurations.CONFIG_DIR))
|
||||
+ .describedAs("Config directory");
|
||||
+ // Sakura end - sakura configuration files
|
||||
+
|
||||
// Paper start
|
||||
acceptsAll(asList("server-name"), "Name of the server")
|
||||
.withRequiredArg()
|
||||
@@ -0,0 +1,21 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -115,6 +_,18 @@
|
||||
throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass()));
|
||||
}
|
||||
|
||||
+ // Sakura start - entity pushed by fluid api
|
||||
+ @Override
|
||||
+ public final boolean isPushedByFluid() {
|
||||
+ return this.getHandle().isPushedByFluid();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final void setPushedByFluid(boolean push) {
|
||||
+ this.getHandle().pushedByFluid = push;
|
||||
+ }
|
||||
+ // Sakura end - entity pushed by fluid api
|
||||
+
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return CraftLocation.toBukkit(this.entity.position(), this.getWorld(), this.entity.getBukkitYaw(), this.entity.getXRot());
|
||||
@@ -0,0 +1,21 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
||||
@@ -14,6 +_,18 @@
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
+ // Sakura start - falling block height parity api
|
||||
+ @Override
|
||||
+ public final void setHeightParity(boolean parity) {
|
||||
+ this.getHandle().heightParity = parity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final boolean getHeightParity() {
|
||||
+ return this.getHandle().heightParity;
|
||||
+ }
|
||||
+ // Sakura end - falling block height parity api
|
||||
+
|
||||
@Override
|
||||
public FallingBlockEntity getHandle() {
|
||||
return (FallingBlockEntity) this.entity;
|
||||
@@ -0,0 +1,21 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -3003,6 +_,18 @@
|
||||
return (this.getHandle().requestedViewDistance() == 0) ? Bukkit.getViewDistance() : this.getHandle().requestedViewDistance();
|
||||
}
|
||||
|
||||
+ // Sakura start - entity tracking range modifier
|
||||
+ @Override
|
||||
+ public double getTrackingRangeModifier() {
|
||||
+ return this.getHandle().trackingRangeModifier * 100.0;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setTrackingRangeModifier(double mod) {
|
||||
+ this.getHandle().trackingRangeModifier = mod / 100.0;
|
||||
+ }
|
||||
+ // Sakura end - entity tracking range modifier
|
||||
+
|
||||
// Paper start
|
||||
@Override
|
||||
public java.util.Locale locale() {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +_,7 @@
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/me.samsuik.sakura/sakura-api/pom.properties"); // Sakura - branding changes
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -228,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static void tpsCommand() {
|
||||
- SpigotConfig.commands.put("tps", new TicksPerSecondCommand("tps"));
|
||||
+ // Sakura - track tick information; replace tps command
|
||||
}
|
||||
|
||||
public static int playerSample;
|
||||
Reference in New Issue
Block a user