Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var lastHttp = 0;
- exports.bulbcontrolHttp = function( rest ) {
- var t = server.getWorld('world').getFullTime();
- var delta = t - lastHttp;
- if (delta > 60 ){
- lastHttp = t;
- console.log( 'HttpCommand');
- var jsResponse;
- var http = require('../modules/http/request');
- http.request("http://#####################/" + rest,function(responseCode, responseBody){
- jsResponse = eval("(" + responseBody + ")");
- console.log(jsResponse.return_value);
- });
- }else{
- console.log("too soon");
- server.broadcastMessage("slow down");
- }
- }
- exports.updatergbHttp = function( msg ) {
- var http = require('../modules/http/request');
- http.request(
- {
- url: "http://########################/updatergb",
- method: 'GET',
- params: {script: msg}
- },
- function( responseCode, responseBody ) {
- var jsObj = eval('(' + responseBody + ')');
- console.log(jsObj.return_value);
- });
- }
- exports.pushmsgHttp = function( rest,msg ) {
- var http = require('../modules/http/request');
- http.request(
- {
- url: "http://##############################/" + rest,
- method: 'GET',
- params: {script: msg}
- },
- function( responseCode, responseBody ) {
- var jsObj = eval('(' + responseBody + ')');
- console.log(jsObj.status);
- });
- }
- events.on('player.PlayerJoinEvent', function ( event ) {
- if (!event.player.hasPlayedBefore()){
- console.log("New Player Detected");
- pushmsgHttp('pushnotify','New Player Joined - ' + event.player.name);
- }else{
- console.log("Same old folks 3- " + event.player.name);
- }
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement