47 lines
1.5 KiB
Java
47 lines
1.5 KiB
Java
package net.hexa.MythicItems;
|
|
|
|
import net.hexa.MythicItems.mythics.MythicItem;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
import java.io.File;
|
|
import java.util.List;
|
|
|
|
|
|
public class MythicItems extends JavaPlugin {
|
|
@Override
|
|
public void onEnable() {
|
|
getLogger().info("onEnable is called!");
|
|
MythicItem.init(this);
|
|
|
|
startupLog();
|
|
|
|
this.getCommand("essence").setExecutor(new CommandMythicEssence());
|
|
getServer().getPluginManager().registerEvents(new MythicListener(), this);
|
|
}
|
|
|
|
@Override
|
|
public void onDisable() {
|
|
getLogger().info("onDisable is called!");
|
|
}
|
|
|
|
// Helpers
|
|
private void startupLog() {
|
|
// Log which directory we are scanning for mythic JSON files
|
|
File mythicDir = new File(getDataFolder(), "mythic-items/");
|
|
getLogger().info("Scanning for mythics in: " + mythicDir.getPath());
|
|
|
|
List<MythicItem> mythics = MythicItem.getMythics();
|
|
getLogger().info("Found " + mythics.size() + " mythic item(s).");
|
|
|
|
for (MythicItem mythic : mythics) {
|
|
ItemStack item = mythic.item;
|
|
String typeName = item.getType().name();
|
|
String displayName = item.getItemMeta() != null && item.getItemMeta().hasDisplayName()
|
|
? item.getItemMeta().getDisplayName()
|
|
: "<no custom name>";
|
|
getLogger().info(" - Mythic: material=" + typeName + ", name=" + displayName);
|
|
}
|
|
|
|
}
|
|
} |