CzechHek / Core

Repository of Core base.
The Unlicense
41 stars 64 forks source link

interval()/timeout() seemed to be broken. #15

Closed commandblock2 closed 4 years ago

commandblock2 commented 4 years ago

In my case it seemed that interval()/timeout() was broken. Using these function will cause TypeError: Can not create new object with constructor net.minecraft.util.Timer with the passed arguments; they do not match any of its method signatures.

It seemed that Timer was imported as net.minecraft.util.Timer(Auto Import) instead of java.util.Timer. https://github.com/CzechHek/Core/blob/f8653d96358b9bcadbff5513d547a79a19a38e73/Core.lib#L218 https://github.com/CzechHek/Core/blob/f8653d96358b9bcadbff5513d547a79a19a38e73/Core.lib#L222

interval was defined using Timer. function interval(ms, func) (_timer = new Timer("setInterval", true), _timer.schedule(func, 0, ms), _timer);.

Renaming Timer to JavaTimer should fix the problem. (Can't come up with a better name lol).