Timings v2: Plugins don't always register commands properly

*mumbles*
This commit is contained in:
Zach Brown 2016-04-30 00:09:29 -05:00
parent 368a822c47
commit 5f98ec08a5
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76

View File

@ -1,4 +1,4 @@
From c6ee4d00002d40f7052f63322b805dfd5aaeaaf7 Mon Sep 17 00:00:00 2001
From 318744eb013e35f3f25e5195870f7dd649cbf5d2 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
@ -2871,7 +2871,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..548d570 100644
index 0ba9b1c..29762b0 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 {
@ -2900,6 +2900,18 @@ index 0ba9b1c..548d570 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("unknown", 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