diff --git a/InfiniteChests/InfiniteChests.cs b/InfiniteChests/InfiniteChests.cs
index cce5bc7..b643221 100644
--- a/InfiniteChests/InfiniteChests.cs
+++ b/InfiniteChests/InfiniteChests.cs
@@ -19,7 +19,7 @@
namespace InfiniteChests
{
- [ApiVersion(1, 17)]
+ [ApiVersion(1, 22)]
public class InfiniteChests : TerrariaPlugin
{
private IDbConnection Database;
@@ -129,43 +129,43 @@ void OnGetData(GetDataEventArgs e)
}
break;
case PacketTypes.ChestOpen:
- {
- int action = reader.ReadInt16();
- int x = reader.ReadInt16();
- int y = reader.ReadInt16();
-
- if (action == -1)
{
- if (Infos[plr].TransactionsLeft > 0)
+ int action = reader.ReadInt16();
+ int x = reader.ReadInt16();
+ int y = reader.ReadInt16();
+
+ if (action == -1)
{
- //user closed the chest, but still have items transferring, close when it finishes.
- Infos[plr].ShouldCloseAfterTransactions = true;
+ if (Infos[plr].TransactionsLeft > 0)
+ {
+ //user closed the chest, but still have items transferring, close when it finishes.
+ Infos[plr].ShouldCloseAfterTransactions = true;
+ }
+ else
+ {
+ Infos[plr].X = -1;
+ Infos[plr].Y = -1;
+ }
}
- else
+ else if (Infos[plr].TransactionsLeft > 0)
{
- Infos[plr].X = -1;
- Infos[plr].Y = -1;
+ //the user is still transfering items, they shouldnt be allowed to open another chest until that finishes.
+ return;
}
- }
- else if (Infos[plr].TransactionsLeft > 0)
- {
- //the user is still transfering items, they shouldnt be allowed to open another chest until that finishes.
- return;
- }
#if !MULTI_USE
- if (Infos.Any(p => p.X == x && p.Y == y))
- {
- //chest is in use, ignore
- TShock.Players[plr].SendErrorMessage("This chest is currently open by someone else.");
- return;
- }
+ if (Infos.Any(p => p.X == x && p.Y == y))
+ {
+ //chest is in use, ignore
+ TShock.Players[plr].SendErrorMessage("This chest is currently open by someone else.");
+ return;
+ }
#endif
- int length = reader.ReadByte();
+ int length = reader.ReadByte();
- if (length != 0 && length <= 20 && length != 255)
- TShock.Players[plr].SendData(PacketTypes.ChestName, "", 0, x, y);
- }
- break;
+ if (length != 0 && length <= 20 && length != 255)
+ TShock.Players[plr].SendData(PacketTypes.ChestName, "", 0, x, y);
+ }
+ break;
case PacketTypes.TileKill:
{
if (Infos[plr].TransactionsLeft > 0)
@@ -333,7 +333,7 @@ void OnPostInitialize(EventArgs e)
if (converted > 0)
{
TSPlayer.Server.SendSuccessMessage("[InfiniteChests] Converted {0} chest{1}.", converted, converted == 1 ? "" : "s");
- WorldFile.saveWorld();
+ TShock.Utils.SaveWorld();
}
}
@@ -383,7 +383,7 @@ void GetChest(int x, int y, int plr)
player.SendErrorMessage("This chest is already protected.");
break;
}
- Database.Query("UPDATE Chests SET Account = @0 WHERE ID = @1", player.UserAccountName, chest.ID);
+ Database.Query("UPDATE Chests SET Account = @0 WHERE ID = @1", player.User.Name, chest.ID);
player.SendSuccessMessage("This chest is now protected.");
break;
case ChestAction.TogglePublic:
@@ -392,7 +392,7 @@ void GetChest(int x, int y, int plr)
player.SendErrorMessage("This chest is not protected.");
break;
}
- if (chest.Account != player.UserAccountName && !player.Group.HasPermission("infchests.admin.editall"))
+ if (chest.Account != player.User.Name && !player.Group.HasPermission("infchests.admin.editall"))
{
player.SendErrorMessage("This chest is not yours.");
break;
@@ -406,7 +406,7 @@ void GetChest(int x, int y, int plr)
player.SendErrorMessage("This chest is not protected.");
break;
}
- if (chest.Account != player.UserAccountName && !player.Group.HasPermission("infchests.admin.editall"))
+ if (chest.Account != player.User.Name && !player.Group.HasPermission("infchests.admin.editall"))
{
player.SendErrorMessage("This chest is not yours.");
break;
@@ -420,7 +420,7 @@ void GetChest(int x, int y, int plr)
player.SendErrorMessage("This chest is not protected.");
break;
}
- if (chest.Account != player.UserAccountName && !player.Group.HasPermission("infchests.admin.editall"))
+ if (chest.Account != player.User.Name && !player.Group.HasPermission("infchests.admin.editall"))
{
player.SendErrorMessage("This chest is not yours.");
break;
@@ -457,7 +457,7 @@ void GetChest(int x, int y, int plr)
player.SendErrorMessage("This chest is not protected.");
break;
}
- if (chest.Account != player.UserAccountName && !player.Group.HasPermission("infchests.admin.editall"))
+ if (chest.Account != player.User.Name && !player.Group.HasPermission("infchests.admin.editall"))
{
player.SendErrorMessage("This chest is not yours.");
break;
@@ -479,7 +479,7 @@ void GetChest(int x, int y, int plr)
player.SendErrorMessage("This chest is not protected.");
break;
}
- if (chest.Account != player.UserAccountName && !player.Group.HasPermission("infchests.admin.editall"))
+ if (chest.Account != player.User.Name && !player.Group.HasPermission("infchests.admin.editall"))
{
player.SendErrorMessage("This chest is not yours.");
break;
@@ -501,7 +501,7 @@ void GetChest(int x, int y, int plr)
player.SendErrorMessage("This chest is not protected.");
break;
}
- if (chest.Account != player.UserAccountName && !player.Group.HasPermission("infchests.admin.editall"))
+ if (chest.Account != player.User.Name && !player.Group.HasPermission("infchests.admin.editall"))
{
player.SendErrorMessage("This chest is not yours.");
break;
@@ -519,7 +519,7 @@ void GetChest(int x, int y, int plr)
#endif
bool isFree = String.IsNullOrEmpty(chest.Account);
- bool isOwner = chest.Account == player.UserAccountName || player.Group.HasPermission("infchests.admin.editall");
+ bool isOwner = chest.Account == player.User.Name || player.Group.HasPermission("infchests.admin.editall");
bool isRegion = chest.IsRegion && TShock.Regions.CanBuild(x, y, player);
if (!isFree && !isOwner && !chest.IsPublic && !isRegion)
{
@@ -606,7 +606,7 @@ void KillChest(int x, int y, int plr)
WorldGen.KillTile(x, y);
TSPlayer.All.SendData(PacketTypes.Tile, "", 0, x, y + 1);
}
- else if (chest.Account != player.UserAccountName && !String.IsNullOrEmpty(chest.Account) && !player.Group.HasPermission("infchests.admin.editall"))
+ else if (chest.Account != player.User.Name && !String.IsNullOrEmpty(chest.Account) && !player.Group.HasPermission("infchests.admin.editall"))
{
player.SendErrorMessage("This chest is protected.");
player.SendTileSquare(x, y, 3);
@@ -735,7 +735,7 @@ void PlaceChest(int x, int y, int plr)
{
TSPlayer player = TShock.Players[plr];
Database.Query("INSERT INTO Chests (X, Y, Account, Flags, Items, Password, WorldID) VALUES (@0, @1, @2, 0, @3, NULL, @4)",
- x, y - 1, (player.IsLoggedIn && player.Group.HasPermission("infchests.chest.protect")) ? player.UserAccountName : null,
+ x, y - 1, (player.IsLoggedIn && player.Group.HasPermission("infchests.chest.protect")) ? player.User.Name : null,
"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," +
"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", Main.worldID);
Main.chest[999] = null;
@@ -789,7 +789,7 @@ void Bank(CommandArgs e)
}
void ConvertChests(CommandArgs e)
{
- Task.Factory.StartNew(() =>
+ Task.Factory.StartNew(() =>
{
int converted = 0;
var items = new StringBuilder();
@@ -810,7 +810,7 @@ void ConvertChests(CommandArgs e)
e.Player.SendSuccessMessage("Converted {0} chest{1}.", converted, converted == 1 ? "" : "s");
if (converted > 0)
- WorldFile.saveWorld();
+ TShock.Utils.SaveWorld();
}).LogExceptions();
}
void Deselect(CommandArgs e)
@@ -914,7 +914,7 @@ void Prune(CommandArgs e)
e.Player.SendSuccessMessage("Pruned {0} corrupted chest{1}.", corrupted, corrupted == 1 ? "" : "s");
if (corrupted + empty > 0)
- WorldFile.saveWorld();
+ TShock.Utils.SaveWorld();
}).LogExceptions();
}
void Refill(CommandArgs e)
@@ -996,7 +996,7 @@ void ReverseConvertChests(CommandArgs e)
Database.Query("DELETE FROM Chests WHERE WorldID = @0", Main.worldID);
e.Player.SendSuccessMessage("Reverse converted {0} chests.", i);
if (i > 0)
- WorldFile.saveWorld();
+ TShock.Utils.SaveWorld();
}).LogExceptions();
}
void Unlock(CommandArgs e)
diff --git a/InfiniteChests/InfiniteChests.csproj b/InfiniteChests/InfiniteChests.csproj
index 04aa323..897756f 100644
--- a/InfiniteChests/InfiniteChests.csproj
+++ b/InfiniteChests/InfiniteChests.csproj
@@ -9,7 +9,7 @@
Properties
InfiniteChests
InfiniteChests
- v4.0
+ v4.5
512
@@ -22,6 +22,7 @@
prompt
4
x86
+ false
pdbonly
@@ -32,6 +33,7 @@
4
x86
true
+ false
bin\
@@ -41,6 +43,7 @@
x86
prompt
ManagedMinimumRules.ruleset
+ false
diff --git a/InfiniteChests/bin/InfiniteChests.dll b/InfiniteChests/bin/InfiniteChests.dll
index ec8137b..3413df0 100644
Binary files a/InfiniteChests/bin/InfiniteChests.dll and b/InfiniteChests/bin/InfiniteChests.dll differ
diff --git a/References/MySql.Data.dll b/References/MySql.Data.dll
index da3babd..388f8cf 100644
Binary files a/References/MySql.Data.dll and b/References/MySql.Data.dll differ
diff --git a/References/TShockAPI.dll b/References/TShockAPI.dll
index 32388ae..dc7b170 100644
Binary files a/References/TShockAPI.dll and b/References/TShockAPI.dll differ
diff --git a/References/TerrariaServer.exe b/References/TerrariaServer.exe
index 100a035..b9256f2 100644
Binary files a/References/TerrariaServer.exe and b/References/TerrariaServer.exe differ