@@ -28,41 +28,41 @@ export async function handler(rpInstance: RustPlusInstance, time: rp.AppTime) {
2828 const fn = '[rustPlusTimeHandler: handler]' ;
2929 const logParam = {
3030 guildId : rpInstance . guildId ,
31- serverId : rpInstance . serverId ,
32- serverName : rpInstance . serverName
31+ serverId : rpInstance . serverId
3332 } ;
33+ const rpTime = rpInstance . rpTime as RustPlusTime ;
3434
35- if ( ( rpInstance . rpTime as RustPlusTime ) . isDayLengthMinutesChanged ( time ) ) {
35+ if ( rpTime . isDayLengthMinutesChanged ( time ) ) {
3636 log . info ( `${ fn } dayLengthMinutes changed, ` +
37- `old: ${ rpInstance . rpTime ?. appTime . dayLengthMinutes } , ` +
37+ `old: ${ rpTime ?. appTime . dayLengthMinutes } , ` +
3838 `new: ${ time . dayLengthMinutes } ` ,
3939 logParam ) ;
4040 }
4141
42- if ( ( rpInstance . rpTime as RustPlusTime ) . isTimeScaleChanged ( time ) ) {
42+ if ( rpTime . isTimeScaleChanged ( time ) ) {
4343 log . info ( `${ fn } timeScale changed, ` +
44- `old: ${ rpInstance . rpTime ?. appTime . timeScale } , ` +
44+ `old: ${ rpTime ?. appTime . timeScale } , ` +
4545 `new: ${ time . timeScale } ` ,
4646 logParam ) ;
4747 }
4848
49- if ( ( rpInstance . rpTime as RustPlusTime ) . isSunriseChanged ( time ) ) {
49+ if ( rpTime . isSunriseChanged ( time ) ) {
5050 log . info ( `${ fn } sunrise changed, ` +
51- `old: ${ rpInstance . rpTime ?. appTime . sunrise } , ` +
51+ `old: ${ rpTime ?. appTime . sunrise } , ` +
5252 `new: ${ time . sunrise } ` ,
5353 logParam ) ;
5454 }
5555
56- if ( ( rpInstance . rpTime as RustPlusTime ) . isSunsetChanged ( time ) ) {
56+ if ( rpTime . isSunsetChanged ( time ) ) {
5757 log . info ( `${ fn } sunset changed, ` +
58- `old: ${ rpInstance . rpTime ?. appTime . sunset } , ` +
58+ `old: ${ rpTime ?. appTime . sunset } , ` +
5959 `new: ${ time . sunset } ` ,
6060 logParam ) ;
6161 }
6262
63- if ( ( rpInstance . rpTime as RustPlusTime ) . isTimeChanged ( time ) ) {
63+ if ( rpTime . isTimeChanged ( time ) ) {
6464 //log.info(`${fn} time changed, ` +
65- // `old: ${rpInstance. rpTime?.appTime.time}, ` +
65+ // `old: ${rpTime?.appTime.time}, ` +
6666 // `new: ${time.time}`,
6767 // logParam);
6868 }
@@ -71,11 +71,11 @@ export async function handler(rpInstance: RustPlusInstance, time: rp.AppTime) {
7171 * Custom handlers
7272 */
7373
74- if ( ( rpInstance . rpTime as RustPlusTime ) . isTurnedDay ( time ) ) {
74+ if ( rpTime . isTurnedDay ( time ) ) {
7575 log . info ( `${ fn } Just turned day.` , logParam ) ;
7676 }
7777
78- if ( ( rpInstance . rpTime as RustPlusTime ) . isTurnedNight ( time ) ) {
78+ if ( rpTime . isTurnedNight ( time ) ) {
7979 log . info ( `${ fn } Just turned night.` , logParam ) ;
8080 }
8181}
0 commit comments