mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Try to determine plugin name on bad plugin command registration
This commit is contained in:
parent
81f624837f
commit
3b3f85f88f
1 changed files with 9 additions and 7 deletions
|
@ -2085,13 +2085,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public static Timing getCommandTiming(String pluginName, Command command) {
|
||||
+ Plugin plugin = null;
|
||||
+ final Server server = Bukkit.getServer();
|
||||
+ if (!("minecraft".equals(pluginName) || "bukkit".equals(pluginName) || "Spigot".equals(pluginName) ||
|
||||
+ server == null)) {
|
||||
+ if (!( server == null || pluginName == null ||
|
||||
+ "minecraft".equals(pluginName) || "bukkit".equals(pluginName) ||
|
||||
+ "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName)
|
||||
+ )) {
|
||||
+ plugin = server.getPluginManager().getPlugin(pluginName);
|
||||
+ if (plugin == null) {
|
||||
+ // Plugin is passing custom fallback prefix, try to look up by class loader
|
||||
+ plugin = getPluginByClassloader(command.getClass());
|
||||
+ }
|
||||
+ }
|
||||
+ if (plugin == null) {
|
||||
+ // Plugin is passing custom fallback prefix, try to look up by class loader
|
||||
+ plugin = getPluginByClassloader(command.getClass());
|
||||
+ }
|
||||
+ if (plugin == null) {
|
||||
+ return Timings.ofSafe("Command: " + pluginName + ":" + command.getTimingName());
|
||||
|
@ -2906,7 +2908,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
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);
|
||||
+ this.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, this);
|
||||
+ }
|
||||
+ // Paper end
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue