!Changed MMOLib instance generator

Updated lib
This commit is contained in:
Indyuce 2019-12-30 01:08:43 +01:00
parent fcaaecd441
commit 5eb88a912f
2 changed files with 8 additions and 1 deletions

Binary file not shown.

View File

@ -89,6 +89,7 @@ import net.Indyuce.mmocore.manager.social.PartyManager;
import net.Indyuce.mmocore.manager.social.RequestManager; import net.Indyuce.mmocore.manager.social.RequestManager;
import net.mmogroup.mmolib.api.stat.StatMap; import net.mmogroup.mmolib.api.stat.StatMap;
import net.mmogroup.mmolib.api.stat.instance.MMOCoreStatInstance; import net.mmogroup.mmolib.api.stat.instance.MMOCoreStatInstance;
import net.mmogroup.mmolib.api.stat.instance.SimpleStatInstance;
import net.mmogroup.mmolib.comp.Metrics; import net.mmogroup.mmolib.comp.Metrics;
public class MMOCore extends JavaPlugin { public class MMOCore extends JavaPlugin {
@ -161,7 +162,13 @@ public class MMOCore extends JavaPlugin {
* specific stat instances let MMOLib calculate stats with set base * specific stat instances let MMOLib calculate stats with set base
* value * value
*/ */
StatMap.setInstanceGenerator((map, stat) -> new MMOCoreStatInstance(map, stat)); StatMap.setInstanceGenerator((map, stat) -> {
try {
return new MMOCoreStatInstance(map, StatType.valueOf(stat));
} catch (IllegalArgumentException notMMOCoreStat) {
return new SimpleStatInstance(map, stat);
}
});
if (Bukkit.getPluginManager().getPlugin("Vault") != null) if (Bukkit.getPluginManager().getPlugin("Vault") != null)
economy = new VaultEconomy(); economy = new VaultEconomy();