13
0
geforkt von Mirrors/Paper
Paper/nms-patches/CommandBlockListenerAbstract.patch
2019-04-23 12:00:00 +10:00

50 Zeilen
2.1 KiB
Diff

--- a/net/minecraft/server/CommandBlockListenerAbstract.java
+++ b/net/minecraft/server/CommandBlockListenerAbstract.java
@@ -4,6 +4,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.annotation.Nullable;
+import org.bukkit.command.CommandSender;
public abstract class CommandBlockListenerAbstract implements ICommandListener {
@@ -15,6 +16,10 @@
private IChatBaseComponent lastOutput;
private String command = "";
private IChatBaseComponent customName = new ChatComponentText("@");
+ // CraftBukkit start
+ @Override
+ public abstract CommandSender getBukkitSender(CommandListenerWrapper wrapper);
+ // CraftBukkit end
public CommandBlockListenerAbstract() {}
@@ -102,14 +107,7 @@
if (minecraftserver != null && minecraftserver.E() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.command)) {
try {
this.lastOutput = null;
- CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> {
- if (flag) {
- ++this.successCount;
- }
-
- });
-
- minecraftserver.getCommandDispatcher().a(commandlistenerwrapper, this.command);
+ this.successCount = minecraftserver.getCommandDispatcher().dispatchServerCommand(this.getWrapper(), this.command); // CraftBukkit
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
@@ -140,6 +138,11 @@
}
public void setName(IChatBaseComponent ichatbasecomponent) {
+ // CraftBukkit start
+ if (ichatbasecomponent == null) {
+ ichatbasecomponent = new ChatComponentText("@");
+ }
+ // CraftBukkit end
this.customName = ichatbasecomponent;
}