From 673477562081dd20c2517a8f1363302f25d742b0 Mon Sep 17 00:00:00 2001 From: Max Cantor Date: Sat, 24 Sep 2011 18:30:17 -0400 Subject: [PATCH 1/4] remove trailing whitespace --- TShockAPI/Commands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 2624c085..638fdff5 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1,4 +1,4 @@ -/* +/* TShock, a server mod for Terraria Copyright (C) 2011 The TShock Team @@ -36,7 +36,7 @@ namespace TShockAPI public string Message { get; private set; } public TSPlayer Player { get; private set; } /// - /// Parameters passed to the arguement. Does not include the command name. + /// Parameters passed to the arguement. Does not include the command name. /// IE '/kick "jerk face"' will only have 1 argument /// public List Parameters { get; private set; } From 537bc8eccdc385f25d380cf1279dedbba4a64bfe Mon Sep 17 00:00:00 2001 From: Max Cantor Date: Sun, 25 Sep 2011 01:56:38 -0400 Subject: [PATCH 2/4] whitespace --- TShockAPI/Tools.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs index fc133b7b..9a3e2a73 100755 --- a/TShockAPI/Tools.cs +++ b/TShockAPI/Tools.cs @@ -1,4 +1,4 @@ -/* +/* TShock, a server mod for Terraria Copyright (C) 2011 The TShock Team @@ -127,7 +127,6 @@ namespace TShockAPI TSPlayer.All.SendMessage(msg, red, green, blue); TSPlayer.Server.SendMessage(msg, red, green, blue); Log.Info(string.Format("Broadcast: {0}", msg)); - } public static void Broadcast(string msg, Color color) @@ -592,4 +591,4 @@ namespace TShockAPI return true; } } -} \ No newline at end of file +} From b688820d60bcc99a2f5ee54c9bd743a45875f458 Mon Sep 17 00:00:00 2001 From: Max Cantor Date: Sun, 25 Sep 2011 01:57:06 -0400 Subject: [PATCH 3/4] whitespace --- TShockAPI/Commands.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 638fdff5..7e91784d 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -351,7 +351,6 @@ namespace TShockAPI private static void PasswordUser(CommandArgs args) { - try { if (args.Player.IsLoggedIn && args.Parameters.Count == 2) @@ -900,7 +899,6 @@ namespace TShockAPI Tools.ForceKickAll("Server shutting down for update!"); WorldGen.saveWorld(); Netplay.disconnect = true; - } #endregion Server Maintenence Commands @@ -1374,7 +1372,6 @@ namespace TShockAPI args.Player.SendMessage("Specified warp not found", Color.Red); } } - } #endregion Teleport Commands @@ -1577,7 +1574,6 @@ namespace TShockAPI private static void MaxSpawns(CommandArgs args) { - if (args.Parameters.Count != 1) { args.Player.SendMessage("Invalid syntax! Proper syntax: /maxspawns ", Color.Red); @@ -1725,7 +1721,6 @@ namespace TShockAPI } switch (cmd) { - case "name": { { @@ -1734,7 +1729,6 @@ namespace TShockAPI } break; } - case "set": { int choice = 0; @@ -2000,7 +1994,6 @@ namespace TShockAPI break; } } - } #endregion World Protection Commands @@ -2222,6 +2215,7 @@ namespace TShockAPI (new Thread(ply.Whoopie)).Start(annoy); } } + #endregion General Commands #region Cheat Commands @@ -2602,6 +2596,7 @@ namespace TShockAPI } args.Player.SendMessage("You have grown a " + name, Color.Green); } + #endregion Cheat Comamnds } } From a59a7fafa9a15beaf0c296433ba7d7a32cc0ae8a Mon Sep 17 00:00:00 2001 From: Max Cantor Date: Sun, 25 Sep 2011 18:28:59 -0400 Subject: [PATCH 4/4] Delete extra/old/confusing WarpsManager.cs file --- TShockAPI/WarpsManager.cs | 202 -------------------------------------- 1 file changed, 202 deletions(-) delete mode 100644 TShockAPI/WarpsManager.cs diff --git a/TShockAPI/WarpsManager.cs b/TShockAPI/WarpsManager.cs deleted file mode 100644 index 5b494611..00000000 --- a/TShockAPI/WarpsManager.cs +++ /dev/null @@ -1,202 +0,0 @@ -/* -TShock, a server mod for Terraria -Copyright (C) 2011 The TShock Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using System.Xml; -using Terraria; - -namespace TShockAPI -{ - class WarpsManager - { - public static List Warps = new List(); - - public static bool AddWarp(int x, int y, string name, string worldname) - { - foreach (Warp nametest in Warps) - { - if (name.ToLower() == nametest.WarpName.ToLower()) - { - return false; - } - } - Warps.Add(new Warp(new Vector2(x, y), name, worldname)); - return true; - } - - public static bool DeleteWarp(string name) - { - foreach (Warp nametest in Warps) - { - if (name.ToLower() == nametest.WarpName.ToLower() && nametest.WorldWarpName == Main.worldName) - { - Warps.Remove(nametest); - WriteSettings(); - return true; - } - } - return false; - } - - public static Vector2 FindWarp(string name) - { - foreach (Warp nametest in Warps) - { - if (name.ToLower() == nametest.WarpName.ToLower() && nametest.WorldWarpName == Main.worldName) - { - return nametest.WarpPos; - } - } - return Vector2.Zero; - } - - public static void WriteSettings() - { - try - { - XmlWriterSettings xmlWriterSettings = new XmlWriterSettings(); - xmlWriterSettings.Indent = true; - xmlWriterSettings.NewLineChars = Environment.NewLine; - - using (XmlWriter settingsw = XmlWriter.Create(FileTools.WarpsPath, xmlWriterSettings)) - { - settingsw.WriteStartDocument(); - settingsw.WriteStartElement("Warps"); - - foreach (Warp warp in Warps) - { - settingsw.WriteStartElement("Warp"); - settingsw.WriteElementString("WarpName", warp.WarpName); - settingsw.WriteElementString("X", warp.WarpPos.X.ToString()); - settingsw.WriteElementString("Y", warp.WarpPos.Y.ToString()); - settingsw.WriteElementString("WorldName", warp.WorldWarpName); - settingsw.WriteEndElement(); - } - - settingsw.WriteEndElement(); - settingsw.WriteEndDocument(); - } - Log.Info("Wrote Warps"); - } - catch - { - Log.Info("Could not write Warps"); - } - } - - public static void ReadAllSettings() - { - try - { - XmlReaderSettings xmlReaderSettings = new XmlReaderSettings(); - xmlReaderSettings.IgnoreWhitespace = true; - - using (XmlReader settingr = XmlReader.Create(FileTools.WarpsPath, xmlReaderSettings)) - { - while (settingr.Read()) - { - if (settingr.IsStartElement()) - { - switch (settingr.Name) - { - case "Warps": - { - break; - } - case "Warp": - { - if (settingr.Read()) - { - string name = string.Empty; - int x = 0; - int y = 0; - string worldname = string.Empty; - - settingr.Read(); - if (settingr.Value != "" || settingr.Value != null) - name = settingr.Value; - else - Log.Warn("Warp name is empty, This warp will not work"); - - settingr.Read(); - settingr.Read(); - settingr.Read(); - if (settingr.Value != "" || settingr.Value != null) - Int32.TryParse(settingr.Value, out x); - else - Log.Warn("x for warp " + name + " is empty"); - - settingr.Read(); - settingr.Read(); - settingr.Read(); - if (settingr.Value != "" || settingr.Value != null) - Int32.TryParse(settingr.Value, out y); - else - Log.Warn("y for warp " + name + " is empty"); - - settingr.Read(); - settingr.Read(); - settingr.Read(); - if (settingr.Value != "" || settingr.Value != null) - worldname = settingr.Value; - else - Log.Warn("Worldname for warp " + name + " is empty"); - - AddWarp(x, y, name, worldname); - } - break; - } - } - } - } - } - Log.Info("Read Warps"); - } - catch - { - Log.Info("Could not read Warps"); - WriteSettings(); - } - } - } - - public class Warp - { - public Vector2 WarpPos { get; set; } - public string WarpName { get; set; } - public string WorldWarpName { get; set; } - - public Warp(Vector2 warppos, string name, string worldname) - { - WarpPos = warppos; - WarpName = name; - WorldWarpName = worldname; - } - - public Warp() - { - WarpPos = Vector2.Zero; - WarpName = null; - WorldWarpName = string.Empty; - } - } -}