mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00: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…
Add table
Add a link
Reference in a new issue