diff --git a/TShockAPI/RestManager.cs b/TShockAPI/RestManager.cs index 792119c2..17bc0413 100644 --- a/TShockAPI/RestManager.cs +++ b/TShockAPI/RestManager.cs @@ -21,7 +21,7 @@ namespace TShockAPI { #region RestMethods //http://127.0.0.1:8080/HelloWorld/name/{username}?type=status - object usertest(Dictionary verbs, IParameterCollection parameters, RequestEventArgs request) + object usertest(RestVerbs verbs, IParameterCollection parameters, RequestEventArgs request) { var ret = new Dictionary(); var type = parameters["type"]; @@ -38,15 +38,5 @@ namespace TShockAPI { return null; } #endregion - - public void Start() - { - Rest.Start(); - } - - public void Dispose() - { - Rest.Dispose(); - } } } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index eb4e075b..a4b0bb0b 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -69,7 +69,8 @@ namespace TShockAPI public static bool OverridePort; public static PacketBufferer PacketBuffer; public static MaxMind.GeoIPCountry Geo; - public static RestManager RestApi; + public static Rest RestApi; + public static RestManager RestManager; /// /// Called after TShock is initialized. Useful for plugins that needs hooks before tshock but also depend on tshock being loaded. @@ -175,7 +176,9 @@ namespace TShockAPI Regions = new RegionManager(DB); Itembans = new ItemManager(DB); RememberedPos = new RemeberedPosManager(DB); - RestApi = new RestManager(new Rest(IPAddress.Any, 8080)); + RestApi = new Rest(IPAddress.Any, 8080); + RestManager = new RestManager(RestApi); + RestManager.RegisterRestfulCommands(); if (Config.EnableGeoIP) Geo = new MaxMind.GeoIPCountry(Path.Combine(SavePath, "GeoIP.dat")); @@ -203,10 +206,7 @@ namespace TShockAPI Log.ConsoleInfo("Backups " + (Backups.Interval > 0 ? "Enabled" : "Disabled")); if (Initialized != null) - Initialized(); - - RestApi.RegisterRestfulCommands(); - + Initialized(); } catch (Exception ex) {