mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 15:17:36 +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();
|
||||
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(num) {
|
||||
this.bots.setNum(num);
|
||||
set bots(val) {
|
||||
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