What kind of file are you adding - something similar to the $data... files?
What I normally do is just look through DataManager, and wherever the $data... files are used, I will add something similar in my plugin.
Let's go through it ... we'll use a new variable called $dataMyData for the example (all of this is within your own plugin).
var $dataActors = null;
just initializing it to contain nothing. This probably doesn't need to be done, but for completeness, we'll do it:
var $dataMyData = null;
Code:
DataManager._databaseFiles = [
{ name: '$dataActors', src: 'Actors.json' },
...
This is where it lists all the files that need to be loaded on launching the game, and what global variable (array) they're going to be put into. We don't want to redefine it (as that would remove all the default ones), we just want to add to it:
DataManager._databaseFiles.push({ name: '$dataMyData', src: 'MyData.json' });
If that's all you want to do - load it when the game is launched, that's all you need to add, apart from the rest of your plugin to actually use it. If you want to do more stuff, like setting things up after the data is loaded, you can do that in the DataManager.onLoad function:
var _DataManager_onLoad = DataManager.onLoad;
DataManager.onLoad = function(object) {
_DataManager_onLoad.call(this, object);
if (object === $dataMyData) {
// do other stuff here
}
};
However, if you want to create a new class, like $gameActors, $gameSystem, etc that get saved with the player's save file, that's a completely different process.