To Nadeo: How do I split up a plugin into multiple classes?

Discuss the Dedicated Server Tools developed by Nadeo Live such as ManiaLive, Trust Circles, Dedicated Manager, Competition Manager and Lobbies

Moderator: NADEO

Post Reply
TatharNuar
Posts: 80
Joined: 16 Jul 2012, 16:50

To Nadeo: How do I split up a plugin into multiple classes?

Post by TatharNuar »

I'm trying to split up a fairly large plugin into multiple classes for easier readability and navigation, and I've noticed that the MLEPP core plugin accomplishes this, but newer versions of ManiaLive are incompatible with the extra classes' use of the Connection class. How should I split up my plugin into multiple classes, as below, so that the new classes would be forward-compatible? Do I need the extra classes to inherit anything?
  • Plugin class - The main class that contains the framework for the plugin and parses the /server supercommand.
  • CoreFunctions class - A class containing basic server functions, like shutting down the server and changing its name.
  • Moderation class - A class containing functions regarding server moderation.
  • TrackControl class - A class containing functions that control when tracks in the playlist are played.
  • TrackList class - A class containing functions that add or remove tracks in the playlist and save the changes.
  • Billing class - A class with functions related to charging and paying out Planets.
  • Bill class - A class for creating Bill objects containing data associated with pending bills generated from the Billing class.
  • PrivateMessage class - A class for the "private message" function.
  • ManiaHome class - A class with functions related to posting ManiaHome notifications.
TatharNuar
Posts: 80
Joined: 16 Jul 2012, 16:50

Re: To Nadeo: How do I split up a plugin into multiple class

Post by TatharNuar »

I noticed that Standard\Profiler and Standard\TeamSpeak are also doing it MLEPP's way, but that wouldn't work out very well if ManiaLive changed its structure again, like what happened when \ManiaLive\DedicatedApi\Connection was moved to \DedicatedApi\Connection and it no longer had the getInstance() function.

I'd prefer a way to do this that would allow me to access the same classes that the main Plugin class can access without having to make ManiaLive think I have two or more plugins with the same name by extending \ManiaLive\PluginHandler\Plugin with each class. Or would that not be a problem?
Post Reply

Return to “Dedicated Server Tools”

Who is online

Users browsing this forum: No registered users and 1 guest