Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
SPIGOT-2134: Support /execute being chained
Dieser Commit ist enthalten in:
Ursprung
f060bba1ca
Commit
a4786c824f
@ -11,23 +11,44 @@
|
|||||||
|
|
||||||
public class CommandExecute extends CommandAbstract {
|
public class CommandExecute extends CommandAbstract {
|
||||||
|
|
||||||
@@ -97,22 +101,48 @@
|
@@ -49,7 +53,10 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
String s = a(astring, b0);
|
||||||
|
- ICommandListener icommandlistener1 = new ICommandListener() {
|
||||||
|
+ // CraftBukkit start - name class
|
||||||
|
+ class ProxyListener implements ICommandListener {
|
||||||
|
+ private final ICommandListener base = icommandlistener;
|
||||||
|
+ // CraftBukkit end
|
||||||
|
public String getName() {
|
||||||
|
return entity.getName();
|
||||||
|
}
|
||||||
|
@@ -94,25 +101,57 @@
|
||||||
|
return entity.h();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
+ ICommandListener icommandlistener1 = new ProxyListener(); // CraftBukkit
|
||||||
ICommandHandler icommandhandler = minecraftserver.getCommandHandler();
|
ICommandHandler icommandhandler = minecraftserver.getCommandHandler();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
- int j = icommandhandler.a(icommandlistener1, s);
|
- int j = icommandhandler.a(icommandlistener1, s);
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ org.bukkit.command.CommandSender sender = null;
|
+ org.bukkit.command.CommandSender sender = null;
|
||||||
+ if (icommandlistener instanceof DedicatedServer) {
|
+ ICommandListener listener = icommandlistener;
|
||||||
+ sender = MinecraftServer.getServer().server.getConsoleSender();
|
+ while (sender == null) {
|
||||||
+ } else if (icommandlistener instanceof CommandBlockListenerAbstract) {
|
+ if (listener instanceof DedicatedServer) {
|
||||||
+ sender = ((CommandBlockListenerAbstract) icommandlistener).sender;
|
+ sender = minecraftserver.server.getConsoleSender();
|
||||||
+ } else if (VanillaCommandWrapper.lastSender != null) {
|
+ } else if (listener instanceof CommandBlockListenerAbstract) {
|
||||||
+ sender = VanillaCommandWrapper.lastSender;
|
+ sender = ((CommandBlockListenerAbstract) listener).sender;
|
||||||
+ }else if (icommandlistener.f() != null) {
|
+ } else if (listener instanceof ProxyListener) {
|
||||||
+ sender = icommandlistener.f().getBukkitEntity();
|
+ listener = ((ProxyListener) icommandlistener).base; // Search deeper
|
||||||
+ } else {
|
+ } else if (VanillaCommandWrapper.lastSender != null) {
|
||||||
+ throw new CommandException("Unhandled executor " + icommandlistener.getClass().getSimpleName(), new Object[0]);
|
+ sender = VanillaCommandWrapper.lastSender;
|
||||||
|
+ } else if (listener.f() != null) {
|
||||||
|
+ sender = listener.f().getBukkitEntity();
|
||||||
|
+ } else {
|
||||||
|
+ throw new CommandException("Unhandled executor " + icommandlistener.getClass().getSimpleName(), new Object[0]);
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ int j = CommandBlockListenerAbstract.executeCommand(icommandlistener1, new ProxiedNativeCommandSender(icommandlistener1, sender, entity.getBukkitEntity()), s);
|
+ int j = CommandBlockListenerAbstract.executeCommand(icommandlistener1, new ProxiedNativeCommandSender(icommandlistener1, sender, entity.getBukkitEntity()), s);
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren