Skip to content

Commit

Permalink
dab
Browse files Browse the repository at this point in the history
  • Loading branch information
AltronMaxX committed Jan 5, 2024
1 parent aa3b673 commit 341e334
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 41 deletions.
50 changes: 23 additions & 27 deletions patches/server/0012-Add-Foldenor-commands.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Add-Foldenor-commands

diff --git a/src/main/java/net/edenor/foldenor/command/FoldenorCommands.java b/src/main/java/net/edenor/foldenor/command/FoldenorCommands.java
new file mode 100644
index 0000000000000000000000000000000000000000..15ec8927b219ac4006332ffdbb59b7de70cf6d23
index 0000000000000000000000000000000000000000..0a31c1c7ae98ceca60e8e57a56298e36650b9e68
--- /dev/null
+++ b/src/main/java/net/edenor/foldenor/command/FoldenorCommands.java
@@ -0,0 +1,30 @@
@@ -0,0 +1,28 @@
+package net.edenor.foldenor.command;
+
+import net.edenor.foldenor.commands.ChunkTPCommand;
Expand All @@ -35,17 +35,15 @@ index 0000000000000000000000000000000000000000..15ec8927b219ac4006332ffdbb59b7de
+ }
+
+ public static void registerCommands(final MinecraftServer server) {
+ COMMANDS.forEach((s, command) -> {
+ server.server.getCommandMap().register(s, "Foldenor", command);
+ });
+ COMMANDS.forEach((s, command) -> server.server.getCommandMap().register(s, "Foldenor", command));
+ }
+}
diff --git a/src/main/java/net/edenor/foldenor/commands/ChunkTPCommand.java b/src/main/java/net/edenor/foldenor/commands/ChunkTPCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..629fcb1b362c15fb3b989cc0581cf97c81237688
index 0000000000000000000000000000000000000000..f343f7921361c4ddb58db4b0f02de978b21dbdb4
--- /dev/null
+++ b/src/main/java/net/edenor/foldenor/commands/ChunkTPCommand.java
@@ -0,0 +1,63 @@
@@ -0,0 +1,58 @@
+package net.edenor.foldenor.commands;
+
+
Expand All @@ -66,19 +64,14 @@ index 0000000000000000000000000000000000000000..629fcb1b362c15fb3b989cc0581cf97c
+public class ChunkTPCommand extends Command {
+ public ChunkTPCommand(@NotNull String name) {
+ super(name);
+ final List<String> permissions = new ArrayList<>();
+ permissions.add("bukkit.command.foldenor.chunktp");
+ this.setPermission(String.join(";", permissions));
+ final PluginManager pluginManager = Bukkit.getServer().getPluginManager();
+ pluginManager.addPermission(new Permission("bukkit.command.foldenor.chunktp", PermissionDefault.OP));
+ this.setPermission("bukkit.command.foldenor.chunktp");
+ this.description = "Teleport to chunk";
+ this.usageMessage = "/chunktp [chunkX] [chunkZ]";
+ }
+
+ @Override
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
+ if (!sender.hasPermission("bukkit.command.foldenor.chunktp")) {
+ sender.sendMessage(Bukkit.permissionMessage());
+ return false;
+ }
+ if (!testPermission(sender)) return true;
+
+ if (sender instanceof CraftPlayer player) {
+ if (args.length == 2) {
Expand Down Expand Up @@ -111,15 +104,16 @@ index 0000000000000000000000000000000000000000..629fcb1b362c15fb3b989cc0581cf97c
+}
diff --git a/src/main/java/net/edenor/foldenor/commands/FoldenorReloadConfigCommand.java b/src/main/java/net/edenor/foldenor/commands/FoldenorReloadConfigCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..ad854d09999ce2bee9e48976eb79ef02426947a4
index 0000000000000000000000000000000000000000..4188e8db6386fe1790192c9efd8c2fe256ce6418
--- /dev/null
+++ b/src/main/java/net/edenor/foldenor/commands/FoldenorReloadConfigCommand.java
@@ -0,0 +1,46 @@
@@ -0,0 +1,49 @@
+package net.edenor.foldenor.commands;
+
+import net.edenor.foldenor.config.FoldenorConfig;
+import net.minecraft.server.dedicated.DedicatedServer;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.permissions.Permission;
Expand All @@ -128,6 +122,7 @@ index 0000000000000000000000000000000000000000..ad854d09999ce2bee9e48976eb79ef02
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static net.kyori.adventure.text.Component.text;
Expand All @@ -138,19 +133,20 @@ index 0000000000000000000000000000000000000000..ad854d09999ce2bee9e48976eb79ef02
+
+ public FoldenorReloadConfigCommand(@NotNull String name) {
+ super(name);
+ final List<String> permissions = new ArrayList<>();
+ permissions.add("bukkit.command.foldenor.reload_config");
+ this.setPermission(String.join(";", permissions));
+ final PluginManager pluginManager = Bukkit.getServer().getPluginManager();
+ pluginManager.addPermission(new Permission("bukkit.command.foldenor.reload_config", PermissionDefault.OP));
+ this.setPermission("bukkit.command.foldenor.reload_config");
+ this.description = "Reload Foldenor config";
+ this.usageMessage = "/foldenor-reload";
+ }
+
+ @Override
+ public @NotNull List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
+ if (!sender.hasPermission("bukkit.command.foldenor.reload_config")) {
+ sender.sendMessage(Bukkit.permissionMessage());
+ return false;
+ }
+ if (!testPermission(sender)) return true;
+
+ try {
+ FoldenorConfig.reload((java.io.File) DedicatedServer.getServer().options.valueOf("foldenor-settings"));
+ Command.broadcastCommandMessage(sender, text("Foldenor config reload complete.", GREEN));
Expand Down
2 changes: 0 additions & 2 deletions patches/server/0021-Villagers-dispawn-fix.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ From: AltronMaxX <[email protected]>
Date: Mon, 1 Jan 2024 19:57:46 +0400
Subject: [PATCH] Villagers-dispawn-fix

Experimental


diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
index a4157bc24c36c63502667d69910108a50114f370..41f50fcd74f878cf5d40bd5818465f1c55c36fcf 100644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ index 0000000000000000000000000000000000000000..f8e9e4c964145766f398a7adf7de9e4b
+ }
+}
diff --git a/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java b/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java
index c668d7e2c64379e48a12a4c93dbdf18a5ed8cbe7..79073eca74752d550a21f357b5370a76a1457863 100644
index c668d7e2c64379e48a12a4c93dbdf18a5ed8cbe7..cdd37da79fade2813109f5aabdfa1f06d4b36e1a 100644
--- a/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java
+++ b/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java
@@ -2,6 +2,7 @@ package net.edenor.foldenor.config;
Expand All @@ -303,16 +303,18 @@ index c668d7e2c64379e48a12a4c93dbdf18a5ed8cbe7..79073eca74752d550a21f357b5370a76
public static RegionFileFormat regionFormatName = RegionFileFormat.ANVIL;
public static int regionFormatLinearCompressionLevel = 1;
public static int linearFlushFrequency = 10;
@@ -71,6 +74,9 @@ public class FoldenorConfig {
set("config-version", 1);

readConfig();
@@ -132,6 +135,11 @@ public class FoldenorConfig {
enableSuffocationOptimization = getBoolean("optimizations.optimize_suffocation_check",enableSuffocationOptimization);
entityWakeUpDurationRatioStandardDeviation = getDouble("optimizations.entity_wakeup_duration_ratio_standard_deviation",entityWakeUpDurationRatioStandardDeviation);
loadChunksToActiveClimbingEntities = getBoolean("optimizations.load_chunks_to_active_climbing_entities",loadChunksToActiveClimbingEntities);
+
+
+
+ enableAsyncMobSpawning = getBoolean("optimizations.enable_async_mob_spawning",enableAsyncMobSpawning);
+ RegionizedWorldData.initMobSpawningExecutor();
}

protected static void log(String s) {
private static void networkSettings() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 8082c189fc414b741bff9ca9b259b448e8adf0d2..014e237f6737ac6b5a584d383fbc5219b76786d4 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
Expand Down
12 changes: 6 additions & 6 deletions patches/server/0039-Change-reload-config-work.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ Subject: [PATCH] Change-reload-config-work


diff --git a/src/main/java/net/edenor/foldenor/commands/FoldenorReloadConfigCommand.java b/src/main/java/net/edenor/foldenor/commands/FoldenorReloadConfigCommand.java
index ad854d09999ce2bee9e48976eb79ef02426947a4..b9406cfec2606fabe7fcd22591d19f1ea2f04834 100644
index 4188e8db6386fe1790192c9efd8c2fe256ce6418..9b49dafe2706a41200b1f2ee74f4b857346e5418 100644
--- a/src/main/java/net/edenor/foldenor/commands/FoldenorReloadConfigCommand.java
+++ b/src/main/java/net/edenor/foldenor/commands/FoldenorReloadConfigCommand.java
@@ -35,7 +35,7 @@ public class FoldenorReloadConfigCommand extends Command {
return false;
}
@@ -38,7 +38,7 @@ public class FoldenorReloadConfigCommand extends Command {
if (!testPermission(sender)) return true;

try {
- FoldenorConfig.reload((java.io.File) DedicatedServer.getServer().options.valueOf("foldenor-settings"));
+ FoldenorConfig.readConfig();
Command.broadcastCommandMessage(sender, text("Foldenor config reload complete.", GREEN));
return true;
} catch (Exception e) {
diff --git a/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java b/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java
index 79073eca74752d550a21f357b5370a76a1457863..7c50e7ab39070b72508a467fe0a93575fc09d58c 100644
index cdd37da79fade2813109f5aabdfa1f06d4b36e1a..7c250066700fc4c822c793b46f1d50680b97efcc 100644
--- a/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java
+++ b/src/main/java/net/edenor/foldenor/config/FoldenorConfig.java
@@ -89,7 +89,7 @@ public class FoldenorConfig {
@@ -86,7 +86,7 @@ public class FoldenorConfig {
Bukkit.getLogger().log(level, s);
}

Expand Down
Loading

0 comments on commit 341e334

Please sign in to comment.