Changeset 123
- Timestamp:
- Aug 18, 2014, 9:26:24 PM (10 years ago)
- Location:
- binary-improvements
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/TelnetCommands/RemoveLandProtection.cs
r113 r123 18 18 } 19 19 20 p ublic override void Run (string[] _params)20 private void removeById (string _id) 21 21 { 22 22 try { 23 if (_params.Length != 3) { 24 m_Console.SendResult ("Usage: removelandprotection <x> <y> <z>"); 23 PersistentPlayerList ppl = CommonMappingFunctions.GetGameManager ().GetPersistentPlayerList (); 24 25 if (_id.Length < 1 || !ppl.Players.ContainsKey(_id)) { 26 m_Console.SendResult ("Not a valid Steam ID or user has never logged on. Use \"listlandprotection\" to get a list of keystones."); 27 return; 28 } 29 if (ppl.Players[_id].LPBlocks == null || ppl.Players[_id].LPBlocks.Count == 0) { 30 m_Console.SendResult ("Player does not own any keystones. Use \"listlandprotection\" to get a list of keystones."); 25 31 return; 26 32 } 27 33 34 List<BlockChangeInfo> changes = new List<BlockChangeInfo> (); 35 foreach (Vector3i pos in ppl.Players[_id].LPBlocks) { 36 BlockChangeInfo bci = new BlockChangeInfo (pos, 0, true); 37 changes.Add (bci); 38 } 39 CommonMappingFunctions.GetGameManager ().SetBlocksRPC (changes); 40 41 m_Console.SendResult ("#"+changes.Count + " Land protection blocks for player \"" + _id + "\" removed"); 42 } catch (Exception e) { 43 Log.Out ("Error in RemoveLandProtection.removeById: " + e); 44 } 45 } 46 47 private void removeByPosition (string[] _coords) 48 { 49 try { 28 50 int x = int.MinValue; 29 int.TryParse (_ params [0], out x);51 int.TryParse (_coords [0], out x); 30 52 int y = int.MinValue; 31 int.TryParse (_ params [1], out y);53 int.TryParse (_coords [1], out y); 32 54 int z = int.MinValue; 33 int.TryParse (_ params [2], out z);55 int.TryParse (_coords [2], out z); 34 56 35 57 if (x == int.MinValue || y == int.MinValue || z == int.MinValue) { … … 48 70 } 49 71 50 ppl.RemoveLandProtectionBlock (v); 51 ppl.Write (StaticDirectories.GetSaveGameDir () + "/players.xml"); 52 m_Console.SendResult ("Land protection block association at (" + v.ToString () + ") removed"); 72 BlockChangeInfo bci = new BlockChangeInfo (v, 0, true); 73 74 List<BlockChangeInfo> changes = new List<BlockChangeInfo> (); 75 changes.Add (bci); 76 77 CommonMappingFunctions.GetGameManager ().SetBlocksRPC (changes); 78 79 m_Console.SendResult ("Land protection block at (" + v.ToString () + ") removed"); 80 } catch (Exception e) { 81 Log.Out ("Error in RemoveLandProtection.removeByPosition: " + e); 82 } 83 } 84 85 public override void Run (string[] _params) 86 { 87 try { 88 if (_params.Length == 1) { 89 removeById (_params [0]); 90 } else if (_params.Length == 3) { 91 removeByPosition (_params); 92 } else { 93 m_Console.SendResult ("Usage: removelandprotection <x> <y> <z> OR removelandprotection <steamid>"); 94 } 53 95 } catch (Exception e) { 54 96 Log.Out ("Error in RemoveLandProtection.Run: " + e); -
binary-improvements/server-fixes.userprefs
r120 r123 1 1 <Properties> 2 2 <MonoDevelop.Ide.Workspace ActiveConfiguration="Release" /> 3 <MonoDevelop.Ide.Workbench ActiveDocument="7dtd-server-fixes/src/ AdminToolsStuff.cs">3 <MonoDevelop.Ide.Workbench ActiveDocument="7dtd-server-fixes/src/TelnetCommands/RemoveLandProtection.cs"> 4 4 <Files> 5 5 <File FileName="assembly-patcher/Main.cs" Line="10" Column="3" /> 6 6 <File FileName="7dtd-server-fixes/src/AssemblyInfo.cs" Line="20" Column="34" /> 7 <File FileName="7dtd-server-fixes/src/TelnetCommands/ListPlayersExtended.cs" Line="44" Column="25" /> 8 <File FileName="7dtd-server-fixes/src/TelnetCommands/Kill.cs" Line="36" Column="70" /> 7 <File FileName="7dtd-server-fixes/src/TelnetCommands/ListPlayersExtended.cs" Line="45" Column="17" /> 9 8 <File FileName="7dtd-server-fixes/src/AllocsNetTelnetServer.cs" Line="1" Column="1" /> 10 <File FileName="7dtd-server-fixes/src/ AdminToolsStuff.cs" Line="43" Column="1" />9 <File FileName="7dtd-server-fixes/src/TelnetCommands/RemoveLandProtection.cs" Line="52" Column="44" /> 11 10 </Files> 12 11 </MonoDevelop.Ide.Workbench>
Note:
See TracChangeset
for help on using the changeset viewer.