Merge branch 'group-mgr-ee' into general-devel

This commit is contained in:
Lucas Nicodemus 2015-02-21 17:14:29 -07:00
commit d3ed04c947
2 changed files with 29 additions and 25 deletions

View file

@ -47,11 +47,8 @@ namespace TShockAPI.DB
db.GetSqlType() == SqlType.Sqlite
? (IQueryBuilder) new SqliteQueryCreator()
: new MysqlQueryCreator());
creator.EnsureExists(table);
// Load Permissions from the DB
LoadPermisions();
if (creator.EnsureExists(table))
{
// Add default groups if they don't exist
AddDefaultGroup("guest", "",
string.Join(",", Permissions.canbuild, Permissions.canregister, Permissions.canlogin, Permissions.canpartychat,
@ -74,6 +71,10 @@ namespace TShockAPI.DB
Permissions.heal, Permissions.immunetoban, Permissions.usebanneditem));
AddDefaultGroup("vip", "default", string.Join(",", Permissions.reservedslot));
}
// Load Permissions from the DB
LoadPermisions();
Group.DefaultGroup = GetGroupByName(TShock.Config.DefaultGuestGroupName);
}

View file

@ -52,7 +52,8 @@ namespace TShockAPI.DB
creator = provider;
}
public void EnsureExists(SqlTable table)
// Returns true if the table was created; false if it was not.
public bool EnsureExists(SqlTable table)
{
var columns = GetColumns(table);
if (columns.Count > 0)
@ -66,7 +67,9 @@ namespace TShockAPI.DB
else
{
database.Query(creator.CreateTable(table));
return true;
}
return false;
}
public List<string> GetColumns(SqlTable table)