Commits
md_5 authored 2486fb7c1ff
1 - | From 5ce04b19d40e1696ea08ef6d1f380a4b16ba90be Mon Sep 17 00:00:00 2001 |
1 + | From 6cc98aa15153577874dff0d23a93f99e42b46b08 Mon Sep 17 00:00:00 2001 |
2 2 | From: Aikar <aikar@aikar.co> |
3 3 | Date: Sun, 2 Jun 2013 10:42:57 +1000 |
4 4 | Subject: [PATCH] Spigot Timings |
5 5 | |
6 6 | Adds performance tracking timings all around the Minecraft Server, and improves the usability of the /timings command |
7 7 | |
8 8 | Plugins can track their own timings with CustomTimingsHandler |
9 9 | |
10 10 | diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java |
11 11 | index 2ace8c1..e61e50b 100644 |
43 43 | + |
44 44 | + public org.bukkit.configuration.file.YamlConfiguration getConfig() |
45 45 | + { |
46 46 | + throw new UnsupportedOperationException( "Not supported yet." ); |
47 47 | + } |
48 48 | + } |
49 49 | + |
50 50 | + Spigot spigot(); |
51 51 | } |
52 52 | diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java |
53 - | index a02c28d..0ba9b1c 100644 |
53 + | index 00264b5..ffbe5dd 100644 |
54 54 | --- a/src/main/java/org/bukkit/command/Command.java |
55 55 | +++ b/src/main/java/org/bukkit/command/Command.java |
56 - | |
56 + | |
57 57 | protected String usageMessage; |
58 58 | private String permission; |
59 59 | private String permissionMessage; |
60 60 | + public org.spigotmc.CustomTimingsHandler timings; // Spigot |
61 61 | |
62 62 | protected Command(String name) { |
63 63 | this(name, "", "/" + name, new ArrayList<String>()); |
64 - | |
64 + | |
65 65 | this.usageMessage = usageMessage; |
66 66 | this.aliases = aliases; |
67 67 | this.activeAliases = new ArrayList<String>(aliases); |
68 68 | + this.timings = new org.spigotmc.CustomTimingsHandler("** Command: " + name); // Spigot |
69 69 | } |
70 70 | |
71 71 | /** |
72 - | |
72 + | |
73 73 | public boolean setLabel(String name) { |
74 74 | this.nextLabel = name; |
75 75 | if (!isRegistered()) { |
76 76 | + this.timings = new org.spigotmc.CustomTimingsHandler("** Command: " + name); // Spigot |
77 77 | this.label = name; |
78 78 | return true; |
79 79 | } |
80 80 | diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java |
81 - | index a026203..e2fc282 100644 |
81 + | index 4d475c6..5965514 100644 |
82 82 | --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java |
83 83 | +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java |
84 - | |
84 + | |
85 85 | } |
86 86 | |
87 87 | try { |
88 88 | + target.timings.startTiming(); // Spigot |
89 89 | // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) |
90 90 | target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); |
91 91 | + target.timings.stopTiming(); // Spigot |
92 92 | } catch (CommandException ex) { |
93 93 | + target.timings.stopTiming(); // Spigot |
94 94 | throw ex; |