summaryrefslogtreecommitdiffstats
path: root/nms-patches/CustomFunction.patch
blob: a01167d403c31a565ce9d83e78a857199d0b77d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--- a/net/minecraft/server/CustomFunction.java
+++ b/net/minecraft/server/CustomFunction.java
@@ -122,7 +122,15 @@
         }
 
         public void a(CustomFunctionData customfunctiondata, ICommandListener icommandlistener, ArrayDeque<CustomFunctionData.a> arraydeque, int i) {
-            customfunctiondata.a().a(icommandlistener, this.a);
+            // CraftBukkit start
+            org.bukkit.command.CommandSender sender;
+            if (icommandlistener instanceof CustomFunctionData.CustomFunctionListener) {
+                sender = ((CustomFunctionData.CustomFunctionListener) icommandlistener).sender;
+            } else {
+                sender = CommandBlockListenerAbstract.unwrapSender(icommandlistener);
+            }
+            CommandBlockListenerAbstract.executeSafely(icommandlistener, sender, this.a);
+            // CraftBukkit end
         }
 
         public String toString() {