The DPDDspace Server Wrapper

    Discussion in 'WIP' started by Alendon, Aug 6, 2018.

    1. Alendon

      Alendon Programmer

      Apr 13, 2016
      Hello Guys
      here i want to present you the DPDDs StarMade Wrapper. It is be a multifunctional server management and extension tool. The Wrapper is written in C# in the .Net Version 4.6.1 (How to use on Linux, look below).

      • Server:
        • The Server restarts automatically and have a built in daily restarter
        • Updates automatically the Server when a new StarMade Version was released
        • Built in Plugin System
        • a !help method for a general information about all plugin commands
        • !help 'plugin_command' for detailed information
        • !usage 'plugin_command' for the usage
        • DONT NEED any Modifications on the Client Side
        • Have Multiple StarMade Servers running if you want
        • Wrapper Commands like: start, stop, pause, resume, restart, update, various plugin commands
        • Run every StarMade Command from the Console if you want
      • Plugin System:
        • Very easy installation of new Plugins
        • Files with multiple Plugins inside are fully supported
        • Choose Easily which Plugin you want to activate or not, also you can load unload them later
        • A ! based Command System
        • Multiple Events are supported like: PlayerKilled, SectorChange or FactionJoin
        • All important Commands which a return Value are supported, for example FactionMembers or PlayerInfo
        • And still if not directly implemented you can use any StarMade Command which has Console
      • Server:
        • Use the Chat in the Wrapper(not that difficult just not implemented yet)
        • Pretty Up the whole Wrapper, maybe a GUI Version
      • Plugin System:
        • A Build in Custom Event System(The Wrapper triggers and a random event method from a plugin get called)
        • A Questing System?
      • On Windows:
        • Make Sure you have a compatible .NET Version installed
      • On Linux or macOS:
        • Goto Download - Stable | Mono
        • Choose your Distribution
        • Follow the installation Guide and install the mono complete Package to make sure everything runs right
      • Extract the Content of the Wrapper to an empty Folder
      • Open The and adjust your preffered Settings
      Code (Text):

      HourToRestart at which Hour the wrapper should restart, example 3 is at 3 o'clock
      DailyAutoRestart if true the Server will daily restart at given time
      SMAutoUpdate if set true it will automatically check if there is an StarMade update available and install it
      PathToStarNet The Path where you have StarNet saved, i put it in the zip so dont change this
      PathToSm The relative StarMade Path if you dont know how to use, just put your StarMade Folder(where the starmade.jar is inside) in the folder where the wrapper is, and eventually rename, OR you dont make anything and the Wrapper will automatically install StarMade
      DefaultLoadPlugins if true all plugins which are inside the Plugin Path will be loaded
      PluginPath The Path  where the Wrapper searches the Plugins
      Pass Your SuperAdminPassword
      Port The Port where the Server will run, leave it at 4242 unless you want to run multiple Servers
      RamMin The Minimum Ram for StarMade
      RamMax The Maximum Ram for StarMade
      If you dont have an StarMade Installation linked in the Prroperties(default is ./StarMade) the Wrapper will automatically download the latest if you have set SMAutoUpdate to true, otherwise you get asked on Wrapper Start
      • Run The Wrapper Executeable, on Linux Server use the mono command to start the Wrapper
      • PLS Dont use older StarMade Version or only with caution, they are not supported
      • On Wrapper Start it checks if the StarMade.jar exists to check the game availability and the version, the wrapper can update or install StarMade, Check the properties file
      • At Runtime you can use various commands by just typing it into the console, also you can use StarMade Commands like ingame with "/status" for example, run the help command to see a list of all available commands
      • Put the Plugin.dll inside your Plugins Folder
      • Check your and set DefaultLoadPlugins=true, or create a file named and put there the PluginID inside =true
      • You can use different wrapper commands to manage the Plugins, also See a List of all available Plugins with the "plugins_available" command, run help to see all
      But The most Important:
      • Cooming soon xD
      • No i give you a short instruction now but a more detailed one and a few examples are following
      • In Visual Studio:
      • Create a new ClassLibrary
      • Add Reference to the SMWrapperLib.dll
      • Your Main Class Have to implement the IPlugin Interface
      • In the load and unload methods you put your registration stuff
      • Custom Commands:
        • Create a new Class which implements the ICommand Interface
        • The Wrapper gives you the informations about the sender and the args
        • The Execute Method will be called if someone use your command
        • Register The Command(Example is at the end of this spoiler
      • StarMade Events:
        • Create a Method with the Parameters "SMEventType" and "SMArgs"
        • The SMEventType Contains a single String
        • The SMArgs a Dictionary<string,string>
        • The Keys and all Events are saved in the Enum ConsoleManager.EventTypes
        • Register this Method like any other C# Method
      But now a very short Example
      Code (C#):

      using SMWrapperLib;

      class MyPlugin : IPlugin
      //i "forgot" the common informations like name id...
      public bool loaded => false;
      ICommand Command = new MyCommand(); //intantiate a Object from your command class which implements ICommand
      public void Load()
           SMWrapperLib.ConsoleManager.OnSMEventOccured += new ConsoleManager.SMEventHandler(Event)

      public void OnStarMadeEvent(SmEventType, SMArgs)
      //Do something here  
      • IPlugin
      • ICommand
      • CommandHandler(Access with ObjectHandler.GetCommandHandler)
        • AddCommand(ICommand)
        • RemoveCommand(ICommand)
      • ConsoleManager(For StarMade Events)
        • delegate void SMEventHandler(SMEventType,SMArgs)
        • event OnCMEventOccured
        • enum EventTypes
        • class SMArgs : EventArgs(Contains Dictionary<string,string>)
        • class SMEventType : EventArgs(Contains String)
      • StarMadeCommands (the most are formatted to dictionaries or lists)
        • Status
        • SectorInfo(x,y,z)
        • Whitelisted(type) //List of all whitelisted by type: name ip account
        • Banned(type) //List of all banned by type: name ip account
        • ServerAdmins
        • FactionMembers(FactionID)
        • FactionPointsGet(FactionID)
        • Faction_List
        • Player_Info(Player)
        • Player_List
        • void Command(String[] Args) // put the command into the folling style: {"/give","Alendon","XXXX","2"}
        • List<String> Command // same args returns the output of starnet
      • FactionCommands:
        • Actually Empty
      • PlayerCommands:
        • int? GetPlayerFactionID(player) //return Faction ID, null if player has no faction
      • ServerCommands:
        • StopServer(countdown)
        • ServerBroadcast(message)
        • PlayerMessage(player, message)

      The Download Link:

      If you want to see the Wrapper in Action our Server runs on them, the links to the server threads:

      Also you can just join our Discord Server if you directly interested:
      #1 Alendon, Aug 6, 2018
      Last edited: Oct 12, 2018
      • Like Like x 4
    2. Alendon

      Alendon Programmer

      Apr 13, 2016
      Little Update:

      The Wrapper is now providing all needed core mechanics, and the plugin system is working now, it isnt in state for public using, cause of not ready documentations and a few missing commands for easy use and setup. If you want to access it anyways you can contact me and i give you a short instruction for use
      • Like Like x 1
    3. Alendon

      Alendon Programmer

      Apr 13, 2016
      Little Comment: I tried to run the Wrapper on Linux right now, and it works with the tool named mono, check the supported Linux distributions on their Download Page.
    4. Alendon

      Alendon Programmer

      Apr 13, 2016
      Released the first Public Version, if you have questions or suggestions pls write it
    5. Alendon

      Alendon Programmer

      Apr 13, 2016
      Little Update:
      Bug Fixing, Wrapper Commands should now work right
      Started at creating Custom Event Support
    6. Alendon

      Alendon Programmer

      Apr 13, 2016
      Custom Event System is Ready, not fully tested
      Logging System added, access per
      Code (C#):
      SMWrapperLib.Logger.LogEntry(logMessage, LogType, LogLevel, Plugin);
      Fixing few little bugs