mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
Update tshock support for terraria 1.2
This commit is contained in:
parent
25e8d1bd48
commit
7b8ddfba8c
2 changed files with 50 additions and 34 deletions
|
|
@ -9,8 +9,12 @@ module.exports = require('./core').extend({
|
|||
run: function(state) {
|
||||
var self = this;
|
||||
request({
|
||||
uri: 'http://'+this.options.address+':'+this.options.port+'/status',
|
||||
uri: 'http://'+this.options.address+':'+this.options.port+'/v2/server/status',
|
||||
timeout: 3000,
|
||||
qs: {
|
||||
players: 'true',
|
||||
token: this.options.token
|
||||
}
|
||||
}, function(e,r,body) {
|
||||
if(e) return self.error('HTTP error');
|
||||
var json;
|
||||
|
|
@ -22,9 +26,8 @@ module.exports = require('./core').extend({
|
|||
|
||||
if(json.status != 200) return self.error('Invalid status');
|
||||
|
||||
var split = json.players.split(',');
|
||||
split.forEach(function(one) {
|
||||
state.players.push({name:one});
|
||||
json.players.forEach(function(one) {
|
||||
state.players.push({name:one.nickname,team:one.team});
|
||||
});
|
||||
|
||||
state.name = json.name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue