Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Main instance;
- private ConfigUtil pluginConfig;
- private RecipeManager recipe;
- /*private ShapedRecipe basic;
- private ShapedRecipe advanced;
- private ShapedRecipe expert;
- private ShapedRecipe remote;*/
- public static boolean usePower = false;
- public static ExodusAPIMessageUtil messageUtil;
- public static String PREFIX;
- @SuppressWarnings({ "static-access" })
- @Override
- public void onEnable() {
- messageUtil = new ExodusAPIMessageUtil();
- PREFIX = messageUtil.getPrefix;
- instance = this;
- // * load Configuration * //
- loadConfig();
- // * Load Recipes * //
- recipe.loadRecipes();
- // * Load Commands * //
- registerCommands();
- // * Load Events * //
- registerEvents();
- // * Load Database * //
- loadDataBase();
- }
- @Override
- public void onDisable() {
- ACC_DatabaseInterface.closeConnection(ACC_DatabaseInterface.getConnection());
- }
- private void registerCommands() {
- this.getCommand("createdir").setExecutor(new Command_createdir());
- this.getCommand("search").setExecutor(new Command_search());
- }
- private void registerEvents() {
- Bukkit.getPluginManager().registerEvents(new CamStorageListener(), instance);
- }
- private void loadConfig() {
- // * Create Config with Method * //
- pluginConfig = new ConfigUtil(instance, "config.yml");
- pluginConfig.saveDefaultConfig();
- // * If Statement to Energy consume ** //
- if (pluginConfig.getConfig().contains("CamStorage.energy.consume")
- && pluginConfig.getConfig().getBoolean("CamStorage.energy.consume")) {
- Plugin stb = Bukkit.getPluginManager().getPlugin("SensibleToolbox");
- if (stb != null) {
- usePower = true;
- }
- }
- }
- /*private void loadRecipe() {
- basic = new ShapedRecipe(
- new ACC_DIR(16, 16 * 128 * 4, new ArrayList<ACC_DigitisedItem>(), "CraftingItem").getItem());
- basic.shape("XYX", "YZY", "XYX");
- basic.setIngredient('X', Material.GLASS);
- basic.setIngredient('Y', Material.OBSIDIAN);
- basic.setIngredient('Z', Material.IRON_INGOT);
- Bukkit.addRecipe(basic);
- advanced = new ShapedRecipe(
- new ACC_DIR(32, 32 * 256 * 4, new ArrayList<ACC_DigitisedItem>(), "CraftingItem").getItem());
- advanced.shape("XYX", "YZY", "XYX");
- advanced.setIngredient('X', Material.GLASS);
- advanced.setIngredient('Y', Material.OBSIDIAN);
- advanced.setIngredient('Z', Material.GOLD_INGOT);
- Bukkit.addRecipe(advanced);
- expert = new ShapedRecipe(
- new ACC_DIR(64, 64 * 512 * 4, new ArrayList<ACC_DigitisedItem>(), "CraftingItem").getItem());
- expert.shape("XYX", "YZY", "XYX");
- expert.setIngredient('X', Material.GLASS);
- expert.setIngredient('Y', Material.OBSIDIAN);
- expert.setIngredient('Z', Material.DIAMOND);
- Bukkit.addRecipe(expert);
- remote = new ShapedRecipe(new ACC_HTAD().toItemStack());
- remote.shape("DCD", "BAB", "DDD");
- remote.setIngredient('A', Material.BREWING_STAND);
- remote.setIngredient('B', Material.STONE_BUTTON);
- remote.setIngredient('C', Material.REDSTONE);
- remote.setIngredient('D', Material.IRON_INGOT);
- Bukkit.addRecipe(remote);
- }*/
- private void loadDataBase() {
- try {
- ACC_DatabaseInterface.prepareDatabase();
- } catch (SQLException ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
- }
- new BukkitRunnable() {
- @Override
- public void run() {
- try {
- ACC_DatabaseInterface.getConnection().commit();
- } catch (SQLException ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }.runTaskTimerAsynchronously(this, 0, 200);
- }
- @Override
- public File getFile() {
- return super.getFile();
- }
- public static Main getInstance() {
- return instance;
- }
- public ConfigUtil getConfigManager() {
- return pluginConfig;
- }
- public static <T> List<List<T>> chopped(List<T> list, final int L) {
- List<List<T>> parts = new ArrayList<>();
- final int N = list.size();
- for (int i = 0; i < N; i += L) {
- parts.add(new ArrayList<>(list.subList(i, Math.min(N, i + L))));
- }
- return parts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement