1313using Sandbox . Common . ObjectBuilders . Definitions ;
1414
1515using VRageMath ;
16- using VRage . Common . Utils ;
1716
1817using SEModAPIInternal . API . Entity ;
1918using SEModAPIInternal . API . Entity . Sector . SectorObject ;
2019using SEModAPIInternal . API . Entity . Sector . SectorObject . CubeGrid ;
2120using SEModAPIInternal . API . Entity . Sector . SectorObject . CubeGrid . CubeBlock ;
2221
2322using SEModAPIInternal . API . Common ;
24- using SEModAPIInternal . Support ;
2523
2624using EssentialsPlugin . UtilityClasses ;
2725
2826namespace EssentialsPlugin . Utility
2927{
30- using NLog ;
31- using VRage . Library . Utils ;
28+ using VRage . FileSystem ;
3229
3330 public static class Player
3431 {
35- private static readonly Logger Log = LogManager . GetLogger ( "PluginLog" ) ;
3632 public static MyObjectBuilder_Character FindCharacter ( string userName )
3733 {
3834 HashSet < IMyEntity > entities = new HashSet < IMyEntity > ( ) ;
@@ -147,7 +143,7 @@ public static bool Move(string userName, Vector3D position)
147143 MyObjectBuilder_Character charEntity = FindCharacter ( userName ) ;
148144 if ( charEntity == null )
149145 {
150- Log . Info ( string . Format ( "Unable to find CharacterEntity of '{0}'" , userName ) ) ;
146+ Essentials . Log . Info ( string . Format ( "Unable to find CharacterEntity of '{0}'" , userName ) ) ;
151147 return false ;
152148 }
153149
@@ -187,7 +183,7 @@ public static bool Move(string userName, Vector3D position)
187183
188184 if ( gridEntity . IsLoading )
189185 {
190- Log . Info ( string . Format ( "Failed to load cockpit entity: {0}" , gridEntity . EntityId ) ) ;
186+ Essentials . Log . Info ( "Failed to load cockpit entity: {0}" , gridEntity . EntityId ) ;
191187 return false ;
192188 }
193189
@@ -264,9 +260,7 @@ internal static Object InvokeEntityMethod(Object gameEntity, string methodName,
264260 }
265261 catch ( Exception ex )
266262 {
267- Log . Info ( "Failed to invoke entity method '{0}' on type '{1}': {2}" , methodName , gameEntity . GetType ( ) . FullName , ex . Message ) ;
268-
269- Log . Error ( ex ) ;
263+ Essentials . Log . Error ( ex ) ;
270264 return null ;
271265 }
272266 }
@@ -299,9 +293,7 @@ internal static MethodInfo GetEntityMethod(Object gameEntity, string methodName)
299293 }
300294 catch ( Exception ex )
301295 {
302- Log . Info ( "Failed to get entity method '" + methodName + "': " + ex . Message ) ;
303-
304- Log . Error ( ex ) ;
296+ Essentials . Log . Error ( ex ) ;
305297 return null ;
306298 }
307299 }
@@ -337,9 +329,7 @@ internal static MethodInfo GetEntityMethod(Object gameEntity, string methodName,
337329 }
338330 catch ( Exception ex )
339331 {
340- Log . Info ( "Failed to get entity method '{0}': {1}" , methodName , ex . Message ) ;
341-
342- Log . Error ( ex ) ;
332+ Essentials . Log . Error ( ex ) ;
343333 return null ;
344334 }
345335 }
@@ -384,7 +374,6 @@ public override int GetHashCode()
384374
385375 public class Players
386376 {
387- private static readonly Logger Log = LogManager . GetLogger ( "PluginLog" ) ;
388377 private static volatile bool m_checking = false ;
389378 private static Players m_instance ;
390379 public static Players Instance
@@ -432,7 +421,7 @@ private static void Load()
432421 catch ( Exception ex )
433422 {
434423 m_instance = new Players ( ) ;
435- Log . Error ( ex ) ;
424+ Essentials . Log . Error ( ex ) ;
436425 }
437426 }
438427
@@ -459,7 +448,7 @@ private void Save()
459448 }
460449 catch ( Exception ex )
461450 {
462- Log . Error ( "Error saving player logins: {0}" , ex ) ;
451+ Essentials . Log . Error ( "Error saving player logins: {0}" , ex ) ;
463452 }
464453 }
465454
@@ -580,7 +569,7 @@ public static void ProcessServerLogsForLogins(bool restart = false)
580569 string [ ] files = Directory . GetFiles ( logPath , "SpaceEngineersDedicated_*.log" ) ;
581570 List < PlayerItem > playerItems = new List < PlayerItem > ( ) ;
582571
583- Log . Info ( string . Format ( "Checking {0} log files for logins" , files . Length ) ) ;
572+ Essentials . Log . Info ( "Checking {0} log files for logins" , files . Length ) ;
584573 DateTime start = DateTime . Now ;
585574 Parallel . ForEach ( files , currentFile =>
586575 {
@@ -604,7 +593,7 @@ public static void ProcessServerLogsForLogins(bool restart = false)
604593 } ) ;
605594
606595 Instance . UpdatePlayers ( playerItems ) ;
607- Log . Info ( "Completed checking logs in {0}s: {2} ({1}) steamIds" , ( DateTime . Now - start ) . TotalSeconds , playerItems . Count , Instance . PlayerLogins . Count ) ;
596+ Essentials . Log . Info ( "Completed checking logs in {0}s: {2} ({1}) steamIds" , ( DateTime . Now - start ) . TotalSeconds , playerItems . Count , Instance . PlayerLogins . Count ) ;
608597 } ) ) ;
609598 }
610599 finally
0 commit comments