mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-05 00:43:56 +01:00
19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
81 lines
3.3 KiB
Diff
81 lines
3.3 KiB
Diff
From e3fe3d63d1ac971bc8db54461b67e38f0445c464 Mon Sep 17 00:00:00 2001
|
|
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
|
Date: Wed, 12 Feb 2014 20:44:14 +0000
|
|
Subject: [PATCH] Allow vanilla commands to be the main version of a command
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index dbb3324..55658b6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -315,8 +315,11 @@ public final class CraftServer implements Server {
|
|
}
|
|
|
|
if (type == PluginLoadOrder.POSTWORLD) {
|
|
+ // Spigot start - Allow vanilla commands to be forced to be the main command
|
|
+ setVanillaCommands(true);
|
|
commandMap.setFallbackCommands();
|
|
- setVanillaCommands();
|
|
+ setVanillaCommands(false);
|
|
+ // Spigot end
|
|
commandMap.registerServerAliases();
|
|
loadCustomPermissions();
|
|
DefaultPermissions.registerCorePermissions();
|
|
@@ -328,10 +331,19 @@ public final class CraftServer implements Server {
|
|
pluginManager.disablePlugins();
|
|
}
|
|
|
|
- private void setVanillaCommands() {
|
|
+ private void setVanillaCommands(boolean first) { // Spigot
|
|
Map<String, ICommand> commands = new CommandDispatcher().getCommands();
|
|
for (ICommand cmd : commands.values()) {
|
|
- commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null))));
|
|
+ // Spigot start
|
|
+ VanillaCommandWrapper wrapper = new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null)));
|
|
+ if (org.spigotmc.SpigotConfig.replaceCommands.contains( wrapper.getName() ) ) {
|
|
+ if (first) {
|
|
+ commandMap.register("minecraft", wrapper);
|
|
+ }
|
|
+ } else if (!first) {
|
|
+ commandMap.register("minecraft", wrapper);
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index 86c45c6..4932990 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -8,8 +8,10 @@ import java.lang.reflect.Method;
|
|
import java.lang.reflect.Modifier;
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
+import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
+import java.util.Set;
|
|
import java.util.logging.Level;
|
|
import gnu.trove.map.hash.TObjectIntHashMap;
|
|
import net.minecraft.server.MinecraftServer;
|
|
@@ -301,4 +303,16 @@ public class SpigotConfig
|
|
{
|
|
filterCreativeItems = getBoolean( "settings.filter-creative-items", true );
|
|
}
|
|
+
|
|
+ public static Set<String> replaceCommands;
|
|
+ private static void replaceCommands()
|
|
+ {
|
|
+ if ( config.contains( "replace-commands" ) )
|
|
+ {
|
|
+ set( "commands.replace-commands", config.getStringList( "replace-commands" ) );
|
|
+ config.set( "replace-commands", null );
|
|
+ }
|
|
+ replaceCommands = new HashSet<String>( (List<String>) getList( "commands.replace-commands",
|
|
+ Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) );
|
|
+ }
|
|
}
|
|
--
|
|
2.1.0
|
|
|