summaryrefslogtreecommitdiffstats
path: root/nms-patches/CustomFunction.patch
blob: b457151c5f1236ed36aae2561dd11ea58c445d4e (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
--- a/net/minecraft/server/CustomFunction.java
+++ b/net/minecraft/server/CustomFunction.java
@@ -45,7 +45,7 @@
                 }
 
                 try {
-                    ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(s, customfunctiondata.f());
+                    ParseResults parseresults = customfunctiondata.d().parse(s, customfunctiondata.f()); // CraftBukkit
 
                     if (parseresults.getReader().canRead()) {
                         if (parseresults.getExceptions().size() == 1) {
@@ -142,7 +142,14 @@
         }
 
         public void a(CustomFunctionData customfunctiondata, CommandListenerWrapper commandlistenerwrapper, ArrayDeque<CustomFunctionData.a> arraydeque, int i) throws CommandSyntaxException {
-            customfunctiondata.d().execute(new ParseResults(this.a.getContext().withSource(commandlistenerwrapper), this.a.getReader(), this.a.getExceptions()));
+            // CraftBukkit start
+            org.bukkit.craftbukkit.command.VanillaCommandWrapper.WorldRescueContext rescue = new org.bukkit.craftbukkit.command.VanillaCommandWrapper.WorldRescueContext().start(commandlistenerwrapper.getWorld());
+            try {
+                customfunctiondata.d().execute(new ParseResults(this.a.getContext().withSource(commandlistenerwrapper), this.a.getReader(), this.a.getExceptions()));
+            } finally {
+                rescue.end();
+            }
+            // CraftBukkit end
         }
 
         public String toString() {