- Timestamp:
- Aug 26, 2014, 4:41:47 PM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src/CustomCommands
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/CustomCommands/ListLandProtection.cs
r113 r130 2 2 using System.Collections.Generic; 3 3 4 public class ListLandProtection : ConsoleCommand 4 namespace AllocsFixes.CustomCommands 5 5 { 6 public ListLandProtection (ConsoleSdtd cons) : base(cons)6 public class ListLandProtection : ConsoleCommand 7 7 { 8 } 8 public ListLandProtection (ConsoleSdtd cons) : base(cons) 9 { 10 } 9 11 10 public override string Description ()11 {12 return "lists all land protection blocks and owners";13 }12 public override string Description () 13 { 14 return "lists all land protection blocks and owners"; 15 } 14 16 15 public override string[] Names ()16 {17 return new string[] { "listlandprotection", "llp" };18 }17 public override string[] Names () 18 { 19 return new string[] { "listlandprotection", "llp" }; 20 } 19 21 20 public override void Run (string[] _params)21 {22 try {23 World w = CommonMappingFunctions.GetGameManager ().World;24 PersistentPlayerList ppl = CommonMappingFunctions.GetGameManager().GetPersistentPlayerList();22 public override void Run (string[] _params) 23 { 24 try { 25 World w = CommonMappingFunctions.GetGameManager ().World; 26 PersistentPlayerList ppl = CommonMappingFunctions.GetGameManager ().GetPersistentPlayerList (); 25 27 26 Dictionary<Vector3i, PersistentPlayerData> d = ppl.positionToLPBlockOwner; 27 if (d != null) { 28 Dictionary<PersistentPlayerData, List<Vector3i>> owners = new Dictionary<PersistentPlayerData, List<Vector3i>>(); 29 foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) { 30 if (!owners.ContainsKey(kvp.Value)) { 31 owners.Add(kvp.Value, new List<Vector3i>()); 28 Dictionary<Vector3i, PersistentPlayerData> d = ppl.positionToLPBlockOwner; 29 if (d != null) { 30 Dictionary<PersistentPlayerData, List<Vector3i>> owners = new Dictionary<PersistentPlayerData, List<Vector3i>> (); 31 foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) { 32 if (!owners.ContainsKey (kvp.Value)) { 33 owners.Add (kvp.Value, new List<Vector3i> ()); 34 } 35 owners [kvp.Value].Add (kvp.Key); 32 36 } 33 owners[kvp.Value].Add(kvp.Key); 37 38 foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) { 39 ClientInfo ci = CommonMappingFunctions.GetClientInfoFromEntityID (kvp.Key.EntityId); 40 string name = string.Empty; 41 if (ci != null) { 42 name = CommonMappingFunctions.GetPlayerName (ci); 43 } 44 name += " (" + kvp.Key.PlayerId + ")"; 45 46 m_Console.SendResult (String.Format ("Player \"{0}\" (protected: {1}, current hardness multiplier: {2}):", name, w.LandClaimIsActive (kvp.Key), w.LandClaimPower (kvp.Key))); 47 foreach (Vector3i v in kvp.Value) { 48 m_Console.SendResult (" (" + v.ToString () + ")"); 49 } 50 } 34 51 } 35 52 36 foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) { 37 ClientInfo ci = CommonMappingFunctions.GetClientInfoFromEntityID(kvp.Key.EntityId); 38 string name = string.Empty; 39 if (ci != null) { 40 name = CommonMappingFunctions.GetPlayerName(ci); 41 } 42 name += " (" + kvp.Key.PlayerId + ")"; 43 44 m_Console.SendResult (String.Format("Player \"{0}\" (protected: {1}, current hardness multiplier: {2}):", name, w.LandClaimIsActive(kvp.Key), w.LandClaimPower(kvp.Key))); 45 foreach (Vector3i v in kvp.Value) { 46 m_Console.SendResult(" (" + v.ToString() + ")"); 47 } 48 } 53 m_Console.SendResult ("Total of " + d.Count + " keystones in the game"); 54 } catch (Exception e) { 55 Log.Out ("Error in ListLandProtection.Run: " + e); 49 56 } 50 51 m_Console.SendResult ("Total of " + d.Count + " keystones in the game");52 } catch (Exception e) {53 Log.Out ("Error in ListLandProtection.Run: " + e);54 57 } 55 58 }
Note:
See TracChangeset
for help on using the changeset viewer.