From 072efc5cf585835c2c5a82c5a1321a1620a21559 Mon Sep 17 00:00:00 2001 From: Silke pilon Date: Fri, 1 Dec 2023 21:49:03 +0100 Subject: [PATCH] Update plugin cloning and directory structure --- lodestone/__init__.py | 20 ++++++++++++++++++-- lodestone/bot.py | 17 ----------------- pyproject.toml | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lodestone/__init__.py b/lodestone/__init__.py index ac30f19..2531fae 100644 --- a/lodestone/__init__.py +++ b/lodestone/__init__.py @@ -1,4 +1,6 @@ import os +import shutil +import git if os.path.isdir('plugins'): try: @@ -6,8 +8,22 @@ except: from .plugins import Base as plugins else: - import lodestone - lodestone.bot.get_plugins() + if os.path.isdir('plugins'): + shutil.rmtree('plugins') + git.Repo.clone_from("https://github.com/the-lodestone-project/Plugins", "plugins") + try: + source_dir = 'plugins/plugins' + target_dir = 'plugins' + + file_names = os.listdir(source_dir) + + for file_name in file_names: + shutil.move(os.path.join(source_dir, file_name), target_dir) + + shutil.rmtree('plugins/plugins') + except: + logger.warning("Plugins folder is empty!") + pass try: from lodestone.plugins import Base as plugins except: diff --git a/lodestone/bot.py b/lodestone/bot.py index d5308f9..38def26 100644 --- a/lodestone/bot.py +++ b/lodestone/bot.py @@ -1204,23 +1204,6 @@ def placeBlock(self, referenceBlock, faceVector, no_checks=False): else: self.placeBlockWithOptions(referenceBlock, faceVector, { "swingArm": "right" }) -def get_plugins(): - if os.path.isdir('plugins'): - shutil.rmtree('plugins') - git.Repo.clone_from("https://github.com/the-lodestone-project/Plugins", "plugins") - try: - source_dir = 'plugins/plugins' - target_dir = 'plugins' - - file_names = os.listdir(source_dir) - - for file_name in file_names: - shutil.move(os.path.join(source_dir, file_name), target_dir) - - shutil.rmtree('plugins/plugins') - except: - logger.warning("Plugins folder is empty!") - pass diff --git a/pyproject.toml b/pyproject.toml index afdff16..49d39bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lodestone" -version = "0.0.51" +version = "0.0.52" description = "🤖 Create Minecraft bots with a powerful, stable, and high level Python API." authors = [ { name = "Silke Pilon", email = "silkepilon2009@gmail.com" },