Skip to content

Commit

Permalink
Exclude tables from 'xlrinit' using variable
Browse files Browse the repository at this point in the history
Now the table names that should be excluded from 'xlrinit' can be put into an array
  • Loading branch information
jonesman committed Jun 8, 2018
1 parent cda0172 commit 62754dc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions b3/plugins/xlrstats/__init__.py
Expand Up @@ -135,7 +135,10 @@ class XlrstatsPlugin(b3.plugin.Plugin):
# default tablenames for the Battlestats subplugin
# battlestats_table = 'xlr_battlestats'
# playerbattles_table = 'xlr_playerbattles'


# the 'xlrinit' command will truncate all of the above tables, unless included here
exclude_from_xlrinit = [ "clients", "penalties" ]

_defaultTableNames = True
_default_messages = {
'cmd_xlrstats': '^3XLR Stats: ^7$name ^7: K ^2$kills ^7D ^3$deaths ^7TK ^1$teamkills ^7Ratio ^5$ratio ^7Skill ^3$skill',
Expand Down Expand Up @@ -1823,7 +1826,7 @@ def cmd_xlrinit(self, data, client, cmd=None):
xlr_tables = []
for attr in dir(self):
attr_val = getattr(self, attr)
if attr.endswith('_table') and attr_val.startswith('xlr_'):
if attr.endswith('_table') and attr_val not in self.exclude_from_xlrinit:
xlr_tables.append(attr_val)

current_tables = self.console.storage.getTables()
Expand Down

0 comments on commit 62754dc

Please sign in to comment.