summaryrefslogtreecommitdiffstats
path: root/nms-patches/CommandBlockListenerAbstract.patch
blob: 39842e8109e8ea0a87623204f784fd1a624528e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- a/net/minecraft/server/CommandBlockListenerAbstract.java
+++ b/net/minecraft/server/CommandBlockListenerAbstract.java
@@ -5,6 +5,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import javax.annotation.Nullable;
+import org.bukkit.command.CommandSender;
 
 public abstract class CommandBlockListenerAbstract implements ICommandListener {
 
@@ -16,6 +17,10 @@
     private IChatBaseComponent f;
     private String g = "";
     private IChatBaseComponent h = new ChatComponentText("@");
+    // CraftBukkit start
+    @Override
+    public abstract CommandSender getBukkitSender(CommandListenerWrapper wrapper);
+    // CraftBukkit end
 
     public CommandBlockListenerAbstract() {}
 
@@ -103,14 +108,7 @@
                 if (minecraftserver != null && minecraftserver.F() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.g)) {
                     try {
                         this.f = null;
-                        CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> {
-                            if (flag) {
-                                ++this.d;
-                            }
-
-                        });
-
-                        minecraftserver.getCommandDispatcher().a(commandlistenerwrapper, this.g);
+                        this.d = minecraftserver.getCommandDispatcher().dispatchServerCommand(this.getWrapper(), this.g); // CraftBukkit
                     } catch (Throwable throwable) {
                         CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
                         CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
@@ -141,6 +139,11 @@
     }
 
     public void setName(IChatBaseComponent ichatbasecomponent) {
+        // CraftBukkit start
+        if (ichatbasecomponent == null) {
+            ichatbasecomponent = new ChatComponentText("@");
+        }
+        // CraftBukkit end
         this.h = ichatbasecomponent;
     }