Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ownedby IdentityId and NPCs
Currently the code is set up to GetPlayerByNameOrID, which doesn't appear to return the NPC entity (at least on my testing). We should allow the code to try and directly input the ID number first if it passes a simple regex.
  • Loading branch information
SplenectomY authored Aug 19, 2018
commit a67beb201bcfeb4fce91c60b51544eaad2343b2c
11 changes: 11 additions & 0 deletions Essentials/Commands/CleanupModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ public bool PlayerDistanceLessThan(MyCubeGrid grid, double dist)
public bool OwnedBy(MyCubeGrid grid, string str)
{
long identityId;

String digitsOnly = @"\d+";

if (Regex.IsMatch(str, digitsOnly)){
try
{
public static long tryID = ToInt64(str);
if (grid.BigOwners.Contains(tryID)) return grid.BigOwners.Contains(tryID);
}
catch {}
}

if (string.Compare(str, "nobody", StringComparison.InvariantCultureIgnoreCase) == 0)
{
Expand Down