spigot-plugin-template/load_plugin.py
Harrison Deng 81bc122ae0 Removed script folder.
Better accomodates for use as git submodule.
2022-01-20 04:16:56 -06:00

26 lines
824 B
Python

import os
import xml.etree.ElementTree as ET
import shutil
import gen
if (os.getcwd().endswith("scripts/")):
os.chdir("../")
pomxml = ET.parse(gen.find_pomxml())
pomroot = pomxml.getroot()
projname = pomroot.find("{" + gen.POM_NAMESPACE + "}" + "name").text
pluginver = pomroot.find("{" + gen.POM_NAMESPACE + "}" + "version").text
pluginfilename = projname + "-" + pluginver + ".jar"
plugindir = gen.DEV_SERVER_PATH + "plugins/";
if not os.path.exists(plugindir):
os.mkdir(plugindir)
pluginpath = gen.find_pomxmldir() + "/target/{0}".format(pluginfilename)
if not os.path.exists(pluginpath):
print("Could not find \"{0}\". Is it packaged?".format(pluginpath))
exit(1)
shutil.copy(pluginpath, plugindir + pluginfilename)
print("Copied \"{0}\" to \"{1}\".".format(pluginpath, plugindir + pluginfilename))