mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-31 06:07:34 +01:00
External stats now work in item set bonuses
This commit is contained in:
parent
5f55ec6adf
commit
001c14e036
@ -115,12 +115,16 @@ public class MMOItems extends JavaPlugin {
|
||||
getLogger().log(Level.WARNING, "Could not initialize support with WorldGuard 7+");
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("MMOCore") != null)
|
||||
new MMOCoreMMOLoader();
|
||||
|
||||
/*
|
||||
* stat manager must be initialized before MMOCore compatibility
|
||||
* initializes so that MMOCore can register its stats
|
||||
*/
|
||||
saveDefaultConfig();
|
||||
statManager = new StatManager();
|
||||
typeManager.reload();
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("MMOCore") != null)
|
||||
new MMOCoreMMOLoader();
|
||||
}
|
||||
|
||||
public void onEnable() {
|
||||
|
@ -1,9 +1,7 @@
|
||||
package net.Indyuce.mmoitems.comp.mmocore;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.PlayerChangeClassEvent;
|
||||
@ -15,34 +13,14 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Attribute;
|
||||
import net.Indyuce.mmoitems.comp.rpg.RPGHandler;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class MMOCoreHook implements RPGHandler, Listener {
|
||||
|
||||
private static final ItemStat MANA_REGENERATION = new DoubleStat("MANA_REGENERATION", VersionMaterial.LAPIS_LAZULI.toItem(), "Mana Regeneration",
|
||||
new String[] { "Increases mana regen." });
|
||||
private static final ItemStat MAX_STAMINA = new DoubleStat("MAX_STAMINA", VersionMaterial.LIGHT_BLUE_DYE.toItem(), "Max Stamina",
|
||||
new String[] { "Adds stamina to your max stamina bar." });
|
||||
private static final ItemStat STAMINA_REGENERATION = new DoubleStat("STAMINA_REGENERATION", VersionMaterial.LIGHT_BLUE_DYE.toItem(),
|
||||
"Stamina Regeneration", new String[] { "Increases stamina regen." });
|
||||
private static final ItemStat ADDITIONAL_EXPERIENCE = new DoubleStat("ADDITIONAL_EXPERIENCE", VersionMaterial.EXPERIENCE_BOTTLE.toItem(),
|
||||
"Additional Experience", new String[] { "Additional MMOCore main class experience in %." });
|
||||
private static final ItemStat HEALTH_REGENERATION = new DoubleStat("HEALTH_REGENERATION", new ItemStack(Material.BREAD), "Health Regeneration",
|
||||
new String[] { "Increases MMOCore health regen.", "In %." });
|
||||
|
||||
/*
|
||||
* called when MMOItems enables
|
||||
*/
|
||||
public MMOCoreHook() {
|
||||
|
||||
MMOItems.plugin.getStats().register(HEALTH_REGENERATION);
|
||||
MMOItems.plugin.getStats().register( MANA_REGENERATION);
|
||||
MMOItems.plugin.getStats().register( MAX_STAMINA);
|
||||
MMOItems.plugin.getStats().register( STAMINA_REGENERATION);
|
||||
MMOItems.plugin.getStats().register( ADDITIONAL_EXPERIENCE);
|
||||
|
||||
/*
|
||||
* only works when the server is reloaded. needs /reload when changing
|
||||
* attributes to refresh MMOItems stats
|
||||
|
@ -2,7 +2,9 @@ package net.Indyuce.mmoitems.comp.mmocore;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.block.BlockType;
|
||||
@ -17,6 +19,7 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.block.CustomBlock;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConditionalDisplay;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.crafting.ExperienceCraftingTrigger;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.crafting.ProfessionCondition;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.load.GetMMOItemObjective;
|
||||
@ -25,20 +28,38 @@ import net.Indyuce.mmoitems.comp.mmocore.load.MMOItemTrigger;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.load.MMOItemsBlockType;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.load.MineMIBlockExperienceSource;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.load.SmeltMMOItemExperienceSource;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.api.MMOLineConfig;
|
||||
|
||||
public class MMOCoreMMOLoader extends MMOLoader {
|
||||
|
||||
private static final ItemStat MANA_REGENERATION = new DoubleStat("MANA_REGENERATION", VersionMaterial.LAPIS_LAZULI.toItem(), "Mana Regeneration",
|
||||
new String[] { "Increases mana regen." });
|
||||
private static final ItemStat MAX_STAMINA = new DoubleStat("MAX_STAMINA", VersionMaterial.LIGHT_BLUE_DYE.toItem(), "Max Stamina",
|
||||
new String[] { "Adds stamina to your max stamina bar." });
|
||||
private static final ItemStat STAMINA_REGENERATION = new DoubleStat("STAMINA_REGENERATION", VersionMaterial.LIGHT_BLUE_DYE.toItem(),
|
||||
"Stamina Regeneration", new String[] { "Increases stamina regen." });
|
||||
private static final ItemStat ADDITIONAL_EXPERIENCE = new DoubleStat("ADDITIONAL_EXPERIENCE", VersionMaterial.EXPERIENCE_BOTTLE.toItem(),
|
||||
"Additional Experience", new String[] { "Additional MMOCore main class experience in %." });
|
||||
private static final ItemStat HEALTH_REGENERATION = new DoubleStat("HEALTH_REGENERATION", new ItemStack(Material.BREAD), "Health Regeneration",
|
||||
new String[] { "Increases MMOCore health regen.", "In %." });
|
||||
|
||||
/*
|
||||
* called when MMOItems loads
|
||||
*/
|
||||
public MMOCoreMMOLoader() {
|
||||
MMOCore.plugin.loadManager.registerLoader(this);
|
||||
MMOCore.plugin.mineManager.registerBlockType(
|
||||
block -> {
|
||||
Optional<CustomBlock> customBlock = MMOItems.plugin.getCustomBlocks().getFromBlock(block.getBlockData());
|
||||
return customBlock.isPresent() ? Optional.of(new MMOItemsBlockType(customBlock.get())) : Optional.empty();
|
||||
});
|
||||
MMOCore.plugin.mineManager.registerBlockType(block -> {
|
||||
Optional<CustomBlock> customBlock = MMOItems.plugin.getCustomBlocks().getFromBlock(block.getBlockData());
|
||||
return customBlock.isPresent() ? Optional.of(new MMOItemsBlockType(customBlock.get())) : Optional.empty();
|
||||
});
|
||||
|
||||
MMOItems.plugin.getStats().register(HEALTH_REGENERATION);
|
||||
MMOItems.plugin.getStats().register(MANA_REGENERATION);
|
||||
MMOItems.plugin.getStats().register(MAX_STAMINA);
|
||||
MMOItems.plugin.getStats().register(STAMINA_REGENERATION);
|
||||
MMOItems.plugin.getStats().register(ADDITIONAL_EXPERIENCE);
|
||||
|
||||
/*
|
||||
* register extra conditions for MMOItems crafting.
|
||||
|
Loading…
Reference in New Issue
Block a user