Fix slow event detection

Time moves forward, so the second call to nanoTime returns a bigger number than
the first one, giving a negative elapsed time … defeating the whole purpose of
this code. :-(
This commit is contained in:
PunKeel 2016-06-19 16:48:49 +02:00 committed by md_5
parent 97eef62684
commit 3fe72154a3

View File

@ -377,10 +377,10 @@ public class PluginManager
eventBus.post( event ); eventBus.post( event );
event.postCall(); event.postCall();
long elapsed = start - System.nanoTime(); long elapsed = System.nanoTime() - start;
if ( elapsed > 250000 ) if ( elapsed > 1000000 )
{ {
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Event {0} took more {1}ns to process!", new Object[] ProxyServer.getInstance().getLogger().log( Level.WARNING, "Event {0} took more {1} than ns to process!", new Object[]
{ {
event, elapsed event, elapsed
} ); } );