- Ban booted players from a table

- Boot by sitting position, not oid


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@713 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Bruno Garcia
2008-08-06 22:52:41 +00:00
parent aa84c5055a
commit 7d75f0c760
3 changed files with 36 additions and 8 deletions
@@ -22,6 +22,7 @@
package com.threerings.parlor.data;
import java.util.List;
import java.util.HashSet;
import com.google.common.collect.Lists;
@@ -228,6 +229,10 @@ public class Table
return TABLE_POSITION_OCCUPIED;
}
if (_bannedUsers != null && _bannedUsers.contains(player.username)) {
return BANNED_FROM_TABLE;
}
// otherwise all is well, stick 'em in
setPlayerPos(position, player);
return null;
@@ -244,6 +249,19 @@ public class Table
bodyOids[position] = player.getOid();
}
/**
* Indicate to this table that a user was booted and should
* be prevented from rejoining.
*/
public void addBannedUser (Name username)
{
if (_bannedUsers == null) {
_bannedUsers = new HashSet<Name>();
}
_bannedUsers.add(username);
}
/**
* Requests that the specified user be removed from their seat at this table.
*
@@ -423,4 +441,7 @@ public class Table
/** A counter for assigning table ids. */
protected static int _tableIdCounter = 0;
/** On the server, the usernames that have been banned from this table. */
protected transient HashSet<Name> _bannedUsers;
}