Search in sources :

Example 1 with ItemDisplay

use of com.loohp.interactionvisualizer.entities.ItemDisplay 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

VisualizerInteractDisplay (com.loohp.interactionvisualizer.api.VisualizerInteractDisplay)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 DispenserDisplay (com.loohp.interactionvisualizer.blocks.DispenserDisplay)1 DoubleChestDisplay (com.loohp.interactionvisualizer.blocks.DoubleChestDisplay)1 DropperDisplay (com.loohp.interactionvisualizer.blocks.DropperDisplay)1 EnchantmentTableDisplay (com.loohp.interactionvisualizer.blocks.EnchantmentTableDisplay)1 EnderchestDisplay (com.loohp.interactionvisualizer.blocks.EnderchestDisplay)1 FurnaceDisplay (com.loohp.interactionvisualizer.blocks.FurnaceDisplay)1