Hi, this is my new tool that helps find plugin conflicts.
The latest version can be downloaded from Github. After downloading, double-click
conflict-finder to use it.This tool analyzes the execution order and syntax of plugins to detect conflicts. Plugins that are encrypted, uglify, or written in a unique style may not be accurately detected. After finding conflicts between plugins, this tool can suggest the placement order of plugins to resolve some conflicts by rearranging them.
However, not all plugin conflicts can be resolved by rearranging. Common types of plugin conflicts in RPG Maker include:
Overwrite
Plugin A
JavaScript:
const _Game_Player_searchLimit = Game_Player.prototype.searchLimit;
Game_Player.prototype.searchLimit = function() {
if (this.isDashing()) {
return 999;
}
return _Game_Player_searchLimit.call(this);
};
Plugin B
JavaScript:
Game_Party.prototype.maxItems = function(item) {
return 999;
};
The function of Plugin A is completely overwritten and becomes ineffective. If the overwrite is unintentional, it can cause errors. When Plugin A uses alias for patching and Plugin B directly overwrites, rearranging their order might allow both plugins to work. However, if both are using overwrite, simply rearranging cannot resolve the issue.
Another type is:
Outdated
Original
JavaScript:
Game_Character.prototype.searchLimit = function() {
return 12;
};
Plugin A
JavaScript:
const _GamePlayer_searchLimit = Game_Player.prototype.searchLimit;
Game_Player.prototype.searchLimit = function() {
if (this.isDashing()) {
return 999;
}
return _GamePlayer_searchLimit.call(this);
};
Plugin B
JavaScript:
Game_Character.prototype.searchLimit = function() {
return 0;
};
Since
Game_Player does not have a searchLimit method and inherits it from Game_Character, Plugin A’s searchLimit stores Game_Character’s searchLimit. When Plugin B later modifies searchLimit, Plugin A’s searchLimit remains outdated. Rearranging their order can resolve this issue.Using a functional alias patching method can prevent this problem:
JavaScript:
/**
* Automatically choose whether to alias itself or the parent class.
*
* @param {Object} aliasClass - Use "Foo.prototype" for instance methods and "Foo" for static methods.
* @param {string} methodName - The name of the method to alias.
* @returns {Function} - The aliased method, callable with "call" or "apply".
*/
PluginManager.alias = function(aliasClass, methodName) {
if (aliasClass.hasOwnProperty(methodName)) {
return aliasClass[methodName];
} else {
const superClass = Object.getPrototypeOf(aliasClass);
const superMethod = function(…args) {
return superClass[methodName].apply(this, args);
};
return superMethod;
}
};
Change
JavaScript:
const _GamePlayer_searchLimit = Game_Player.prototype.searchLimit;
JavaScript:
const _GamePlayer_searchLimit = PluginManager.alias(Game_Player.prototype, "searchLimit");
This will automatically determine whether the current class has this method, and if not, it will automatically call the parent class method to get the latest status.