- Timestamp:
- Apr 18, 2015, 4:27:57 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs
r224 r230 4 4 namespace AllocsFixes.CustomCommands 5 5 { 6 public class RemoveLandProtection : ConsoleC ommand6 public class RemoveLandProtection : ConsoleCmdAbstract 7 7 { 8 public RemoveLandProtection (ConsoleSdtd cons) : base(cons) 9 { 10 } 11 12 public override string Description () 8 public override string GetDescription () 13 9 { 14 10 return "removes the association of a land protection block to the owner"; 15 11 } 16 12 17 public override string[] Names ()13 public override string[] GetCommands () 18 14 { 19 15 return new string[] { "removelandprotection", "rlp" }; … … 23 19 { 24 20 try { 25 PersistentPlayerList ppl = CommonMappingFunctions.GetGameManager ().GetPersistentPlayerList ();21 PersistentPlayerList ppl = GameManager.Instance.GetPersistentPlayerList (); 26 22 27 23 if (_id.Length < 1 || !ppl.Players.ContainsKey (_id)) { 28 m_Console.SendResult ("Not a valid Steam ID or user has never logged on. Use \"listlandprotection\" to get a list of keystones.");24 SdtdConsole.Instance.Output ("Not a valid Steam ID or user has never logged on. Use \"listlandprotection\" to get a list of keystones."); 29 25 return; 30 26 } 31 27 if (ppl.Players [_id].LPBlocks == null || ppl.Players [_id].LPBlocks.Count == 0) { 32 m_Console.SendResult ("Player does not own any keystones. Use \"listlandprotection\" to get a list of keystones.");28 SdtdConsole.Instance.Output ("Player does not own any keystones. Use \"listlandprotection\" to get a list of keystones."); 33 29 return; 34 30 } … … 39 35 changes.Add (bci); 40 36 } 41 CommonMappingFunctions.GetGameManager ().SetBlocksRPC (changes);37 GameManager.Instance.SetBlocksRPC (changes); 42 38 43 m_Console.SendResult ("Tried to remove #" + changes.Count + " land protection blocks for player \"" + _id + "\". Note "+39 SdtdConsole.Instance.Output ("Tried to remove #" + changes.Count + " land protection blocks for player \"" + _id + "\". Note "+ 44 40 "that only blocks in chunks that are currently loaded (close to any player) could be removed. "+ 45 41 "Please check for remaining blocks by running:"); 46 m_Console.SendResult(" listlandprotection " + _id);42 SdtdConsole.Instance.Output(" listlandprotection " + _id); 47 43 } catch (Exception e) { 48 44 Log.Out ("Error in RemoveLandProtection.removeById: " + e); … … 50 46 } 51 47 52 private void removeByPosition ( string[]_coords)48 private void removeByPosition (List<string> _coords) 53 49 { 54 50 try { … … 61 57 62 58 if (x == int.MinValue || y == int.MinValue || z == int.MinValue) { 63 m_Console.SendResult ("At least one of the given coordinates is not a valid integer");59 SdtdConsole.Instance.Output ("At least one of the given coordinates is not a valid integer"); 64 60 return; 65 61 } … … 67 63 Vector3i v = new Vector3i (x, y, z); 68 64 69 PersistentPlayerList ppl = CommonMappingFunctions.GetGameManager ().GetPersistentPlayerList ();65 PersistentPlayerList ppl = GameManager.Instance.GetPersistentPlayerList (); 70 66 71 67 Dictionary<Vector3i, PersistentPlayerData> d = ppl.positionToLPBlockOwner; 72 68 if (d == null || !d.ContainsKey (v)) { 73 m_Console.SendResult ("No land protection block at the given position or not a valid position. Use \"listlandprotection\" to get a list of keystones.");69 SdtdConsole.Instance.Output ("No land protection block at the given position or not a valid position. Use \"listlandprotection\" to get a list of keystones."); 74 70 return; 75 71 } … … 80 76 changes.Add (bci); 81 77 82 CommonMappingFunctions.GetGameManager ().SetBlocksRPC (changes);78 GameManager.Instance.SetBlocksRPC (changes); 83 79 84 m_Console.SendResult ("Land protection block at (" + v.ToString () + ") removed");80 SdtdConsole.Instance.Output ("Land protection block at (" + v.ToString () + ") removed"); 85 81 } catch (Exception e) { 86 82 Log.Out ("Error in RemoveLandProtection.removeByPosition: " + e); … … 88 84 } 89 85 90 public override void Run (string[] _params)86 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) 91 87 { 92 88 try { 93 if (_params. Length== 1) {89 if (_params.Count == 1) { 94 90 removeById (_params [0]); 95 } else if (_params. Length== 3) {91 } else if (_params.Count == 3) { 96 92 removeByPosition (_params); 97 93 } else { 98 m_Console.SendResult ("Usage: removelandprotection <x> <y> <z> OR removelandprotection <steamid>");94 SdtdConsole.Instance.Output ("Usage: removelandprotection <x> <y> <z> OR removelandprotection <steamid>"); 99 95 } 100 96 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.