geforkt von Mirrors/Paper
170382fe35
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: e7b0f8d6 #642: Add Crafting methods to API 9e58831e SPIGOT-6641: Use varargs in sendMessage e409fe49 SPIGOT-6545: Unable to set Guardian target via API while awareness is disabled 6997c726 SPIGOT-6661: Fix missing radius from GenericGameEvent 02d03f35 SPIGOT-6369: Add ItemStack to HangingPlaceEvent CraftBukkit Changes: 0abf420c SPIGOT-6665: Shearing a Snowman does not drop a carved pumpkin e8e3cbcc #893: Add Crafting methods to API 879acfee Fix missing varargs from previous commit 6572b9c3 SPIGOT-6641: Use varargs in sendMessage 9e06bb2a SPIGOT-6663: Chicken Jockeys chickens don't despawn 699f2d36 SPIGOT-6545: Unable to set Guardian target via API while awareness is disabled 8ffa54ba SPIGOT-6369: Add ItemStack to HangingPlaceEvent c851639c SPIGOT-6645: Call EntityChangeBlockEvent before PlayerHarvestBlockEvent 8d244b0b SPIGOT-3725, SPIGOT-6638, MC-136917: Properly clear tile entities before replacing Spigot Changes: 18c71bf4 Rebuild patches
105 Zeilen
4.9 KiB
Diff
105 Zeilen
4.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William <admin@domnian.com>
|
|
Date: Fri, 18 Mar 2016 03:28:07 -0400
|
|
Subject: [PATCH] Add command to reload permissions.yml and require confirm to
|
|
reload
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
index d2c98a9e670bb5202b6db0a1be8aa2b78328da91..9ba12077dfbdd99cbb269dfcffc09dc9e325bae3 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1831,6 +1831,13 @@ public final class Bukkit {
|
|
public static org.bukkit.command.CommandMap getCommandMap() {
|
|
return server.getCommandMap();
|
|
}
|
|
+
|
|
+ /**
|
|
+ * Reload the Permissions in permissions.yml
|
|
+ */
|
|
+ public static void reloadPermissions() {
|
|
+ server.reloadPermissions();
|
|
+ }
|
|
// Paper end
|
|
|
|
@NotNull
|
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
|
index 5ae4b3c4a20fd8fd727efbfe7b721c9b365b87a6..414a24197256c5a27e9e854a96428ed2aa81f60c 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1620,4 +1620,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
@NotNull
|
|
Spigot spigot();
|
|
// Spigot end
|
|
+
|
|
+ void reloadPermissions(); // Paper
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
|
index 50cc311be7904cc8fc6070a21c8e4de3a489fd20..c62da4131b17e66892678e8b618fb9ba3de93b56 100644
|
|
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
|
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
|
@@ -13,15 +13,35 @@ public class ReloadCommand extends BukkitCommand {
|
|
public ReloadCommand(@NotNull String name) {
|
|
super(name);
|
|
this.description = "Reloads the server configuration and plugins";
|
|
- this.usageMessage = "/reload";
|
|
+ this.usageMessage = "/reload [permissions]"; // Paper
|
|
this.setPermission("bukkit.command.reload");
|
|
this.setAliases(Arrays.asList("rl"));
|
|
}
|
|
|
|
@Override
|
|
- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
|
|
+ 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, ChatColor.GREEN + "Permissions successfully reloaded.");
|
|
+ return true;
|
|
+ } else if ("confirm".equalsIgnoreCase(args[0])) {
|
|
+ confirmed = true;
|
|
+ } else {
|
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Usage: " + usageMessage);
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+ if (!confirmed) {
|
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "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 " + ChatColor.YELLOW + "/reload confirm");
|
|
+ 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();
|
|
@@ -33,6 +53,6 @@ public class ReloadCommand extends BukkitCommand {
|
|
@NotNull
|
|
@Override
|
|
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
|
|
- return Collections.emptyList();
|
|
+ return java.util.Collections.singletonList("permissions"); // Paper
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
index c2c49ee9b5531bc4761d2da54cd707c57fc647bf..2d27dfb859c312d46a14d0356c7c3f227e965a67 100644
|
|
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
@@ -895,4 +895,13 @@ public final class SimplePluginManager implements PluginManager {
|
|
public void useTimings(boolean use) {
|
|
co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ public void clearPermissions() {
|
|
+ permissions.clear();
|
|
+ defaultPerms.get(true).clear();
|
|
+ defaultPerms.get(false).clear();
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
}
|