Round up setInterval and setTimeout to match bukkit's min 50ms tick.
This commit is contained in:
parent
13ee0d0e9c
commit
5868b9099a
1 changed files with 2 additions and 2 deletions
|
@ -14,7 +14,7 @@ module.exports = function( $ ) {
|
|||
a delay in milliseconds. However, bukkit's scheduler expects a delay in ticks
|
||||
(where 1 tick = 1/20th second)
|
||||
*/
|
||||
var bukkitTask = server.scheduler.runTaskLater( __plugin, callback, delayInMillis/50 );
|
||||
var bukkitTask = server.scheduler.runTaskLater( __plugin, callback, Math.ceil( delayInMillis / 50 ) );
|
||||
return bukkitTask;
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ module.exports = function( $ ) {
|
|||
};
|
||||
|
||||
$.setInterval = function( callback, intervalInMillis ) {
|
||||
var delay = intervalInMillis/ 50;
|
||||
var delay = Math.ceil( intervalInMillis / 50);
|
||||
var bukkitTask = server.scheduler.runTaskTimer( __plugin, callback, delay, delay );
|
||||
return bukkitTask;
|
||||
};
|
||||
|
|
Reference in a new issue