refactor: wip
This commit is contained in:
parent
4b61948f68
commit
0cb7131435
5 changed files with 69 additions and 45 deletions
22
Plugin.cs
22
Plugin.cs
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using BepInEx;
|
||||
using BepInEx.Logging;
|
||||
|
|
@ -54,6 +54,16 @@ public class Plugin : BaseUnityPlugin
|
|||
Helper.CreateRotationFolder();
|
||||
|
||||
Log.LogDebug("Server game config should be found at " + Helper.GameConfigPath);
|
||||
|
||||
// Parse CLI arguments
|
||||
if (CommandLineParser.Instance.KeyExists("-ip"))
|
||||
{
|
||||
Helper.serverip = CommandLineParser.Instance.GetValueForKey("-ip", true);
|
||||
}
|
||||
if (CommandLineParser.Instance.KeyExists("-port"))
|
||||
{
|
||||
int.TryParse(CommandLineParser.Instance.GetValueForKey("-port", true), out Helper.serverport);
|
||||
}
|
||||
}
|
||||
|
||||
private static void GBSUCompInit()
|
||||
|
|
@ -66,6 +76,13 @@ public class Plugin : BaseUnityPlugin
|
|||
}
|
||||
|
||||
public static void AddServerComp()
|
||||
{
|
||||
DestroyServerComp();
|
||||
Log.LogDebug("Adding GBSUServer component");
|
||||
GBSUCompContainer.AddComponent<GBSUServer>();
|
||||
}
|
||||
|
||||
public static void DestroyServerComp()
|
||||
{
|
||||
Component[] comps = GBSUCompContainer.GetComponents(typeof(Component));
|
||||
foreach (var comp in comps)
|
||||
|
|
@ -77,8 +94,5 @@ public class Plugin : BaseUnityPlugin
|
|||
Destroy(comp);
|
||||
}
|
||||
}
|
||||
|
||||
Log.LogDebug("Adding GBSUServer component");
|
||||
GBSUCompContainer.AddComponent<GBSUServer>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue