From ab03cf174dacdab61da9e504361f4f0cebbf42df Mon Sep 17 00:00:00 2001 From: Shank Date: Mon, 6 Jun 2011 23:48:30 -0600 Subject: [PATCH 1/6] Fixed /dropmeteor Closes #40 --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index cd595f2e..5d1144cb 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -80,7 +80,7 @@ namespace TShockAPI commands.Add(new Command("ban", "ban", Ban)); commands.Add(new Command("off", "maintenance", Off)); commands.Add(new Command("reload", "cfg", Reload)); - commands.Add(new Command("dropmetor", "causeevents", DropMeteor)); + commands.Add(new Command("dropmeteor", "causeevents", DropMeteor)); commands.Add(new Command("star", "causeevents", Star)); commands.Add(new Command("bloodmoon", "causeevents", Bloodmoon)); commands.Add(new Command("eater", "spawnboss", Eater)); From 866f63ea594b50ae56a96325317021b7f94f6622 Mon Sep 17 00:00:00 2001 From: Shank Date: Mon, 6 Jun 2011 23:51:51 -0600 Subject: [PATCH 2/6] /ban now accepts a reason /ban announces said reason --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 5d1144cb..1c15a3ce 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -220,7 +220,7 @@ namespace TShockAPI { TShock.Bans.AddBan(Tools.GetPlayerIP(player), Main.player[player].name); Tools.Kick(player, "You were banned."); - Tools.Broadcast(Tools.FindPlayer(adminplr) + " banned " + Tools.FindPlayer(player) + "!"); + Tools.Broadcast(Tools.FindPlayer(adminplr) + " banned " + Tools.FindPlayer(player) + " with reason " + reason + "!"); } else Tools.SendMessage(adminplr, "You can't ban another admin!", new[] {255f, 0f, 0f}); From c13df1c03d041d783abf4b9b7154523e3766c8a9 Mon Sep 17 00:00:00 2001 From: Shank Date: Mon, 6 Jun 2011 23:52:39 -0600 Subject: [PATCH 3/6] Changed version Closes #35 --- TShockAPI/TShock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index a7b242b9..c59b9e8e 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -15,7 +15,7 @@ namespace TShockAPI public static string saveDir = "./tshock/"; - public static Version VersionNum = new Version(1, 9, 0, 0); + public static Version VersionNum = new Version(1, 9, 0, 1); public static string VersionCodename = "SPACEEE"; From dafd739f88c59a3a5cb936d9afe74fc1f8e102f6 Mon Sep 17 00:00:00 2001 From: Shank Date: Mon, 6 Jun 2011 23:59:08 -0600 Subject: [PATCH 4/6] Time now takes noon/dawn/dusk/midnight Closes #33 --- TShockAPI/Commands.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 1c15a3ce..76e01afd 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -663,13 +663,34 @@ namespace TShockAPI NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); NetMessage.syncPlayers(); Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to night."); + } else if (arg[1] == "dusk") + { + Main.dayTime = false; + Main.time = 0.0; + NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); + NetMessage.syncPlayers(); + Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to dusk."); + } else if (arg[1] == "noon") + { + Main.dayTime = true; + Main.time = 27000.0; + NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); + NetMessage.syncPlayers(); + Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to noon."); + } else if (arg[1] == "midnight") + { + Main.dayTime = false; + Main.time = 16200.0; + NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); + NetMessage.syncPlayers(); + Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to midnight."); } else - Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time ", + Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time ", new[] {255f, 0f, 0f}); } else - Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time ", + Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time ", new[] {255f, 0f, 0f}); } From 3589886eab37bbf83b5674dbe97642ce62d23ff5 Mon Sep 17 00:00:00 2001 From: Shank Date: Tue, 7 Jun 2011 00:03:01 -0600 Subject: [PATCH 5/6] Added /home Closes #26 --- TShockAPI/Commands.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 76e01afd..7dbaedc0 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -90,6 +90,7 @@ namespace TShockAPI commands.Add(new Command("invade", "causeevents", Invade)); commands.Add(new Command("password", "cfg", Password)); commands.Add(new Command("save", "cfg", Save)); + commands.Add(new Command("home", "tp", Home)); commands.Add(new Command("spawn", "tp", Spawn)); commands.Add(new Command("tp", "tp", TP)); commands.Add(new Command("tphere", "tp", TPHere)); @@ -357,12 +358,21 @@ namespace TShockAPI Tools.SendMessage(ply, "World saved."); } + public static void Home(CommandArgs args) + { + int ply = args.PlayerID; + TShock.Teleport(ply, Main.player[args.PlayerID].SpawnX * 16 + 8 - Main.player[ply].width / 2, + Main.player[args.PlayerID].SpawnY * 16 - Main.player[ply].height); + Tools.SendMessage(ply, "Teleported to your spawnpoint."); + } + + public static void Spawn(CommandArgs args) { int ply = args.PlayerID; TShock.Teleport(ply, Main.spawnTileX*16 + 8 - Main.player[ply].width/2, Main.spawnTileY*16 - Main.player[ply].height); - Tools.SendMessage(ply, "Teleported to your spawnpoint."); + Tools.SendMessage(ply, "Teleported to the map's spawnpoint."); } public static void AuthToken(CommandArgs args) From b7a87866fe2964cbc639cc11dd7daae6dca6c454 Mon Sep 17 00:00:00 2001 From: Shank Date: Tue, 7 Jun 2011 00:08:32 -0600 Subject: [PATCH 6/6] Name length check now works. Bans now run by name too. Closes #36 --- TShockAPI/TShock.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c59b9e8e..48b12108 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -201,6 +201,15 @@ namespace TShockAPI { if (e.MsgID == 4) { + var ban = Bans.GetBanByName(Main.player[e.Msg.whoAmI].name); + if (ban != null) + { + Tools.Kick(e.Msg.whoAmI, "You are banned: " + ban.Reason); + } + if (Main.player[e.Msg.whoAmI].name.Length > 32) + { + Tools.Kick(e.Msg.whoAmI, "Name exceeded 32 characters."); + } if (players[e.Msg.whoAmI] == null) { Tools.Kick(e.Msg.whoAmI, "Player doesn't exist"); @@ -612,11 +621,6 @@ namespace TShockAPI { Tools.Kick(ply, "You are banned: " + ban.Reason); } - else if (Tools.FindPlayer(ply).Length > 32) - { - Tools.Kick(ply, "Your name was too long."); - Tools.Broadcast(ip + " was kicked because their name exceeded 32 characters."); - } if (!FileTools.OnWhitelist(ip)) { Tools.Kick(ply, "Not on whitelist.");