geforkt von Mirrors/Paper
SPIGOT-4024: Improve interactions of Vanilla tab completion, and also reloads
Dieser Commit ist enthalten in:
Ursprung
dbc6c660eb
Commit
e5d6f6b596
@ -93,7 +93,7 @@
|
||||
ChatComponentText chatcomponenttext;
|
||||
|
||||
try {
|
||||
@@ -135,54 +188,59 @@
|
||||
@@ -135,65 +188,80 @@
|
||||
return i;
|
||||
} catch (CommandException commandexception) {
|
||||
commandlistenerwrapper.sendFailureMessage(commandexception.a());
|
||||
@ -145,17 +145,17 @@
|
||||
} catch (Exception exception) {
|
||||
- chatcomponenttext = new ChatComponentText;
|
||||
- }
|
||||
+ ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]);
|
||||
|
||||
-
|
||||
- chatcomponenttext.<init>(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
|
||||
- ChatComponentText chatcomponenttext1 = chatcomponenttext;
|
||||
+ ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]);
|
||||
|
||||
- if (CommandDispatcher.a.isDebugEnabled()) {
|
||||
- StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
||||
+ chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
|
||||
+ if (CommandDispatcher.a.isDebugEnabled()) {
|
||||
+ StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
||||
|
||||
- if (CommandDispatcher.a.isDebugEnabled()) {
|
||||
- StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
||||
-
|
||||
- for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
|
||||
- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber()));
|
||||
+ for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
|
||||
@ -180,3 +180,25 @@
|
||||
}
|
||||
|
||||
return b0;
|
||||
}
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
- HashMap hashmap = Maps.newHashMap();
|
||||
+ // CraftBukkit start
|
||||
+ // Register Vanilla commands into builtRoot as before
|
||||
+ Map hashmap = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
|
||||
+ RootCommandNode vanillaRoot = new RootCommandNode();
|
||||
+
|
||||
+ RootCommandNode<CommandListenerWrapper> vanilla = entityplayer.server.vanillaCommandDispatcher.a().getRoot();
|
||||
+ hashmap.put(vanilla, vanillaRoot);
|
||||
+ this.a(vanilla, vanillaRoot, entityplayer.getCommandListener(), (Map) hashmap);
|
||||
+
|
||||
+ // Now build the global commands in a second pass
|
||||
RootCommandNode rootcommandnode = new RootCommandNode();
|
||||
|
||||
hashmap.put(this.b.getRoot(), rootcommandnode);
|
||||
this.a(this.b.getRoot(), rootcommandnode, entityplayer.getCommandListener(), (Map) hashmap);
|
||||
+ // CraftBukkit end
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/CustomFunctionData.java
|
||||
+++ b/net/minecraft/server/CustomFunctionData.java
|
||||
@@ -32,14 +32,16 @@
|
||||
@@ -32,7 +32,7 @@
|
||||
private final Map<MinecraftKey, CustomFunction> g = Maps.newHashMap();
|
||||
private final ArrayDeque<CustomFunctionData.a> h = new ArrayDeque();
|
||||
private boolean i;
|
||||
@ -9,25 +9,16 @@
|
||||
return this.a(minecraftkey) != null;
|
||||
}, this::a, "tags/functions", true, "function");
|
||||
private final List<CustomFunction> k = Lists.newArrayList();
|
||||
private boolean l;
|
||||
+ private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher; // CraftBukkit
|
||||
|
||||
public CustomFunctionData(MinecraftServer minecraftserver) {
|
||||
this.f = minecraftserver;
|
||||
+ this.dispatcher = this.f.getCommandDispatcher().a(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -60,7 +62,7 @@
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
public com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> d() {
|
||||
- return this.f.getCommandDispatcher().a();
|
||||
+ return dispatcher; // CraftBukkit
|
||||
+ return this.f.vanillaCommandDispatcher.a(); // CraftBukkit
|
||||
}
|
||||
|
||||
public void X_() {
|
||||
@@ -164,7 +166,7 @@
|
||||
@@ -164,7 +164,7 @@
|
||||
arraylist.add(CompletableFuture.supplyAsync(() -> {
|
||||
return a(iresourcemanager, minecraftkey);
|
||||
}, Resource.a).thenApplyAsync((list) -> {
|
||||
|
@ -31,10 +31,10 @@
|
||||
+ public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
+ public int autosavePeriod;
|
||||
+ public File bukkitDataPackFolder;
|
||||
+ public CommandDispatcher vanillaCommandDispatcher;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
|
||||
+ this.commandDispatcher = commanddispatcher; // CraftBukkit
|
||||
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
|
||||
this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new);
|
||||
this.ag = new CraftingManager();
|
||||
@ -43,7 +43,7 @@
|
||||
this.am = new CustomFunctionData(this);
|
||||
this.d = proxy;
|
||||
- this.commandDispatcher = commanddispatcher;
|
||||
+ // this.commandDispatcher = commanddispatcher; // CraftBukkit - moved up
|
||||
+ this.commandDispatcher = this.vanillaCommandDispatcher = commanddispatcher; // CraftBukkit
|
||||
this.U = yggdrasilauthenticationservice;
|
||||
this.V = minecraftsessionservice;
|
||||
this.W = gameprofilerepository;
|
||||
|
@ -355,7 +355,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
private void setVanillaCommands() {
|
||||
CommandDispatcher dispatcher = console.getCommandDispatcher();
|
||||
CommandDispatcher dispatcher = console.vanillaCommandDispatcher;
|
||||
|
||||
// Build a list of all Vanilla commands and create wrappers
|
||||
for (CommandNode<CommandListenerWrapper> cmd : dispatcher.a().getRoot().getChildren()) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren