Search in sources :

Example 1 with EntryKey

use of com.loohp.interactionvisualizer.objectholders.EntryKey in project InteractionVisualizer by LOOHP.

the class Database method setBitIndex.

public static void setBitIndex(Map<Integer, EntryKey> index) {
    synchronized (syncdb) {
        open();
        try {
            for (Entry<Integer, EntryKey> entry : index.entrySet()) {
                PreparedStatement statement = getConnection().prepareStatement("SELECT * FROM " + indexMappingTable + " WHERE ENTRY=?");
                statement.setString(1, entry.getValue().toString());
                ResultSet results = statement.executeQuery();
                if (results.next()) {
                    PreparedStatement statement1 = getConnection().prepareStatement("UPDATE " + indexMappingTable + " SET BITMASK_INDEX=? WHERE ENTRY=?");
                    statement1.setInt(1, entry.getKey());
                    statement1.setString(2, entry.getValue().toString());
                    statement1.executeUpdate();
                } else {
                    PreparedStatement insert = getConnection().prepareStatement("INSERT INTO " + indexMappingTable + " (BITMASK_INDEX,ENTRY) VALUES (?,?)");
                    insert.setInt(1, entry.getKey());
                    insert.setString(2, entry.getValue().toString());
                    insert.executeUpdate();
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        try {
            connection.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
Also used : EntryKey(com.loohp.interactionvisualizer.objectholders.EntryKey) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 2 with EntryKey

use of com.loohp.interactionvisualizer.objectholders.EntryKey in project InteractionVisualizer by LOOHP.

the class PreferenceManager method registerEntry.

public void registerEntry(EntryKey[] entryKeys) {
    if (entryKeys.length > 0) {
        synchronized (entries) {
            try {
                Awaitility.await().atMost(30, TimeUnit.SECONDS).pollInterval(500, TimeUnit.MILLISECONDS).pollDelay(0, TimeUnit.MILLISECONDS).until(() -> !Database.isLocked());
            } catch (ConditionTimeoutException e) {
                Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "Tried to save player preference but database is locked for more than 30 seconds, performing save anyway...");
            }
            Database.setLocked(true);
            List<EntryKey> updatedEntries = ArrayUtils.putToArrayList(Database.getBitIndex(), new ArrayList<>());
            entries.clear();
            entries.addAll(updatedEntries);
            boolean changes = false;
            for (EntryKey entry : entryKeys) {
                if (!entries.contains(entry)) {
                    changes = true;
                    entries.add(entry);
                }
            }
            if (changes) {
                Database.setBitIndex(ArrayUtils.putToMap(entries, new HashMap<>()));
            }
            Database.setLocked(false);
        }
    }
}
Also used : EntryKey(com.loohp.interactionvisualizer.objectholders.EntryKey) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConditionTimeoutException(org.awaitility.core.ConditionTimeoutException)

Example 3 with EntryKey

use of com.loohp.interactionvisualizer.objectholders.EntryKey in project InteractionVisualizer by LOOHP.

the class PreferenceManager method getPlayerPreferences.

public Map<Modules, Map<EntryKey, Boolean>> getPlayerPreferences(UUID uuid) {
    Map<Modules, Map<EntryKey, Boolean>> preferences = new HashMap<>();
    for (Modules module : Modules.values()) {
        Map<EntryKey, Boolean> entryPreference = new HashMap<>();
        for (EntryKey entry : getRegisteredEntries()) {
            entryPreference.put(entry, getPlayerPreference(uuid, module, entry));
        }
        preferences.put(module, entryPreference);
    }
    return preferences;
}
Also used : EntryKey(com.loohp.interactionvisualizer.objectholders.EntryKey) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Modules(com.loohp.interactionvisualizer.api.InteractionVisualizerAPI.Modules) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 4 with EntryKey

use of com.loohp.interactionvisualizer.objectholders.EntryKey in project InteractionVisualizer by LOOHP.

the class Charts method registerCharts.

public static void registerCharts(Metrics metrics) {
    metrics.addCustomChart(new Metrics.SimplePie("line_of_sight_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.hideIfObstructed) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("anvil_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Anvil.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("banner_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Banner.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("barrel_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Barrel.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("beacon_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Beacon.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("beehive_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.BeeHive.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("beenest_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.BeeNest.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("blastfurnace_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.BlastFurnace.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("brewingstand_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.BrewingStand.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("campfire_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Campfire.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("cartographytable_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.CartographyTable.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("chest_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Chest.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("conduit_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Conduit.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("craftingtable_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.CraftingTable.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("dispenser_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Dispenser.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("doublechest_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.DoubleChest.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("dropper_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Dropper.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("enchantmenttable_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.EnchantmentTable.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("enderchest_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.EnderChest.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("furnace_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Furnace.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("grindstone_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Grindstone.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("hopper_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Hopper.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("lectern_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Lectern.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("loom_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Loom.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("shulkerbox_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.ShulkerBox.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("smithingtable_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.SmithingTable.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("smoker_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Smoker.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("soulcampfire_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.SoulCampfire.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("spawner_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Spawner.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("stonecutter_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.Stonecutter.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("noteblock_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.NoteBlock.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("jukebox_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Blocks.JukeBox.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("item_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Entities.Item.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    metrics.addCustomChart(new Metrics.SimplePie("villager_enabled", new Callable<String>() {

        @Override
        public String call() throws Exception {
            String string = "Disabled";
            if (InteractionVisualizer.plugin.getConfiguration().getBoolean("Entities.Villager.Enabled")) {
                string = "Enabled";
            }
            return string;
        }
    }));
    // ----
    metrics.addCustomChart(new Metrics.SingleLineChart("total_tile_entities_in_range_visualizing", new Callable<Integer>() {

        @Override
        public Integer call() throws Exception {
            int total = 0;
            for (TileEntityType type : TileEntityType.values()) {
                total += TileEntityManager.getTileEntites(type).size();
            }
            return total;
        }
    }));
    metrics.addCustomChart(new Metrics.DrilldownPie("visualizer_displays_from_addons", new Callable<Map<String, Map<String, Integer>>>() {

        @Override
        public Map<String, Map<String, Integer>> call() throws Exception {
            Map<String, Map<String, Integer>> map = new HashMap<>();
            for (EntryKey entryKey : InteractionVisualizerAPI.getRegisteredEntries()) {
                if (!entryKey.isNative()) {
                    Map<String, Integer> entry = map.get(entryKey.getNamespace());
                    if (entry == null) {
                        map.put(entryKey.getNamespace(), entry = new HashMap<>());
                    }
                    Integer value = entry.get(entryKey.getKey());
                    if (value == null) {
                        entry.put(entryKey.getKey(), 1);
                    } else {
                        entry.put(entryKey.getKey(), value + 1);
                    }
                }
            }
            return map;
        }
    }));
}
Also used : EntryKey(com.loohp.interactionvisualizer.objectholders.EntryKey) HashMap(java.util.HashMap) Callable(java.util.concurrent.Callable) TileEntityType(com.loohp.interactionvisualizer.objectholders.TileEntity.TileEntityType) Map(java.util.Map) HashMap(java.util.HashMap)

Example 5 with EntryKey

use of com.loohp.interactionvisualizer.objectholders.EntryKey in project InteractionVisualizer by LOOHP.

the class TaskManager method setup.

@SuppressWarnings("deprecation")
public static void setup() {
    anvil = false;
    banner = false;
    barrel = false;
    beacon = false;
    beehive = false;
    beenest = false;
    blastfurnace = false;
    brewingstand = false;
    campfire = false;
    cartographytable = false;
    chest = false;
    conduit = false;
    craftingtable = false;
    dispenser = false;
    doublechest = false;
    dropper = false;
    enchantmenttable = false;
    enderchest = false;
    furnace = false;
    grindstone = false;
    hopper = false;
    jukebox = false;
    lectern = false;
    loom = false;
    noteblock = false;
    shulkerbox = false;
    smoker = false;
    soulcampfire = false;
    spawner = false;
    stonecutter = false;
    smithingtable = false;
    item = false;
    villager = false;
    version = InteractionVisualizer.version;
    /*
		HandlerList.unregisterAll(plugin);
		for (int taskid : tasks) {
			Bukkit.getScheduler().cancelTask(taskid);
		}
		tasks.clear();
		*/
    List<EntryKey> keys = new ArrayList<>();
    Bukkit.getPluginManager().registerEvents(new Debug(), plugin);
    Bukkit.getPluginManager().registerEvents(new Updater(), plugin);
    Bukkit.getPluginManager().registerEvents(new com.loohp.interactionvisualizer.listeners.Events(), plugin);
    Bukkit.getPluginManager().registerEvents(new PacketManager(), plugin);
    if (version.isLegacy()) {
        ChunkEvents.setup();
        InteractionVisualizer.getDefaultWorld().getChunkAt(0, 0).load();
        Bukkit.getPluginManager().registerEvents(new ChunkEvents(), plugin);
    }
    for (InventoryType type : InventoryType.values()) {
        processes.put(type, new ArrayList<VisualizerInteractDisplay>());
    }
    if (getConfig().getBoolean("Blocks.CraftingTable.Enabled")) {
        CraftingTableDisplay ctd = new CraftingTableDisplay();
        keys.add(ctd.registerNative(InventoryType.WORKBENCH));
        Bukkit.getPluginManager().registerEvents(ctd, plugin);
        craftingtable = true;
    }
    if (getConfig().getBoolean("Blocks.Loom.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        LoomDisplay ld = new LoomDisplay();
        keys.add(ld.registerNative(InventoryType.LOOM));
        Bukkit.getPluginManager().registerEvents(ld, plugin);
        loom = true;
    }
    if (getConfig().getBoolean("Blocks.EnchantmentTable.Enabled")) {
        EnchantmentTableDisplay etd = new EnchantmentTableDisplay();
        keys.add(etd.registerNative(InventoryType.ENCHANTING));
        Bukkit.getPluginManager().registerEvents(etd, plugin);
        enchantmenttable = true;
    }
    if (getConfig().getBoolean("Blocks.CartographyTable.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        CartographyTableDisplay ctd = new CartographyTableDisplay();
        keys.add(ctd.registerNative(InventoryType.CARTOGRAPHY));
        Bukkit.getPluginManager().registerEvents(ctd, plugin);
        cartographytable = true;
    }
    if (getConfig().getBoolean("Blocks.Anvil.Enabled")) {
        AnvilDisplay ad = new AnvilDisplay();
        keys.add(ad.registerNative(InventoryType.ANVIL));
        Bukkit.getPluginManager().registerEvents(ad, plugin);
        anvil = true;
    }
    if (getConfig().getBoolean("Blocks.Grindstone.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        GrindstoneDisplay gd = new GrindstoneDisplay();
        keys.add(gd.registerNative(InventoryType.GRINDSTONE));
        Bukkit.getPluginManager().registerEvents(gd, plugin);
        grindstone = true;
    }
    if (getConfig().getBoolean("Blocks.Stonecutter.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        StonecutterDisplay sd = new StonecutterDisplay();
        keys.add(sd.registerNative(InventoryType.STONECUTTER));
        Bukkit.getPluginManager().registerEvents(sd, plugin);
        stonecutter = true;
    }
    if (getConfig().getBoolean("Blocks.BrewingStand.Enabled")) {
        BrewingStandDisplay bsd = new BrewingStandDisplay();
        keys.add(bsd.registerNative());
        Bukkit.getPluginManager().registerEvents(bsd, plugin);
        brewingstand = true;
    }
    if (getConfig().getBoolean("Blocks.Chest.Enabled")) {
        ChestDisplay cd = new ChestDisplay();
        keys.add(cd.registerNative());
        Bukkit.getPluginManager().registerEvents(cd, plugin);
        chest = true;
    }
    if (getConfig().getBoolean("Blocks.DoubleChest.Enabled")) {
        DoubleChestDisplay dcd = new DoubleChestDisplay();
        keys.add(dcd.registerNative());
        Bukkit.getPluginManager().registerEvents(dcd, plugin);
        doublechest = true;
    }
    if (getConfig().getBoolean("Blocks.Furnace.Enabled")) {
        FurnaceDisplay fd = new FurnaceDisplay();
        keys.add(fd.registerNative());
        Bukkit.getPluginManager().registerEvents(fd, plugin);
        furnace = true;
    }
    if (getConfig().getBoolean("Blocks.BlastFurnace.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        BlastFurnaceDisplay bfd = new BlastFurnaceDisplay();
        keys.add(bfd.registerNative());
        Bukkit.getPluginManager().registerEvents(bfd, plugin);
        blastfurnace = true;
    }
    if (getConfig().getBoolean("Blocks.Smoker.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        SmokerDisplay sd = new SmokerDisplay();
        keys.add(sd.registerNative());
        Bukkit.getPluginManager().registerEvents(sd, plugin);
        smoker = true;
    }
    if (getConfig().getBoolean("Blocks.EnderChest.Enabled")) {
        EnderchestDisplay ed = new EnderchestDisplay();
        keys.add(ed.registerNative());
        Bukkit.getPluginManager().registerEvents(ed, plugin);
        enderchest = true;
    }
    if (getConfig().getBoolean("Blocks.ShulkerBox.Enabled") && (!version.isOld())) {
        ShulkerBoxDisplay sbd = new ShulkerBoxDisplay();
        keys.add(sbd.registerNative());
        Bukkit.getPluginManager().registerEvents(sbd, plugin);
        shulkerbox = true;
    }
    if (getConfig().getBoolean("Blocks.Dispenser.Enabled")) {
        DispenserDisplay dd = new DispenserDisplay();
        keys.add(dd.registerNative());
        Bukkit.getPluginManager().registerEvents(dd, plugin);
        dispenser = true;
    }
    if (getConfig().getBoolean("Blocks.Dropper.Enabled")) {
        DropperDisplay dd = new DropperDisplay();
        keys.add(dd.registerNative());
        Bukkit.getPluginManager().registerEvents(dd, plugin);
        dropper = true;
    }
    if (getConfig().getBoolean("Blocks.Hopper.Enabled")) {
        HopperDisplay hd = new HopperDisplay();
        keys.add(hd.registerNative());
        Bukkit.getPluginManager().registerEvents(hd, plugin);
        hopper = true;
    }
    if (getConfig().getBoolean("Blocks.Beacon.Enabled")) {
        BeaconDisplay bd = new BeaconDisplay();
        keys.add(bd.registerNative());
        Bukkit.getPluginManager().registerEvents(bd, plugin);
        beacon = true;
    }
    if (getConfig().getBoolean("Blocks.NoteBlock.Enabled")) {
        NoteBlockDisplay nbd = new NoteBlockDisplay();
        keys.add(nbd.registerNative());
        Bukkit.getPluginManager().registerEvents(nbd, plugin);
        noteblock = true;
    }
    if (getConfig().getBoolean("Blocks.JukeBox.Enabled")) {
        JukeBoxDisplay jbd = new JukeBoxDisplay();
        keys.add(jbd.registerNative());
        Bukkit.getPluginManager().registerEvents(jbd, plugin);
        jukebox = true;
    }
    if (getConfig().getBoolean("Blocks.SmithingTable.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_16)) {
        SmithingTableDisplay std = new SmithingTableDisplay();
        keys.add(std.registerNative(InventoryType.SMITHING));
        Bukkit.getPluginManager().registerEvents(std, plugin);
        smithingtable = true;
    }
    if (getConfig().getBoolean("Blocks.BeeNest.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_15)) {
        BeeNestDisplay bnd = new BeeNestDisplay();
        keys.add(bnd.registerNative());
        Bukkit.getPluginManager().registerEvents(bnd, plugin);
        beenest = true;
    }
    if (getConfig().getBoolean("Blocks.BeeHive.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_15)) {
        BeeHiveDisplay bhd = new BeeHiveDisplay();
        keys.add(bhd.registerNative());
        Bukkit.getPluginManager().registerEvents(bhd, plugin);
        beehive = true;
    }
    if (getConfig().getBoolean("Blocks.Lectern.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        LecternDisplay ld = new LecternDisplay();
        keys.add(ld.registerNative());
        Bukkit.getPluginManager().registerEvents(ld, plugin);
        lectern = true;
    }
    if (getConfig().getBoolean("Blocks.Campfire.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        CampfireDisplay cd = new CampfireDisplay();
        keys.add(cd.registerNative());
        Bukkit.getPluginManager().registerEvents(cd, plugin);
        campfire = true;
    }
    if (getConfig().getBoolean("Blocks.SoulCampfire.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_16)) {
        SoulCampfireDisplay scd = new SoulCampfireDisplay();
        keys.add(scd.registerNative());
        Bukkit.getPluginManager().registerEvents(scd, plugin);
        soulcampfire = true;
    }
    if (getConfig().getBoolean("Blocks.Spawner.Enabled")) {
        SpawnerDisplay sd = new SpawnerDisplay();
        keys.add(sd.registerNative());
        Bukkit.getPluginManager().registerEvents(sd, plugin);
        spawner = true;
    }
    if (getConfig().getBoolean("Blocks.Conduit.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_13)) {
        ConduitDisplay cd = new ConduitDisplay();
        keys.add(cd.registerNative());
        Bukkit.getPluginManager().registerEvents(cd, plugin);
        conduit = true;
    }
    if (getConfig().getBoolean("Blocks.Banner.Enabled")) {
        BannerDisplay bd = new BannerDisplay();
        keys.add(bd.registerNative());
        Bukkit.getPluginManager().registerEvents(bd, plugin);
        banner = true;
    }
    if (getConfig().getBoolean("Blocks.Barrel.Enabled") && version.isNewerOrEqualTo(MCVersion.V1_14)) {
        BarrelDisplay bd = new BarrelDisplay();
        keys.add(bd.registerNative());
        Bukkit.getPluginManager().registerEvents(bd, plugin);
        barrel = true;
    }
    if (getConfig().getBoolean("Entities.Item.Enabled")) {
        ItemDisplay id = new ItemDisplay();
        keys.add(id.registerNative());
        Bukkit.getPluginManager().registerEvents(id, plugin);
        item = true;
    }
    if (getConfig().getBoolean("Entities.Villager.Enabled")) {
        VillagerDisplay vd = new VillagerDisplay();
        keys.add(vd.registerNative());
        Bukkit.getPluginManager().registerEvents(vd, plugin);
        villager = true;
    }
    InteractionVisualizer.preferenceManager.registerEntry(keys.toArray(new EntryKey[keys.size()]));
    InteractionVisualizer.lightManager.run();
    PacketManager.update();
}
Also used : VillagerDisplay(com.loohp.interactionvisualizer.entities.VillagerDisplay) DispenserDisplay(com.loohp.interactionvisualizer.blocks.DispenserDisplay) LecternDisplay(com.loohp.interactionvisualizer.blocks.LecternDisplay) DoubleChestDisplay(com.loohp.interactionvisualizer.blocks.DoubleChestDisplay) ShulkerBoxDisplay(com.loohp.interactionvisualizer.blocks.ShulkerBoxDisplay) ArrayList(java.util.ArrayList) BeaconDisplay(com.loohp.interactionvisualizer.blocks.BeaconDisplay) BeeNestDisplay(com.loohp.interactionvisualizer.blocks.BeeNestDisplay) StonecutterDisplay(com.loohp.interactionvisualizer.blocks.StonecutterDisplay) ConduitDisplay(com.loohp.interactionvisualizer.blocks.ConduitDisplay) FurnaceDisplay(com.loohp.interactionvisualizer.blocks.FurnaceDisplay) BlastFurnaceDisplay(com.loohp.interactionvisualizer.blocks.BlastFurnaceDisplay) SoulCampfireDisplay(com.loohp.interactionvisualizer.blocks.SoulCampfireDisplay) CampfireDisplay(com.loohp.interactionvisualizer.blocks.CampfireDisplay) Updater(com.loohp.interactionvisualizer.updater.Updater) SpawnerDisplay(com.loohp.interactionvisualizer.blocks.SpawnerDisplay) EnderchestDisplay(com.loohp.interactionvisualizer.blocks.EnderchestDisplay) BeeHiveDisplay(com.loohp.interactionvisualizer.blocks.BeeHiveDisplay) BannerDisplay(com.loohp.interactionvisualizer.blocks.BannerDisplay) Debug(com.loohp.interactionvisualizer.debug.Debug) AnvilDisplay(com.loohp.interactionvisualizer.blocks.AnvilDisplay) EnchantmentTableDisplay(com.loohp.interactionvisualizer.blocks.EnchantmentTableDisplay) EntryKey(com.loohp.interactionvisualizer.objectholders.EntryKey) SmokerDisplay(com.loohp.interactionvisualizer.blocks.SmokerDisplay) JukeBoxDisplay(com.loohp.interactionvisualizer.blocks.JukeBoxDisplay) BarrelDisplay(com.loohp.interactionvisualizer.blocks.BarrelDisplay) InventoryType(org.bukkit.event.inventory.InventoryType) ChestDisplay(com.loohp.interactionvisualizer.blocks.ChestDisplay) DoubleChestDisplay(com.loohp.interactionvisualizer.blocks.DoubleChestDisplay) ChunkEvents(com.loohp.interactionvisualizer.listeners.ChunkEvents) LoomDisplay(com.loohp.interactionvisualizer.blocks.LoomDisplay) DropperDisplay(com.loohp.interactionvisualizer.blocks.DropperDisplay) SmithingTableDisplay(com.loohp.interactionvisualizer.blocks.SmithingTableDisplay) BrewingStandDisplay(com.loohp.interactionvisualizer.blocks.BrewingStandDisplay) BlastFurnaceDisplay(com.loohp.interactionvisualizer.blocks.BlastFurnaceDisplay) CartographyTableDisplay(com.loohp.interactionvisualizer.blocks.CartographyTableDisplay) ItemDisplay(com.loohp.interactionvisualizer.entities.ItemDisplay) VisualizerInteractDisplay(com.loohp.interactionvisualizer.api.VisualizerInteractDisplay) SoulCampfireDisplay(com.loohp.interactionvisualizer.blocks.SoulCampfireDisplay) CraftingTableDisplay(com.loohp.interactionvisualizer.blocks.CraftingTableDisplay) GrindstoneDisplay(com.loohp.interactionvisualizer.blocks.GrindstoneDisplay) HopperDisplay(com.loohp.interactionvisualizer.blocks.HopperDisplay) NoteBlockDisplay(com.loohp.interactionvisualizer.blocks.NoteBlockDisplay)

Aggregations

EntryKey (com.loohp.interactionvisualizer.objectholders.EntryKey)8 HashMap (java.util.HashMap)3 Modules (com.loohp.interactionvisualizer.api.InteractionVisualizerAPI.Modules)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 VisualizerInteractDisplay (com.loohp.interactionvisualizer.api.VisualizerInteractDisplay)1 InteractionVisualizerReloadEvent (com.loohp.interactionvisualizer.api.events.InteractionVisualizerReloadEvent)1 AnvilDisplay (com.loohp.interactionvisualizer.blocks.AnvilDisplay)1 BannerDisplay (com.loohp.interactionvisualizer.blocks.BannerDisplay)1 BarrelDisplay (com.loohp.interactionvisualizer.blocks.BarrelDisplay)1 BeaconDisplay (com.loohp.interactionvisualizer.blocks.BeaconDisplay)1 BeeHiveDisplay (com.loohp.interactionvisualizer.blocks.BeeHiveDisplay)1 BeeNestDisplay (com.loohp.interactionvisualizer.blocks.BeeNestDisplay)1 BlastFurnaceDisplay (com.loohp.interactionvisualizer.blocks.BlastFurnaceDisplay)1 BrewingStandDisplay (com.loohp.interactionvisualizer.blocks.BrewingStandDisplay)1 CampfireDisplay (com.loohp.interactionvisualizer.blocks.CampfireDisplay)1 CartographyTableDisplay (com.loohp.interactionvisualizer.blocks.CartographyTableDisplay)1 ChestDisplay (com.loohp.interactionvisualizer.blocks.ChestDisplay)1 ConduitDisplay (com.loohp.interactionvisualizer.blocks.ConduitDisplay)1 CraftingTableDisplay (com.loohp.interactionvisualizer.blocks.CraftingTableDisplay)1