mirror of
https://github.com/aikar/commands.git
synced 2026-05-31 06:11:55 +00:00
Deprecate bukkit command manager getTimings and remove creation of timing calls #385
There is an acknowledged loss in functionality with this approach for older versions of Minecraft and also Bukkit/Spigot servers which still have continued access to timings. This change was implemented on the current acf snapshot version knowing this, to enable plugin authors to simply recompile to fix this issue without making the small change of upgrading the dependency.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
package co.aikar.commands;
|
||||
|
||||
import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil;
|
||||
import co.aikar.timings.lib.MCTiming;
|
||||
import co.aikar.timings.lib.TimingManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -78,6 +77,7 @@ public class BukkitCommandManager extends CommandManager<
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
protected final Plugin plugin;
|
||||
private final CommandMap commandMap;
|
||||
@Deprecated
|
||||
private final TimingManager timingManager;
|
||||
private final BukkitTask localeTask;
|
||||
private final Logger logger;
|
||||
@@ -87,7 +87,6 @@ public class BukkitCommandManager extends CommandManager<
|
||||
protected Map<String, BukkitRootCommand> registeredCommands = new HashMap<>();
|
||||
protected BukkitCommandContexts contexts;
|
||||
protected BukkitCommandCompletions completions;
|
||||
MCTiming commandTiming;
|
||||
protected BukkitLocales locales;
|
||||
protected Map<UUID, String> issuersLocaleString = new ConcurrentHashMap<>();
|
||||
private boolean cantReadLocale = false;
|
||||
@@ -98,7 +97,6 @@ public class BukkitCommandManager extends CommandManager<
|
||||
String prefix = this.plugin.getDescription().getPrefix();
|
||||
this.logger = Logger.getLogger(prefix != null ? prefix : this.plugin.getName());
|
||||
this.timingManager = TimingManager.of(plugin);
|
||||
this.commandTiming = this.timingManager.of("Commands");
|
||||
this.commandMap = hookCommandMap();
|
||||
this.formatters.put(MessageType.ERROR, defaultFormatter = new BukkitMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED));
|
||||
this.formatters.put(MessageType.SYNTAX, new BukkitMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE));
|
||||
@@ -338,6 +336,7 @@ public class BukkitCommandManager extends CommandManager<
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TimingManager getTimings() {
|
||||
return timingManager;
|
||||
}
|
||||
|
||||
@@ -23,28 +23,11 @@
|
||||
|
||||
package co.aikar.commands;
|
||||
|
||||
import co.aikar.timings.lib.MCTiming;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class BukkitRegisteredCommand extends RegisteredCommand<BukkitCommandExecutionContext> {
|
||||
private final MCTiming timing;
|
||||
BukkitRegisteredCommand(BaseCommand scope, String command, Method method, String prefSubCommand) {
|
||||
super(scope, command, method, prefSubCommand);
|
||||
BukkitCommandManager manager = (BukkitCommandManager) scope.manager;
|
||||
this.timing = manager.getTimings().of("Command: " + this.command, manager.commandTiming);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preCommand() {
|
||||
timing.startTiming();
|
||||
super.preCommand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postCommand() {
|
||||
super.postCommand();
|
||||
timing.stopTiming();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user