Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
SPIGOT-3182: Fix tab-completion in command blocks without leading slash
Dieser Commit ist enthalten in:
Ursprung
d219213e2b
Commit
1ac133ecc5
@ -568,7 +568,7 @@
|
|||||||
return arraylist;
|
return arraylist;
|
||||||
}
|
}
|
||||||
+ */
|
+ */
|
||||||
+ return server.tabComplete(icommandlistener, s, blockposition);
|
+ return server.tabComplete(icommandlistener, s, blockposition, flag);
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1532,14 +1532,14 @@ public final class CraftServer implements Server {
|
|||||||
return warningState;
|
return warningState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> tabComplete(net.minecraft.server.ICommandListener sender, String message, BlockPosition pos) {
|
public List<String> tabComplete(net.minecraft.server.ICommandListener sender, String message, BlockPosition pos, boolean forceCommand) {
|
||||||
if (!(sender instanceof EntityPlayer)) {
|
if (!(sender instanceof EntityPlayer)) {
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> offers;
|
List<String> offers;
|
||||||
Player player = ((EntityPlayer) sender).getBukkitEntity();
|
Player player = ((EntityPlayer) sender).getBukkitEntity();
|
||||||
if (message.startsWith("/")) {
|
if (message.startsWith("/") || forceCommand) {
|
||||||
offers = tabCompleteCommand(player, message, pos);
|
offers = tabCompleteCommand(player, message, pos);
|
||||||
} else {
|
} else {
|
||||||
offers = tabCompleteChat(player, message);
|
offers = tabCompleteChat(player, message);
|
||||||
@ -1554,10 +1554,14 @@ public final class CraftServer implements Server {
|
|||||||
public List<String> tabCompleteCommand(Player player, String message, BlockPosition pos) {
|
public List<String> tabCompleteCommand(Player player, String message, BlockPosition pos) {
|
||||||
List<String> completions = null;
|
List<String> completions = null;
|
||||||
try {
|
try {
|
||||||
|
if (message.startsWith("/")) {
|
||||||
|
// Trim leading '/' if present (won't always be present in command blocks)
|
||||||
|
message = message.substring(1);
|
||||||
|
}
|
||||||
if (pos == null) {
|
if (pos == null) {
|
||||||
completions = getCommandMap().tabComplete(player, message.substring(1));
|
completions = getCommandMap().tabComplete(player, message);
|
||||||
} else {
|
} else {
|
||||||
completions = getCommandMap().tabComplete(player, message.substring(1), new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
completions = getCommandMap().tabComplete(player, message, new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
}
|
}
|
||||||
} catch (CommandException ex) {
|
} catch (CommandException ex) {
|
||||||
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
|
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren