diff --git a/js/battle.js b/js/battle.js
index 433579282..940b6449f 100644
--- a/js/battle.js
+++ b/js/battle.js
@@ -2169,6 +2169,7 @@ var Battle = (function () {
// external
this.resumeButton = this.play;
+ this.users = {};
this.preloadCache = {};
this.preloadEffects();
@@ -5679,12 +5680,14 @@ var Battle = (function () {
break;
case 'join':
case 'j':
+ this.users[toUserid(args[1])] = ' ' + args[1];
if (!this.ignoreSpects) {
this.log('
' + Tools.escapeHTML(args[1]) + ' joined.
', preempt);
}
break;
case 'leave':
case 'l':
+ delete this.users[toUserid(args[1])];
if (!this.ignoreSpects) {
this.log('' + Tools.escapeHTML(args[1]) + ' left.
', preempt);
}
diff --git a/js/client-battle.js b/js/client-battle.js
index a9aba6c89..3f1ac5403 100644
--- a/js/client-battle.js
+++ b/js/client-battle.js
@@ -38,6 +38,7 @@
BattleSound.setMute(Tools.prefs('mute'));
this.battle = new Battle(this.$battle, this.$chatFrame);
+ this.users = this.battle.users;
this.$chat = this.$chatFrame.find('.inner');