// Path: src/me/RockinChaos/itemjoin/ItemJoin.java
// public class ItemJoin extends JavaPlugin {
// 	
//   	private static ItemJoin instance;
//   	private boolean isStarted = false;
//   	
//    /**
//     * Called when the plugin is loaded.
//     * 
//     */
//     @Override
//     public void onLoad() {
//     	instance = this;
//     }
//     
//    /**
//     * Called when the plugin is enabled.
//     * 
//     */
//   	@Override
// 	public void onEnable() {
//         ConfigHandler.getConfig().registerEvents();
//         SchedulerUtils.runAsync(() -> {
//         	UpdateHandler.getUpdater(true); {
//         		ServerUtils.logDebug("has been Enabled.");
//         	}
//         });
//   	}
//   	
//    /**
//     * Called when the plugin is disabled.
//     * 
//     */
//   	@Override
// 	public void onDisable() {
//   		Bukkit.getScheduler().cancelTasks(this);
//   		Menu.closeMenu();
//   		ItemHandler.saveCooldowns();
//   		ItemHandler.purgeCraftItems(true);
// 	  	Database.getDatabase().closeConnection(true);
// 	  	ProtocolManager.closeProtocol();
// 	  	ItemUtilities.getUtilities().clearItems();
//   		ServerUtils.logDebug("has been Disabled.");
//   	}
//   	
//    /**
// 	* Checks if the plugin has fully loaded.
// 	* 
// 	*/
// 	public boolean isStarted() {
// 		return this.isStarted;
// 	}
// 	
//    /**
// 	* Sets the plugin as fully loaded.
// 	* 
// 	*/
// 	public void setStarted(final boolean bool) {
// 		this.isStarted = bool;
// 	}
//   	
//    /**
//     * Gets the Plugin File.
//     * 
//     * @return The Plugin File.
//     */
//   	public File getPlugin() {
//   		return this.getFile();
//   	}
// 
//    /**
//     * Gets the static instance of the main class for ItemJoin. 
//     * Notice: This class is not the actual API class, this is the main class that extends JavaPlugin. 
//     * For API methods, use the static methods available from the class: {@link ItemJoinAPI}.
//     *
//     * @return ItemJoin instance.
//     */  	
//   	public static ItemJoin getInstance() {
//   		return instance;
//   	}
// }


import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
import me.RockinChaos.itemjoin.ItemJoin;
/*
 * ItemJoin
 * Copyright (C) CraftationGaming <https://www.craftationgaming.com/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package me.RockinChaos.itemjoin.utils;



public class SchedulerUtils {
	
	private static List < Runnable > SINGLE_QUEUE = new ArrayList < Runnable > ();
	private static Boolean SINGLE_ACTIVE = false;

   /**
    * Runs the task on the main thread
    * @param runnable - The task to be performed.
    */
    public static void run(final Runnable runnable){
// Path: src/me/RockinChaos/itemjoin/ItemJoin.java
// public class ItemJoin extends JavaPlugin {
// 	
//   	private static ItemJoin instance;
//   	private boolean isStarted = false;
//   	
//    /**
//     * Called when the plugin is loaded.
//     * 
//     */
//     @Override
//     public void onLoad() {
//     	instance = this;
//     }
//     
//    /**
//     * Called when the plugin is enabled.
//     * 
//     */
//   	@Override
// 	public void onEnable() {
//         ConfigHandler.getConfig().registerEvents();
//         SchedulerUtils.runAsync(() -> {
//         	UpdateHandler.getUpdater(true); {
//         		ServerUtils.logDebug("has been Enabled.");
//         	}
//         });
//   	}
//   	
//    /**
//     * Called when the plugin is disabled.
//     * 
//     */
//   	@Override
// 	public void onDisable() {
//   		Bukkit.getScheduler().cancelTasks(this);
//   		Menu.closeMenu();
//   		ItemHandler.saveCooldowns();
//   		ItemHandler.purgeCraftItems(true);
// 	  	Database.getDatabase().closeConnection(true);
// 	  	ProtocolManager.closeProtocol();
// 	  	ItemUtilities.getUtilities().clearItems();
//   		ServerUtils.logDebug("has been Disabled.");
//   	}
//   	
//    /**
// 	* Checks if the plugin has fully loaded.
// 	* 
// 	*/
// 	public boolean isStarted() {
// 		return this.isStarted;
// 	}
// 	
//    /**
// 	* Sets the plugin as fully loaded.
// 	* 
// 	*/
// 	public void setStarted(final boolean bool) {
// 		this.isStarted = bool;
// 	}
//   	
//    /**
//     * Gets the Plugin File.
//     * 
//     * @return The Plugin File.
//     */
//   	public File getPlugin() {
//   		return this.getFile();
//   	}
// 
//    /**
//     * Gets the static instance of the main class for ItemJoin. 
//     * Notice: This class is not the actual API class, this is the main class that extends JavaPlugin. 
//     * For API methods, use the static methods available from the class: {@link ItemJoinAPI}.
//     *
//     * @return ItemJoin instance.
//     */  	
//   	public static ItemJoin getInstance() {
//   		return instance;
//   	}
// }


// Path: src/me/RockinChaos/itemjoin/utils/SchedulerUtils.java
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
import me.RockinChaos.itemjoin.ItemJoin;

/*
 * ItemJoin
 * Copyright (C) CraftationGaming <https://www.craftationgaming.com/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package me.RockinChaos.itemjoin.utils;



public class SchedulerUtils {
	
	private static List < Runnable > SINGLE_QUEUE = new ArrayList < Runnable > ();
	private static Boolean SINGLE_ACTIVE = false;

   /**
    * Runs the task on the main thread
    * @param runnable - The task to be performed.
    */
    public static void run(final Runnable runnable){
    	if (ItemJoin.getInstance().isEnabled()) {