mycontroller-org / mycontroller-v1-legacy

The Open Source Controller
http://www.MyController.org
Apache License 2.0
148 stars 90 forks source link

Add support to get sunrise and sunset time on script #322

Closed jkandasa closed 7 years ago

jkandasa commented 7 years ago

Add support to get sunrise and sunset time on script

jkandasa commented 7 years ago

Example:

JavaScript

var myImports = new JavaImporter(java.io, java.lang, java.util);

with(myImports) {  
  var location = mcApi.utils().getServerLocationSettings();
}
Result:
{
  "myImports": {},
  "location": {
    "name": "Namakkal",
    "latitude": "11.2333",
    "longitude": "78.1667",
    "sunriseTime": 1481677080000,
    "sunsetTime": 1481718360000
  }
}