Validate.notNull(listener, "Listener can not be null"); boolean useTimings = server.getPluginManager().useTimings(); Map<Class<? extends Event>, Set<RegisteredListener>> ret = new HashMap<Class<? extends Event>, Set<RegisteredListener>>(); Set<Method> methods;
return false; if (!sender.getServer().getPluginManager().useTimings()) { sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml"); return true;
@Override public boolean useTimings() { return instance.useTimings(); } }
@Override protected boolean isTimingsEnabled() { return Bukkit.getPluginManager().useTimings(); }
/** * Starts timing to track a section of code. */ public void startTiming() { // If second condtion fails we are already timing if ( Bukkit.getPluginManager().useTimings() && ++timingDepth == 1 ) { start = System.nanoTime(); if ( parent != null && ++parent.timingDepth == 1 ) { parent.start = start; } } }
/** * Ticked every tick by CraftBukkit to count the number of times a timer * caused TPS loss. */ public static void tick() { if ( Bukkit.getPluginManager().useTimings() ) { for ( CustomTimingsHandler timings : HANDLERS ) { if ( timings.curTickTotal > 50000000 ) { timings.violations += Math.ceil( timings.curTickTotal / 50000000 ); } timings.curTickTotal = 0; timings.timingDepth = 0; // incase reset messes this up } } }
/** * Resets all timings. */ public static void reload() { if ( Bukkit.getPluginManager().useTimings() ) { for ( CustomTimingsHandler timings : HANDLERS ) { timings.reset(); } } TimingsCommand.timingStart = System.nanoTime(); }
/** * Stops timing a section of code. */ public void stopTiming() { if ( Bukkit.getPluginManager().useTimings() ) { if ( --timingDepth != 0 || start == 0 ) { return; } long diff = System.nanoTime() - start; totalTime += diff; curTickTotal += diff; count++; start = 0; if ( parent != null ) { parent.stopTiming(); } } }
if ( !Bukkit.getPluginManager().useTimings() )
Validate.notNull(listener, "Listener can not be null"); boolean useTimings = server.getPluginManager().useTimings(); Map<Class<? extends Event>, Set<RegisteredListener>> ret = new HashMap<Class<? extends Event>, Set<RegisteredListener>>(); Set<Method> methods;
if(this.getServer().getPluginManager().useTimings()) { handler.register(new TimedRegisteredListener(listener, executor, priority, this, false)); } else {