Files
src
build.gradle
settings.gradle
Code
11 854
src/main/java/com/kodari/mythicweapons/MythicWeaponsPlugin.java
package com.kodari.mythicweapons;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class MythicWeaponsPlugin extends JavaPlugin {
private CraftManager craftManager;
private WeaponItemFactory itemFactory;
@Override
public void onEnable() {
saveDefaultConfig();
NamespacedKey weaponKey = new NamespacedKey(this, "weapon_type");
craftManager = new CraftManager(this);
craftManager.load();
itemFactory = new WeaponItemFactory(weaponKey);
RecipeManager recipeManager = new RecipeManager(this, itemFactory);
recipeManager.registerRecipes();
WeaponListener listener = new WeaponListener(craftManager, itemFactory);
getServer().getPluginManager().registerEvents(listener, this);
Bukkit.getScheduler().runTaskTimer(this, listener::applyPassiveEffects, 20L, 20L);
PluginCommand command = getCommand("mythicweapons");
if (command != null) {
MythicWeaponsCommand executor = new MythicWeaponsCommand(itemFactory);
command.setExecutor(executor);
command.setTabCompleter(executor);
}
getLogger().info("MythicWeapons enabled with " + WeaponType.values().length + " mythic weapons.");
}
@Override
public void onDisable() {
if (craftManager != null) {
craftManager.save();
}
}
}