3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00

Ensure gameLoop function gets selectors applied.

Dieser Commit ist enthalten in:
md_5 2017-05-26 16:43:56 +10:00
Ursprung c7920f4302
Commit a479029a85
3 geänderte Dateien mit 61 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,11 @@
--- a/net/minecraft/server/CustomFunction.java
+++ b/net/minecraft/server/CustomFunction.java
@@ -130,7 +130,7 @@
}
public void a(CustomFunctionData customfunctiondata, ICommandListener icommandlistener, ArrayDeque<CustomFunctionData.a> arraydeque, int i) {
- customfunctiondata.a().a(icommandlistener, this.a);
+ CommandBlockListenerAbstract.executeSafely(icommandlistener, new org.bukkit.craftbukkit.command.CraftFunctionCommandSender(icommandlistener), this.a); // CraftBukkit
}
public String toString() {

Datei anzeigen

@ -0,0 +1,47 @@
package org.bukkit.craftbukkit.command;
import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.ICommandListener;
import org.bukkit.craftbukkit.util.CraftChatMessage;
public class CraftFunctionCommandSender extends ServerCommandSender {
private final ICommandListener handle;
public CraftFunctionCommandSender(ICommandListener handle) {
this.handle = handle;
}
@Override
public void sendMessage(String message) {
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
handle.sendMessage(component);
}
}
@Override
public void sendMessage(String[] messages) {
for (String message : messages) {
sendMessage(message);
}
}
@Override
public String getName() {
return handle.getName();
}
@Override
public boolean isOp() {
return true;
}
@Override
public void setOp(boolean value) {
throw new UnsupportedOperationException("Cannot change operator status of server function sender");
}
public ICommandListener getHandle() {
return handle;
}
}

Datei anzeigen

@ -158,6 +158,9 @@ public final class VanillaCommandWrapper extends Command {
if (sender instanceof ProxiedCommandSender) {
return ((ProxiedNativeCommandSender) sender).getHandle();
}
if (sender instanceof CraftFunctionCommandSender) {
return ((CraftFunctionCommandSender) sender).getHandle();
}
throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener");
}