-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Timings v2 implemented! It still has some bugs but it is functional. …
…Updated a small part of the bukkit api.
- Loading branch information
1 parent
0937a40
commit 8049288
Showing
45 changed files
with
881 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
patches/cpw/mods/fml/common/eventhandler/EventBus.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- ../src-base/minecraft/cpw/mods/fml/common/eventhandler/EventBus.java | ||
+++ ../src-work/minecraft/cpw/mods/fml/common/eventhandler/EventBus.java | ||
@@ -9,6 +9,9 @@ | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
+import co.aikar.timings.Timing; | ||
+import io.github.crucible.CrucibleTimings; | ||
+import net.minecraft.server.MinecraftServer; | ||
import org.apache.logging.log4j.Level; | ||
|
||
import com.google.common.base.Preconditions; | ||
@@ -131,19 +134,43 @@ | ||
|
||
public boolean post(Event event) | ||
{ | ||
- IEventListener[] listeners = event.getListenerList().getListeners(busID); | ||
- int index = 0; | ||
- try | ||
- { | ||
- for (; index < listeners.length; index++) | ||
+ if (MinecraftServer.serverStarted) { //Only use timings after the startup. | ||
+ Timing eventTiming = CrucibleTimings.getEventTiming(event); //Crucible | ||
+ eventTiming.startTiming(); //Crucible | ||
+ IEventListener[] listeners = event.getListenerList().getListeners(busID); | ||
+ int index = 0; | ||
+ try | ||
{ | ||
- listeners[index].invoke(event); | ||
+ for (; index < listeners.length; index++) | ||
+ { | ||
+ Timing listenerTimings = CrucibleTimings.getListenerTiming(listeners[index],eventTiming); //Crucible | ||
+ listenerTimings.startTiming(); //Crucible | ||
+ listeners[index].invoke(event); | ||
+ listenerTimings.stopTiming(); //Crucible | ||
+ } | ||
} | ||
+ catch (Throwable throwable) | ||
+ { | ||
+ exceptionHandler.handleException(this, event, listeners, index, throwable); | ||
+ Throwables.propagate(throwable); | ||
+ } | ||
+ eventTiming.stopTiming(); //Crucible | ||
} | ||
- catch (Throwable throwable) | ||
- { | ||
- exceptionHandler.handleException(this, event, listeners, index, throwable); | ||
- Throwables.propagate(throwable); | ||
+ else { //Original code. | ||
+ IEventListener[] listeners = event.getListenerList().getListeners(busID); | ||
+ int index = 0; | ||
+ try | ||
+ { | ||
+ for (; index < listeners.length; index++) | ||
+ { | ||
+ listeners[index].invoke(event); | ||
+ } | ||
+ } | ||
+ catch (Throwable throwable) | ||
+ { | ||
+ exceptionHandler.handleException(this, event, listeners, index, throwable); | ||
+ Throwables.propagate(throwable); | ||
+ } | ||
} | ||
return (event.isCancelable() ? event.isCanceled() : false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.