diff --git a/patches/api/0002-Disable-reload-command-by-default.patch b/patches/api/0002-Disable-reload-command-by-default.patch new file mode 100644 index 0000000..a9de3f0 --- /dev/null +++ b/patches/api/0002-Disable-reload-command-by-default.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Mon, 12 Jun 2023 00:23:38 +0300 +Subject: [PATCH] Disable reload command by default + +This is fully rewritten reload command. Reloading in Bukkit VERY, VERY UNSTABLE and I removed it +Read this article why reload is VERY UNSAFE in Bukkit: https://madelinemiller.dev/blog/problem-with-reload/ + +diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java +index 3ec32b46264cfff857b50129b5e0fa5584943ec6..6975b442ca0f9f7682d7f860256856ecf18b746d 100644 +--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java ++++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java +@@ -1,14 +1,14 @@ + package org.bukkit.command.defaults; + + import java.util.Arrays; +-import java.util.Collections; + import java.util.List; +-import org.bukkit.Bukkit; +-import org.bukkit.ChatColor; ++ + import org.bukkit.command.Command; + import org.bukkit.command.CommandSender; + import org.jetbrains.annotations.NotNull; + ++import net.kyori.adventure.text.format.NamedTextColor; // DivineMC ++ + public class ReloadCommand extends BukkitCommand { + public ReloadCommand(@NotNull String name) { + super(name); +@@ -22,39 +22,12 @@ public class ReloadCommand extends BukkitCommand { + public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper + if (!testPermission(sender)) return true; + +- // Paper start - Reload permissions.yml & require confirm +- boolean confirmed = System.getProperty("LetMeReload") != null; +- if (args.length == 1) { +- if (args[0].equalsIgnoreCase("permissions")) { +- Bukkit.getServer().reloadPermissions(); +- Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Permissions successfully reloaded.", net.kyori.adventure.text.format.NamedTextColor.GREEN)); +- return true; +- } else if ("commands".equalsIgnoreCase(args[0])) { +- if (Bukkit.getServer().reloadCommandAliases()) { +- Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Command aliases successfully reloaded.", net.kyori.adventure.text.format.NamedTextColor.GREEN)); +- } else { +- Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("An error occurred while trying to reload command aliases.", net.kyori.adventure.text.format.NamedTextColor.RED)); +- } +- return true; +- } else if ("confirm".equalsIgnoreCase(args[0])) { +- confirmed = true; +- } else { +- Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Usage: " + usageMessage, net.kyori.adventure.text.format.NamedTextColor.RED)); +- return true; +- } +- } +- if (!confirmed) { +- Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Are you sure you wish to reload your server? Doing so may cause bugs and memory leaks. It is recommended to restart instead of using /reload. To confirm, please type ", net.kyori.adventure.text.format.NamedTextColor.RED).append(net.kyori.adventure.text.Component.text("/reload confirm", net.kyori.adventure.text.format.NamedTextColor.YELLOW))); +- return true; +- } +- // Paper end +- +- Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues when using some plugins."); +- Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server."); +- Bukkit.reload(); +- Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete."); +- ++ // DivineMC start - Disable reload command by default ++ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Reloading disabled by default in DivineMC.", NamedTextColor.RED)); ++ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("This is a permanent change!", NamedTextColor.RED)); ++ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Read here why it is unsafe: https://madelinemiller.dev/blog/problem-with-reload", NamedTextColor.GREEN)); + return true; ++ // DivineMC end + } + + @NotNull