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();
|
||||
bots = new Players();
|
||||
|
||||
set players(num) {
|
||||
this.players.setNum(num);
|
||||
set players(val) {
|
||||
if (typeof val === 'number') {
|
||||
this.players.setNum(val);
|
||||
} else if (Array.isArray(val)) {
|
||||
this.players = val;
|
||||
}
|
||||
}
|
||||
set bots(val) {
|
||||
if (typeof val === 'number') {
|
||||
this.bots.setNum(val);
|
||||
} else if (Array.isArray(val)) {
|
||||
this.bots = val;
|
||||
}
|
||||
set bots(num) {
|
||||
this.bots.setNum(num);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue