mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Update to 1.21.7
This commit is contained in:
@@ -2914,18 +2914,18 @@ index 59fada9b1eb78238d280c6bbb711f52facba52c6..eb4d78c6111a530d015a0b91d14c40ad
|
||||
return i >= j && i <= k;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 26c214a3570120a2fd32b715113f897e0055fd00..67d7b41a3f15a9873b76f828d7466c33d6f188fc 100644
|
||||
index 4b9b9c12d2b468153f95737d639e630450f6c39b..388884b0ced9ecbaff8d4d0041cafc98472aacdd 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -32,7 +32,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
|
||||
private void setDefaultCommands() {
|
||||
register("bukkit", new ReloadCommand("reload"));
|
||||
@@ -34,7 +34,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
final ReloadCommand reload = new ReloadCommand("reload");
|
||||
this.knownCommands.put("bukkit:reload", reload);
|
||||
this.knownCommands.put("bukkit:rl", reload);
|
||||
- register("bukkit", new co.aikar.timings.TimingsCommand("timings"));
|
||||
}
|
||||
|
||||
public void setFallbackCommands() {
|
||||
@@ -64,7 +63,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@@ -66,7 +65,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
*/
|
||||
@Override
|
||||
public boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command) {
|
||||
@@ -2933,7 +2933,7 @@ index 26c214a3570120a2fd32b715113f897e0055fd00..67d7b41a3f15a9873b76f828d7466c33
|
||||
label = label.toLowerCase(Locale.ROOT).trim();
|
||||
fallbackPrefix = fallbackPrefix.toLowerCase(Locale.ROOT).trim();
|
||||
boolean registered = register(label, command, false, fallbackPrefix);
|
||||
@@ -159,12 +157,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@@ -161,12 +159,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
parsedArgs = event.getArgs();
|
||||
// Purpur end - ExecuteCommandEvent
|
||||
|
||||
@@ -2947,7 +2947,7 @@ index 26c214a3570120a2fd32b715113f897e0055fd00..67d7b41a3f15a9873b76f828d7466c33
|
||||
//try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources // Purpur - Remove Timings
|
||||
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 001465eedafa51ac027a4db51cba6223edfe1171..9cb0f09b821a4020d17771a5b64ddd53e7d78478 100644
|
||||
index dfc2d76403993640e6283f25f9f3647bb6d1a30c..d4a4ae2e8eef3c800bb7ec7713bccb05706b09bc 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -720,12 +720,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Wed, 2 Jul 2025 19:14:14 +0300
|
||||
Subject: [PATCH] Delete ReloadCommand
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 388884b0ced9ecbaff8d4d0041cafc98472aacdd..7627c9c2a855ed1a525a241ccb40edd9ef0a0fe0 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -13,7 +13,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.command.defaults.HelpCommand;
|
||||
-import org.bukkit.command.defaults.ReloadCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -27,13 +26,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
public SimpleCommandMap(@NotNull final Server server, Map<String, Command> backing) {
|
||||
this.knownCommands = backing;
|
||||
this.server = server;
|
||||
- setDefaultCommands();
|
||||
- }
|
||||
-
|
||||
- private void setDefaultCommands() {
|
||||
- final ReloadCommand reload = new ReloadCommand("reload");
|
||||
- this.knownCommands.put("bukkit:reload", reload);
|
||||
- this.knownCommands.put("bukkit:rl", reload);
|
||||
}
|
||||
|
||||
public void setFallbackCommands() {
|
||||
@@ -185,7 +177,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
entry.getValue().unregister(this);
|
||||
}
|
||||
knownCommands.clear();
|
||||
- setDefaultCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
deleted file mode 100644
|
||||
index 607b07a62b0a1a466496b58433c63475a2db05b3..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ /dev/null
|
||||
@@ -1,77 +0,0 @@
|
||||
-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 static net.kyori.adventure.text.Component.text;
|
||||
-
|
||||
-public class ReloadCommand extends BukkitCommand {
|
||||
- public ReloadCommand(@NotNull String name) {
|
||||
- super(name);
|
||||
- this.description = "Reloads the server configuration and plugins";
|
||||
- this.usageMessage = "/reload [permissions|commands|confirm]"; // Paper
|
||||
- this.setPermission("bukkit.command.reload");
|
||||
- this.setAliases(Arrays.asList("rl"));
|
||||
- }
|
||||
-
|
||||
- @org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
- public static final String RELOADING_DISABLED_MESSAGE = "A lifecycle event handler has been registered which makes reloading plugins not possible"; // Paper
|
||||
-
|
||||
- @Override
|
||||
- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper
|
||||
- if (!testPermission(sender)) return true;
|
||||
-
|
||||
- boolean confirmed = System.getProperty("LetMeReload") != null;
|
||||
- if (args.length == 1) {
|
||||
- if (args[0].equalsIgnoreCase("permissions")) {
|
||||
- Bukkit.getServer().reloadPermissions();
|
||||
- Command.broadcastCommandMessage(sender, 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, text("Command aliases successfully reloaded.", net.kyori.adventure.text.format.NamedTextColor.GREEN));
|
||||
- } else {
|
||||
- Command.broadcastCommandMessage(sender, 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, text("Usage: " + usageMessage, net.kyori.adventure.text.format.NamedTextColor.RED));
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
- if (!confirmed) {
|
||||
- Command.broadcastCommandMessage(sender, text("Are you sure you wish to reload your server? This command will be removed soon. Doing so may cause bugs and memory leaks. It is recommended to restart instead of using /bukkit:reload. To confirm, please type ", net.kyori.adventure.text.format.NamedTextColor.RED).append(text("/bukkit:reload confirm", net.kyori.adventure.text.format.NamedTextColor.YELLOW)));
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported, may cause issues when using some plugins, and will be removed soon.");
|
||||
- Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
- // Paper start - lifecycle events
|
||||
- try {
|
||||
- Bukkit.reload();
|
||||
- } catch (final IllegalStateException ex) {
|
||||
- if (ex.getMessage().equals(RELOADING_DISABLED_MESSAGE)) {
|
||||
- Command.broadcastCommandMessage(sender, ChatColor.RED + RELOADING_DISABLED_MESSAGE);
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
- // Paper end - lifecycle events
|
||||
- Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete.");
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- @Override
|
||||
- public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
|
||||
- return com.google.common.collect.Lists.newArrayList("permissions", "commands"); // Paper
|
||||
- }
|
||||
-}
|
||||
@@ -1,116 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 11 Jan 2025 23:50:00 +0300
|
||||
Subject: [PATCH] Disable reload command by default
|
||||
|
||||
This is fully rewritten reload command, you can enable or disable it with -DDivineMC.EnableReloadCommand flag
|
||||
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 bdfe68b386b5ca2878475e548d3c9a3808fce848..55387ddbf5734b3a860f129789b9ce95f0a69618 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
@@ -1,7 +1,5 @@
|
||||
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;
|
||||
@@ -15,7 +13,7 @@ public class ReloadCommand extends BukkitCommand {
|
||||
this.description = "Reloads the server configuration and plugins";
|
||||
this.usageMessage = "/reload [permissions|commands|confirm]"; // Paper
|
||||
this.setPermission("bukkit.command.reload");
|
||||
- this.setAliases(Arrays.asList("rl"));
|
||||
+ this.setAliases(List.of("rl"));
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
@@ -25,47 +23,50 @@ 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));
|
||||
+ // DivineMC start - disable reload command by default & add startup flag
|
||||
+ if (System.getProperty("DivineMC.EnableReloadCommand") == null || false) {
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("Operation denied, command disabled.", net.kyori.adventure.text.format.NamedTextColor.RED));
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("Reload command SHOULD NEVER be used in whatever circumstances.", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("DivineMC has intentionally disabled it in order to stop you using it, instead of restarting your server.", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("If you still want to enable reload command, add -DDivineMC.EnableReloadCommand=true flag to your startup arguments.", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("---------------------------------------------", net.kyori.adventure.text.format.NamedTextColor.GREEN));
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("RESTART YOUR SERVER AND NEVER USE /reload", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("To learn more, read this article: https://madelinemiller.dev/blog/problem-with-reload", net.kyori.adventure.text.format.NamedTextColor.GREEN));
|
||||
+ } else {
|
||||
+ 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 {
|
||||
- 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));
|
||||
+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Usage: " + usageMessage, net.kyori.adventure.text.format.NamedTextColor.RED));
|
||||
+ return true;
|
||||
}
|
||||
- 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.");
|
||||
- // Paper start - lifecycle events
|
||||
- try {
|
||||
- Bukkit.reload();
|
||||
- } catch (final IllegalStateException ex) {
|
||||
- if (ex.getMessage().equals(RELOADING_DISABLED_MESSAGE)) {
|
||||
- Command.broadcastCommandMessage(sender, ChatColor.RED + RELOADING_DISABLED_MESSAGE);
|
||||
- return true;
|
||||
+ 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.");
|
||||
+ // Paper start - lifecycle events
|
||||
+ try {
|
||||
+ Bukkit.reload();
|
||||
+ } catch (final IllegalStateException ex) {
|
||||
+ if (ex.getMessage().equals(RELOADING_DISABLED_MESSAGE)) {
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + RELOADING_DISABLED_MESSAGE);
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
- // Paper end - lifecycle events
|
||||
- Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete.");
|
||||
+ // Paper end - lifecycle events
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete.");
|
||||
|
||||
+ return true;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Smooth teleport API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 531e0b77110b956b772d8698fd838ec2cc83f59c..92c081bdf7aa0cbf545e4aa543f98a3cc000dc8b 100644
|
||||
index 078cb0b4ff04bdae006af913d8b4ecd68fe30637..3b0998aefa32244bd03abdd668cc614f930802f1 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -4044,4 +4044,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -4051,4 +4051,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
sendDeathScreen(message);
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
- static final Color[] colors = {
|
||||
+ public static final Color[] colors = { // DivineMC - Pufferfish SIMD - make public
|
||||
// Start generate - MapPalette#colors
|
||||
// @GeneratedFrom 1.21.6
|
||||
// @GeneratedFrom 1.21.7
|
||||
new Color(0x00000000, true),
|
||||
@@ -395,9 +_,15 @@
|
||||
temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth());
|
||||
|
||||
Reference in New Issue
Block a user