package com.zerohighdef.hush; import com.zerohighdef.hush.commands.MainCommand; import com.zerohighdef.hush.listeners.HushAsyncChatListener; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.plugin.java.JavaPlugin; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.logging.Logger; public final class Hush extends JavaPlugin { private final Logger log = Logger.getLogger("Minecraft"); private HashMap> watchLists; @Override public void onEnable() { saveDefaultConfig(); reloadConfig(); if (isEnabled()) { new HushAsyncChatListener(this); new MainCommand(this); } } @Override public void reloadConfig() { super.reloadConfig(); buildWatchLists(); } private void buildWatchLists() { watchLists = new HashMap<>(); ConfigurationSection watchListSection = getConfig().getConfigurationSection("watch_lists"); for (String permission: watchListSection.getKeys(false)) { ConfigurationSection permissionSection = watchListSection.getConfigurationSection(permission); LinkedList watchCategories = new LinkedList<>(); for (String category: permissionSection.getKeys(false)) { ConfigurationSection categorySection = permissionSection.getConfigurationSection(category); List filters = categorySection.getStringList("filters"); List commands = categorySection.getStringList("commands"); watchCategories.add(new WatchCategory(category, filters, commands)); } watchLists.put(permission, watchCategories); } } public void log(String message) { log.info( "[Hush]: " + message ); } public Map> getWatchLists() { return watchLists; } }