diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index 2fcfa3c7..25641be2 100755
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -298,6 +298,11 @@ namespace TShockAPI
{
HelpText = "Saves all serverside characters."
});
+ add(new Command(Permissions.uploaddata, UploadJoinData, "uploadssc")
+ {
+ HelpText = "Upload the account information when you joined the server as your Server Side Character data.",
+ AllowServer = false
+ });
add(new Command(Permissions.settempgroup, TempGroup, "tempgroup")
{
HelpText = "Temporarily sets another player's group."
@@ -1691,6 +1696,18 @@ namespace TShockAPI
args.Player.SendSuccessMessage("SSC of player \"{0}\" has been overriden.", matchedPlayer.Name);
}
+ private static void UploadJoinData(CommandArgs args)
+ {
+ if (TShock.CharacterDB.InsertSpecificPlayerData(args.Player, args.Player.DataWhenJoined)) {
+ args.Player.DataWhenJoined.RestoreCharacter(args.Player);
+ args.Player.SendSuccessMessage("Your Join Data has been uploaded to the server.");
+ }
+ else
+ {
+ args.Player.SendErrorMessage("Failed to upload your data, please find an admin.");
+ }
+ }
+
private static void ForceHalloween(CommandArgs args)
{
TShock.Config.ForceHalloween = !TShock.Config.ForceHalloween;
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index aae3839b..fd9ce50a 100755
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -1506,6 +1506,8 @@ namespace TShockAPI
private static bool HandleConnecting(GetDataHandlerArgs args)
{
var user = TShock.Users.GetUserByName(args.Player.Name);
+ args.Player.DataWhenJoined = new PlayerData(args.Player);
+ args.Player.DataWhenJoined.CopyCharacter(args.Player);
if (user != null && !TShock.Config.DisableUUIDLogin)
{
diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs
index 7aaf6f86..fef9683d 100644
--- a/TShockAPI/Permissions.cs
+++ b/TShockAPI/Permissions.cs
@@ -88,6 +88,9 @@ namespace TShockAPI
[Description("User can save all the players SSI state.")]
public static readonly string savessc = "tshock.admin.savessi";
+ [Description("User can upload their joined character data as SSC data.")]
+ public static readonly string uploaddata = "tshock.ssc.upload";
+
[Description("User can elevate other users' groups temporarily.")]
public static readonly string settempgroup = "tshock.admin.tempgroup";
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 5addd336..ca1660aa 100755
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -73,7 +73,7 @@ namespace TShockAPI
/// The amount of tiles that the player has killed in the last second.
///
public int TileKillThreshold { get; set; }
-
+
///
/// The amount of tiles the player has placed in the last second.
///
@@ -113,10 +113,10 @@ namespace TShockAPI
/// A system to delay Remembered Position Teleports a few seconds
///
public int RPPending = 0;
-
+
public int sX = -1;
public int sY = -1;
-
+
///
/// A queue of tiles destroyed by the player for reverting.
///
@@ -145,7 +145,7 @@ namespace TShockAPI
/// The player's temporary group. This overrides the user's actual group.
///
public Group tempGroup = null;
-
+
public Timer tempGroupTimer;
private Group group = null;
@@ -158,7 +158,7 @@ namespace TShockAPI
public int Index { get; protected set; }
///
- /// The last time the player changed their team or pvp status.
+ /// The last time the player changed their team or pvp status.
///
public DateTime LastPvPTeamChange;
@@ -175,7 +175,7 @@ namespace TShockAPI
///
/// A list of command callbacks indexed by the command they need to do.
///
- public Dictionary> AwaitingResponse;
+ public Dictionary> AwaitingResponse;
public bool AwaitingName { get; set; }
@@ -332,14 +332,14 @@ namespace TShockAPI
/// Spawn protection message cool down.
///
public long SPm = 1;
-
+
///
/// Permission to build message cool down.
///
public long BPm = 1;
///
- /// The time in ms when the player has logged in.
+ /// The time in ms when the player has logged in.
///
public long LoginMS;
@@ -372,7 +372,7 @@ namespace TShockAPI
/// Contains data stored by plugins
///
protected ConcurrentDictionary data = new ConcurrentDictionary();
-
+
///
/// Whether the player is a real, human, player on the server.
///
@@ -591,6 +591,11 @@ namespace TShockAPI
}
}
+ ///
+ /// This contains the character data a player has when they join the server.
+ ///
+ public PlayerData DataWhenJoined { get; set; }
+
///
/// Determines whether the player's storage contains the given key.
///
@@ -755,7 +760,7 @@ namespace TShockAPI
/// Spawns the player at his spawn point.
///
public void Spawn()
- {
+ {
if (this.sX > 0 && this.sY > 0)
{
Spawn(this.sX, this.sY);
@@ -867,7 +872,7 @@ namespace TShockAPI
/// True or false, depending if the item passed the check or not.
public bool GiveItemCheck(int type, string name, int width, int height, int stack, int prefix = 0)
{
- if ((TShock.Itembans.ItemIsBanned(name) && TShock.Config.PreventBannedItemSpawn) &&
+ if ((TShock.Itembans.ItemIsBanned(name) && TShock.Config.PreventBannedItemSpawn) &&
(TShock.Itembans.ItemIsBanned(name, this) || !TShock.Config.AllowAllowedGroupsToSpawnBannedItems))
return false;
@@ -983,7 +988,7 @@ namespace TShockAPI
}
///
- /// Sends a message with the specified color.
+ /// Sends a message with the specified color.
///
/// The message.
/// The message color.