Add length to database primary keys.
Tweak some of the itembans code to be less inefficient. Removed a chunk of code from the buff code that prevented users from being buffed with a buff that comes from an item. This code seemed to cause max cpu usage when being disabled. I don't think this code is useful, but I leave that to people who own servers. IMO all buff code should be removed.
This commit is contained in:
parent
c29f01b959
commit
d5527ade42
5 changed files with 10 additions and 13 deletions
|
|
@ -101,12 +101,8 @@ namespace TShockAPI.DB
|
|||
|
||||
public bool ItemIsBanned(string name, TSPlayer ply)
|
||||
{
|
||||
if (ItemBans.Contains(new ItemBan(name)))
|
||||
{
|
||||
ItemBan b = GetItemBanByName(name);
|
||||
return !b.HasPermissionToUseItem(ply);
|
||||
}
|
||||
return false;
|
||||
ItemBan b = GetItemBanByName(name);
|
||||
return b != null &&!b.HasPermissionToUseItem(ply);
|
||||
}
|
||||
|
||||
public bool AllowGroup(string item, string name)
|
||||
|
|
@ -162,11 +158,11 @@ namespace TShockAPI.DB
|
|||
|
||||
public ItemBan GetItemBanByName(String name)
|
||||
{
|
||||
foreach (ItemBan b in ItemBans)
|
||||
for (int i = 0; i < ItemBans.Count; i++)
|
||||
{
|
||||
if (b.Name == name)
|
||||
if (ItemBans[i].Name == name)
|
||||
{
|
||||
return b;
|
||||
return ItemBans[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace TShockAPI.DB
|
|||
new SqlColumn("width", MySqlDbType.Int32),
|
||||
new SqlColumn("height", MySqlDbType.Int32),
|
||||
new SqlColumn("RegionName", MySqlDbType.VarChar, 50) {Unique = true},
|
||||
new SqlColumn("WorldID", MySqlDbType.Text) {Unique = true},
|
||||
new SqlColumn("WorldID", MySqlDbType.VarChar, 50) { Unique = true },
|
||||
new SqlColumn("UserIds", MySqlDbType.Text),
|
||||
new SqlColumn("Protected", MySqlDbType.Int32),
|
||||
new SqlColumn("Groups", MySqlDbType.Text),
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace TShockAPI.DB
|
|||
new SqlColumn("WarpName", MySqlDbType.VarChar, 50) {Unique = true},
|
||||
new SqlColumn("X", MySqlDbType.Int32),
|
||||
new SqlColumn("Y", MySqlDbType.Int32),
|
||||
new SqlColumn("WorldID", MySqlDbType.Text) {Unique = true},
|
||||
new SqlColumn("WorldID", MySqlDbType.VarChar, 50) { Unique = true },
|
||||
new SqlColumn("Private", MySqlDbType.Text)
|
||||
);
|
||||
var creator = new SqlTableCreator(db,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue