CommandHelper

CommandHelper

46.5k Downloads

get_server_info() wrong argument

LadyCailinBot opened this issue ยท 4 comments

commented

CMDHELPER-3077 - Reported by macjuul

get_server_info() returns an array with server data. There are currently 16 'indexes' it returns, althrough, when you use get_server_info(), can only go up to 12, not to 16.

Version: #2890

EDIT: the Uptime value in get_server_info() seems a bit buggy too. First of all it gets returned as double with a decimal number, where a milisecond can't even go into decimals. Second is that after some time it will start turning into xxxxxxxxxxxE#, where x and # are numbers. I can't use this now as after time time the int will turn into a string with 'E#' in it :/

commented

Comment by macjuul

A new development build luckily fixed the index bug, but the uptime bug still persists.
I might have found the issue at:
CommandHelper/src/main/java/com/laytonsmith/core/functions/Minecraft.java

where the server uptime value is returned in milliseconds but as double instead of int:

if (index == 13 || index == -1) {
//Uptime
double uptime = (double)(System.currentTimeMillis() - ManagementFactory.getRuntimeMXBean().getStartTime());
retVals.add(new CDouble(uptime, t));
}

I do really need to use this uptime feature so it would be great if it could be fixed :)

commented

Comment by PseudoKnight

For the record, you should be able to use E# numbers by just rounding them. They're valid.

commented

Comment by jb_aero

I'm curious as to why it's a double at all.

commented

Comment by jb_aero

Fixed in 2904.