Move bad command registration workaround into SMP#dispatch
Fixes GH-274
This commit is contained in:
parent
4cfcd525c4
commit
2304826f19
3 changed files with 27 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
|||
From b005a8e4ac2677606ef91377f4b4d66bc869b0ad Mon Sep 17 00:00:00 2001
|
||||
From 68eaefeb0f88b94668bf7b5a6ac302b3b753cb89 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 29 Feb 2016 18:48:17 -0600
|
||||
Subject: [PATCH] Timings v2
|
||||
|
@ -2873,7 +2873,7 @@ index 69720e9..f82cbaf 100644
|
|||
* Sends the component to the player
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||
index 0ba9b1c..b2684fc 100644
|
||||
index 0ba9b1c..548d570 100644
|
||||
--- a/src/main/java/org/bukkit/command/Command.java
|
||||
+++ b/src/main/java/org/bukkit/command/Command.java
|
||||
@@ -31,7 +31,8 @@ public abstract class Command {
|
||||
|
@ -2902,18 +2902,6 @@ index 0ba9b1c..b2684fc 100644
|
|||
this.label = name;
|
||||
return true;
|
||||
}
|
||||
@@ -247,6 +246,11 @@ public abstract class Command {
|
||||
public boolean register(CommandMap commandMap) {
|
||||
if (allowChangesFrom(commandMap)) {
|
||||
this.commandMap = commandMap;
|
||||
+ // Paper start - Some plugins do things the wrong way, try and account for that
|
||||
+ if (this.timings == null) {
|
||||
+ this.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, this);
|
||||
+ }
|
||||
+ // Paper end
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java
|
||||
index 3f07d7f..f89ad07 100644
|
||||
--- a/src/main/java/org/bukkit/command/FormattedCommandAlias.java
|
||||
|
@ -2937,7 +2925,7 @@ index 3f07d7f..f89ad07 100644
|
|||
return i >= j && i <= k;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index a08a49d..a300ae7 100644
|
||||
index a08a49d..d1a047a 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -31,7 +31,7 @@ public class SimpleCommandMap implements CommandMap {
|
||||
|
@ -2957,6 +2945,19 @@ index a08a49d..a300ae7 100644
|
|||
label = label.toLowerCase().trim();
|
||||
fallbackPrefix = fallbackPrefix.toLowerCase().trim();
|
||||
boolean registered = register(label, command, false, fallbackPrefix);
|
||||
@@ -135,6 +136,12 @@ public class SimpleCommandMap implements CommandMap {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // Paper start - Plugins do weird things to workaround normal registration
|
||||
+ if (target.timings == null) {
|
||||
+ target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
try {
|
||||
target.timings.startTiming(); // Spigot
|
||||
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
||||
deleted file mode 100644
|
||||
index fc59aa3..0000000
|
||||
|
@ -3595,5 +3596,5 @@ index 8d98297..7e89b97 100644
|
|||
- }
|
||||
}
|
||||
--
|
||||
2.8.1
|
||||
2.8.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 95affa5d23889fc61fbc4a2c37879369754609c3 Mon Sep 17 00:00:00 2001
|
||||
From d024a66976d1c5f34c53e0f9a244b9686e8f11a9 Mon Sep 17 00:00:00 2001
|
||||
From: DemonWav <demonwav@gmail.com>
|
||||
Date: Mon, 29 Feb 2016 19:37:41 -0600
|
||||
Subject: [PATCH] Add Location support to tab completers (vanilla feature
|
||||
|
@ -99,7 +99,7 @@ index 3bfa31f..9b93872 100644
|
|||
@Override
|
||||
public String toString() {
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index a300ae7..980c4fd 100644
|
||||
index d1a047a..fc5bc77 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -12,6 +12,7 @@ import java.util.Map;
|
||||
|
@ -110,7 +110,7 @@ index a300ae7..980c4fd 100644
|
|||
import org.bukkit.Server;
|
||||
import org.bukkit.command.defaults.*;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -167,6 +168,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@@ -173,6 +174,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
}
|
||||
|
||||
public List<String> tabComplete(CommandSender sender, String cmdLine) {
|
||||
|
@ -125,7 +125,7 @@ index a300ae7..980c4fd 100644
|
|||
Validate.notNull(sender, "Sender cannot be null");
|
||||
Validate.notNull(cmdLine, "Command line cannot null");
|
||||
|
||||
@@ -211,13 +220,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@@ -217,13 +226,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
String[] args = PATTERN_ON_SPACE.split(argLine, -1);
|
||||
|
||||
try {
|
||||
|
@ -165,5 +165,5 @@ index 6d61e3a..85b10e5 100644
|
|||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.8.0
|
||||
2.8.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From dec653a0fcd117f48e13a63d763fd7387d1d58a0 Mon Sep 17 00:00:00 2001
|
||||
From 971a2074ef245da993d3833bc30996d71364db96 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 20:24:35 -0600
|
||||
Subject: [PATCH] Add exception reporting event
|
||||
|
@ -458,7 +458,7 @@ index 0000000..5582999
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 980c4fd..98b71e2 100644
|
||||
index fc5bc77..3a7b4b6 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -11,6 +11,9 @@ import java.util.List;
|
||||
|
@ -471,7 +471,7 @@ index 980c4fd..98b71e2 100644
|
|||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@@ -147,7 +150,9 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@@ -153,7 +156,9 @@ public class SimpleCommandMap implements CommandMap {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
target.timings.stopTiming(); // Spigot
|
||||
|
@ -482,7 +482,7 @@ index 980c4fd..98b71e2 100644
|
|||
}
|
||||
|
||||
// return true as command was handled
|
||||
@@ -224,7 +229,9 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@@ -230,7 +235,9 @@ public class SimpleCommandMap implements CommandMap {
|
||||
} catch (CommandException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
|
@ -587,5 +587,5 @@ index 1325b03..49f5872 100644
|
|||
}
|
||||
}
|
||||
--
|
||||
2.8.0
|
||||
2.8.2
|
||||
|
||||
|
|
Loading…
Reference in a new issue