mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
handle ambiguity of the setters (players, bots)
* cases where the protocol overwrites the property with a prepared Players instance (eg.: minecraft & gamespy3)
This commit is contained in:
parent
e6db2a9b72
commit
6354e34d18
1 changed files with 12 additions and 4 deletions
|
@ -40,11 +40,19 @@ class Results {
|
||||||
players = new Players();
|
players = new Players();
|
||||||
bots = new Players();
|
bots = new Players();
|
||||||
|
|
||||||
set players(num) {
|
set players(val) {
|
||||||
this.players.setNum(num);
|
if (typeof val === 'number') {
|
||||||
|
this.players.setNum(val);
|
||||||
|
} else if (Array.isArray(val)) {
|
||||||
|
this.players = val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
set bots(num) {
|
set bots(val) {
|
||||||
this.bots.setNum(num);
|
if (typeof val === 'number') {
|
||||||
|
this.bots.setNum(val);
|
||||||
|
} else if (Array.isArray(val)) {
|
||||||
|
this.bots = val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue