Removed everything and added scripts to generate workspace.
Also updated gitignore.
This commit is contained in:
parent
b34638d21e
commit
b1afcacbca
246
.gitignore
vendored
246
.gitignore
vendored
@ -1,132 +1,166 @@
|
|||||||
|
|
||||||
# Created by https://www.gitignore.io/api/java,maven,eclipse,visualstudiocode
|
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,python
|
||||||
# Edit at https://www.gitignore.io/?templates=java,maven,eclipse,visualstudiocode
|
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,python
|
||||||
|
|
||||||
### Eclipse ###
|
### Python ###
|
||||||
.metadata
|
# Byte-compiled / optimized / DLL files
|
||||||
bin/
|
__pycache__/
|
||||||
tmp/
|
*.py[cod]
|
||||||
*.tmp
|
*$py.class
|
||||||
*.bak
|
|
||||||
*.swp
|
|
||||||
*~.nib
|
|
||||||
local.properties
|
|
||||||
.settings/
|
|
||||||
.loadpath
|
|
||||||
.recommenders
|
|
||||||
|
|
||||||
# External tool builders
|
# C extensions
|
||||||
.externalToolBuilders/
|
*.so
|
||||||
|
|
||||||
# Locally stored "Eclipse launch configurations"
|
# Distribution / packaging
|
||||||
*.launch
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
pip-wheel-metadata/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
# PyDev specific (Python IDE for Eclipse)
|
# PyInstaller
|
||||||
*.pydevproject
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
# CDT-specific (C/C++ Development Tooling)
|
# Installer logs
|
||||||
.cproject
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
# CDT- autotools
|
# Unit test / coverage reports
|
||||||
.autotools
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
pytestdebug.log
|
||||||
|
|
||||||
# Java annotation processor (APT)
|
# Translations
|
||||||
.factorypath
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
# PDT-specific (PHP Development Tools)
|
# Django stuff:
|
||||||
.buildpath
|
|
||||||
|
|
||||||
# sbteclipse plugin
|
|
||||||
.target
|
|
||||||
|
|
||||||
# Tern plugin
|
|
||||||
.tern-project
|
|
||||||
|
|
||||||
# TeXlipse plugin
|
|
||||||
.texlipse
|
|
||||||
|
|
||||||
# STS (Spring Tool Suite)
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
# Code Recommenders
|
|
||||||
.recommenders/
|
|
||||||
|
|
||||||
# Annotation Processing
|
|
||||||
.apt_generated/
|
|
||||||
|
|
||||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
|
||||||
.cache-main
|
|
||||||
.scala_dependencies
|
|
||||||
.worksheet
|
|
||||||
|
|
||||||
### Eclipse Patch ###
|
|
||||||
# Eclipse Core
|
|
||||||
.project
|
|
||||||
|
|
||||||
# JDT-specific (Eclipse Java Development Tools)
|
|
||||||
.classpath
|
|
||||||
|
|
||||||
# Annotation Processing
|
|
||||||
.apt_generated
|
|
||||||
|
|
||||||
.sts4-cache/
|
|
||||||
|
|
||||||
### Java ###
|
|
||||||
# Compiled class file
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Log file
|
|
||||||
*.log
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
# BlueJ files
|
# Flask stuff:
|
||||||
*.ctxt
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
# Scrapy stuff:
|
||||||
.mtj.tmp/
|
.scrapy
|
||||||
|
|
||||||
# Package Files #
|
# Sphinx documentation
|
||||||
*.jar
|
docs/_build/
|
||||||
*.war
|
doc/_build/
|
||||||
*.nar
|
|
||||||
*.ear
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
*.rar
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
# PyBuilder
|
||||||
hs_err_pid*
|
|
||||||
|
|
||||||
### Maven ###
|
|
||||||
target/
|
target/
|
||||||
pom.xml.tag
|
|
||||||
pom.xml.releaseBackup
|
# Jupyter Notebook
|
||||||
pom.xml.versionsBackup
|
.ipynb_checkpoints
|
||||||
pom.xml.next
|
|
||||||
release.properties
|
# IPython
|
||||||
dependency-reduced-pom.xml
|
profile_default/
|
||||||
buildNumber.properties
|
ipython_config.py
|
||||||
.mvn/timing.properties
|
|
||||||
.mvn/wrapper/maven-wrapper.jar
|
# pyenv
|
||||||
.flattened-pom.xml
|
.python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
# .env
|
||||||
|
.env/
|
||||||
|
.venv/
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
pythonenv*
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# operating system-related files
|
||||||
|
*.DS_Store #file properties cache/storage on macOS
|
||||||
|
Thumbs.db #thumbnail cache on Windows
|
||||||
|
|
||||||
|
# profiling data
|
||||||
|
.prof
|
||||||
|
|
||||||
|
|
||||||
### VisualStudioCode ###
|
### VisualStudioCode ###
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
*.code-workspace
|
||||||
|
|
||||||
### VisualStudioCode Patch ###
|
### VisualStudioCode Patch ###
|
||||||
# Ignore all local history of files
|
# Ignore all local history of files
|
||||||
.history
|
.history
|
||||||
|
.ionide
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/java,maven,eclipse,visualstudiocode
|
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,python
|
||||||
|
|
||||||
#Additional
|
**/buildtools/
|
||||||
local_tools
|
**/development_server
|
||||||
|
|
||||||
#Test server stuff
|
|
||||||
test-server/*
|
|
||||||
!test-server/*.ps1
|
|
||||||
!test-server/bukkit.yml
|
|
||||||
!test-server/paper-195.jar
|
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "java",
|
|
||||||
"name": "Debug (Launch) - Current File",
|
|
||||||
"request": "launch",
|
|
||||||
"mainClass": "${file}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "java",
|
|
||||||
"name": "Debug With MC Server",
|
|
||||||
"request": "attach",
|
|
||||||
"hostName": "localhost",
|
|
||||||
"port": 25566,
|
|
||||||
"sourcePaths": ["src/main/java"],
|
|
||||||
"preLaunchTask": "start test server",
|
|
||||||
"postDebugTask": "stop test server"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
78
.vscode/tasks.json
vendored
78
.vscode/tasks.json
vendored
@ -1,78 +0,0 @@
|
|||||||
{
|
|
||||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
||||||
// for the documentation about the tasks.json format
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "verify",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "mvn -B verify",
|
|
||||||
"group": "build"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "test",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "mvn -B test",
|
|
||||||
"group": "test"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "package",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "mvn package",
|
|
||||||
"group": "build"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"dependsOn": ["package"],
|
|
||||||
"label": "update test server",
|
|
||||||
"type": "shell",
|
|
||||||
"args": ["-ExecutionPolicy", "Bypass", "-File", "./load_latest_build.ps1"],
|
|
||||||
"options": {"cwd": "${workspaceFolder}/test-server/"},
|
|
||||||
"command": "powershell",
|
|
||||||
"problemMatcher": [],
|
|
||||||
"presentation": {
|
|
||||||
"echo": true,
|
|
||||||
"reveal": "silent",
|
|
||||||
"focus": false,
|
|
||||||
"panel": "shared",
|
|
||||||
"showReuseMessage": false,
|
|
||||||
"clear": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"dependsOn": ["update test server"],
|
|
||||||
"label": "start test server",
|
|
||||||
"type": "shell",
|
|
||||||
"runOptions": {"instanceLimit": 1},
|
|
||||||
"args": ["-ExecutionPolicy", "Bypass", "-File", "./start_process.ps1"],
|
|
||||||
"options": {"cwd": "${workspaceFolder}/test-server/"},
|
|
||||||
"command": "powershell",
|
|
||||||
"problemMatcher": [],
|
|
||||||
"group": "test",
|
|
||||||
"presentation": {
|
|
||||||
"echo": true,
|
|
||||||
"reveal": "silent",
|
|
||||||
"focus": false,
|
|
||||||
"panel": "shared",
|
|
||||||
"showReuseMessage": false,
|
|
||||||
"clear": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "stop test server",
|
|
||||||
"type": "shell",
|
|
||||||
"args": ["-ExecutionPolicy", "Bypass", "-File", "./end_process.ps1"],
|
|
||||||
"options": {"cwd": "${workspaceFolder}/test-server/"},
|
|
||||||
"command": "powershell",
|
|
||||||
"problemMatcher": [],
|
|
||||||
"group": "test",
|
|
||||||
"presentation": {
|
|
||||||
"echo": true,
|
|
||||||
"reveal": "silent",
|
|
||||||
"focus": false,
|
|
||||||
"panel": "shared",
|
|
||||||
"showReuseMessage": true,
|
|
||||||
"clear": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
52
pom.xml
52
pom.xml
@ -1,52 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>ca.recrown.PLUGINNAME</groupId>
|
|
||||||
<artifactId>PLUGINNAME</artifactId>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<name>PLUGINNAME</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>papermc</id>
|
|
||||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
|
||||||
<version>5.6.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.destroystokyo.paper</groupId>
|
|
||||||
<artifactId>paper-api</artifactId>
|
|
||||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.6.0</version>
|
|
||||||
<configuration>
|
|
||||||
<source>11</source>
|
|
||||||
<target>11</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.22.2</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
|
||||||
<maven.compiler.release>11</maven.compiler.release>
|
|
||||||
</properties>
|
|
||||||
</project>
|
|
177
scripts/gen.py
Normal file
177
scripts/gen.py
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
import requests
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
DEFAULT_BUKKIT_VER = "LATEST"
|
||||||
|
POM_NAMESPACE = "http://maven.apache.org/POM/4.0.0"
|
||||||
|
DEV_SERVER_PATH="development_server/"
|
||||||
|
MVN_CMD = "mvn -B archetype:generate -DgroupId={groupId} -DartifactId={artifactId} -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4";
|
||||||
|
|
||||||
|
BUILDTOOLS_URL = "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"
|
||||||
|
BUILDTOOLS_CMD = "java -jar BuildTools.jar --rev {ver}"
|
||||||
|
BUILDTOOLS_DIR = "buildtools/"
|
||||||
|
DEFAULT_SERVER_VER = "latest"
|
||||||
|
DEFAULT_JVM_DEBUG_PORT = 25577
|
||||||
|
|
||||||
|
if (os.getcwd().endswith("scripts/")):
|
||||||
|
os.chdir("../")
|
||||||
|
|
||||||
|
if sys.version_info.major != 3:
|
||||||
|
print("Script requires Python3 to run. You are currently running {0}.".format(sys.version))
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
def project_gen() -> int:
|
||||||
|
print("Generate Project:")
|
||||||
|
print("Step 1) Generate Maven project.")
|
||||||
|
|
||||||
|
groupId = input("groupId (package): xyz.reslate.")
|
||||||
|
while (len(groupId) == 0 or (not groupId.islower() and not groupId.isupper()) or (groupId.isupper())):
|
||||||
|
print("GroupId cannot be empty and must be all lowercase.")
|
||||||
|
groupId = input("groupId (package): xyz.reslate.")
|
||||||
|
|
||||||
|
artifactId = input("artifactId (name of plugin): ")
|
||||||
|
while (len(artifactId) == 0 or (not artifactId.islower() and not artifactId.isupper()) or (artifactId.isupper())):
|
||||||
|
print("artifactId cannot be empty and must be all lowercase.")
|
||||||
|
artifactId = input("artifactId (name of plugin):")
|
||||||
|
|
||||||
|
print("Executing Maven command: \"{0}\"".format(MVN_CMD.format(groupId = groupId, artifactId = artifactId)))
|
||||||
|
if (os.system(MVN_CMD.format(groupId = groupId, artifactId = artifactId)) != 0):
|
||||||
|
print("An error occurred while executing Maven step. Stopping.")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
print("Step 2) Modify pom.xml")
|
||||||
|
bukkitver = input("bukkit dependency version (default: \"{0}\"): ".format(DEFAULT_BUKKIT_VER))
|
||||||
|
if (len(bukkitver) == 0): bukkitver = DEFAULT_BUKKIT_VER
|
||||||
|
|
||||||
|
bukkitvercheck = input("Entered \"{0}\". Is this fine? (Y/n)".format(bukkitver))
|
||||||
|
if (len(bukkitvercheck) == 0): bukkitvercheck = "y"
|
||||||
|
while (bukkitvercheck.lower() != "y"):
|
||||||
|
if bukkitvercheck.lower() == "n":
|
||||||
|
bukkitver = input("bukkit dependency version (Maven Dep. Ver.): ")
|
||||||
|
bukkitvercheck = input("Entered \"{0}\". Is this fine? (Y/n)".format(bukkitver))
|
||||||
|
else:
|
||||||
|
bukkitvercheck = input("Please enter \"y\" to continue, or \"n\" to enter version again: ")
|
||||||
|
print("Using version: \"{0}\"".format(bukkitver))
|
||||||
|
|
||||||
|
pompath = "{0}/pom.xml".format(artifactId);
|
||||||
|
ET.register_namespace("", POM_NAMESPACE)
|
||||||
|
pomxml = ET.parse(pompath)
|
||||||
|
pomroot = pomxml.getroot()
|
||||||
|
|
||||||
|
repositorieselem = ET.Element("repositories")
|
||||||
|
repositoryelem = ET.SubElement(repositorieselem, "repository")
|
||||||
|
ET.SubElement(repositoryelem, "id").text = "spigot-repo"
|
||||||
|
ET.SubElement(repositoryelem, "url").text = "https://hub.spigotmc.org/nexus/content/repositories/public/"
|
||||||
|
|
||||||
|
pomroot.append(repositorieselem)
|
||||||
|
|
||||||
|
bukkitdep = ET.Element("dependency")
|
||||||
|
ET.SubElement(bukkitdep, "groupId").text = "org.bukkit"
|
||||||
|
ET.SubElement(bukkitdep, "artifactId").text = "bukkit"
|
||||||
|
ET.SubElement(bukkitdep, "version").text = bukkitver
|
||||||
|
ET.SubElement(bukkitdep, "type").text = "jar"
|
||||||
|
ET.SubElement(bukkitdep, "scope").text = "provided"
|
||||||
|
|
||||||
|
dependencies = pomroot.find("{" + POM_NAMESPACE + "}" + "dependencies")
|
||||||
|
dependencies.append(bukkitdep)
|
||||||
|
|
||||||
|
pomxml.write(pompath)
|
||||||
|
|
||||||
|
print("Step 3) Validate pom.xml")
|
||||||
|
if os.system("mvn -B validate -f {0}".format(pompath)) != 0:
|
||||||
|
print("An error has occurred. Please check output and fix issue before running again.")
|
||||||
|
return 1
|
||||||
|
print("pom.xml validated.")
|
||||||
|
|
||||||
|
print("Step 4) Resolve dependencies")
|
||||||
|
if os.system("mvn -B dependency:resolve -f {0}".format(pompath)) != 0:
|
||||||
|
print("An error has occurred. Please check output and fix issue before running again.")
|
||||||
|
return 1
|
||||||
|
print("Project generation complete.")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def gen_dev_server() -> int:
|
||||||
|
print("Generate Development Server:")
|
||||||
|
if not os.path.exists(DEV_SERVER_PATH):
|
||||||
|
os.mkdir(DEV_SERVER_PATH)
|
||||||
|
os.chdir(DEV_SERVER_PATH)
|
||||||
|
|
||||||
|
print("Step 1) Download BuildTools")
|
||||||
|
os.mkdir(BUILDTOOLS_DIR)
|
||||||
|
os.chdir(BUILDTOOLS_DIR)
|
||||||
|
|
||||||
|
buildtoolrequest = requests.get(BUILDTOOLS_URL, allow_redirects=True)
|
||||||
|
buildtoolsfile = open("BuildTools.jar", "wb")
|
||||||
|
buildtoolsfile.write(buildtoolrequest.content)
|
||||||
|
buildtoolsfile.close()
|
||||||
|
|
||||||
|
print("Step 2) Generate server JAR with BuildTools.jar")
|
||||||
|
|
||||||
|
bukkitver = input("Bukkit version to use (default: \"{0}\"): ".format(DEFAULT_SERVER_VER))
|
||||||
|
if (len(bukkitver) == 0): bukkitver = DEFAULT_SERVER_VER
|
||||||
|
bukkitververify = input("Attempt to use \"{0}\"? (Y/n)".format(bukkitver))
|
||||||
|
if (len(bukkitververify) == 0): bukkitververify = "y"
|
||||||
|
while bukkitververify.lower() != "y":
|
||||||
|
if (bukkitververify.lower() == "n"):
|
||||||
|
bukkitver = input("Bukkit version to use: ")
|
||||||
|
bukkitververify = input("Attempt to use \"{0}\"? (Y/n)".format(bukkitver))
|
||||||
|
else:
|
||||||
|
bukkitververify = input("Attempt to use \"{0}\"? Please enter \"y\" or \"n\": ".format(bukkitver))
|
||||||
|
|
||||||
|
if os.system(BUILDTOOLS_CMD.format(ver = bukkitver)) != 0:
|
||||||
|
print("Error while running build tools.")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
print("Step 3) Moving JARs and cleaning up.")
|
||||||
|
|
||||||
|
print("Moving generated JAR file.")
|
||||||
|
if bukkitver == DEFAULT_SERVER_VER:
|
||||||
|
direntries = os.listdir()
|
||||||
|
for entry in direntries:
|
||||||
|
if (entry.startswith("spigot") and entry.endswith(".jar")):
|
||||||
|
shutil.move(entry, "../spigot.jar")
|
||||||
|
else:
|
||||||
|
shutil.move("spigot-{1}.jar".format(bukkitver), "../spigot.jar")
|
||||||
|
|
||||||
|
os.chdir("../")
|
||||||
|
print("Deleting \"{0}\".".format(BUILDTOOLS_DIR))
|
||||||
|
shutil.rmtree(BUILDTOOLS_DIR)
|
||||||
|
|
||||||
|
os.chdir("../")
|
||||||
|
print("Done generating files for development server.")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def reset() -> None:
|
||||||
|
pomxmldir = find_pomxmldir()
|
||||||
|
if os.path.exists(pomxmldir):
|
||||||
|
shutil.rmtree(pomxmldir)
|
||||||
|
|
||||||
|
if os.path.exists(DEV_SERVER_PATH):
|
||||||
|
shutil.rmtree(DEV_SERVER_PATH)
|
||||||
|
|
||||||
|
def find_pomxml() -> str:
|
||||||
|
return find_pomxmldir() + "/pom.xml"
|
||||||
|
|
||||||
|
def find_pomxmldir() -> str:
|
||||||
|
directories = os.listdir()
|
||||||
|
|
||||||
|
for directory in directories:
|
||||||
|
if os.path.isdir(directory) and "pom.xml" in os.listdir(directory):
|
||||||
|
return directory
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print("usage: {0} <setup | project | server | reset>".format(sys.argv[0]))
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
if sys.argv[1] == "setup":
|
||||||
|
project_gen()
|
||||||
|
gen_dev_server()
|
||||||
|
elif sys.argv[1] == "project":
|
||||||
|
project_gen()
|
||||||
|
elif sys.argv[1] == "server":
|
||||||
|
gen_dev_server()
|
||||||
|
elif sys.argv[1] == "reset":
|
||||||
|
reset()
|
26
scripts/load_plugin.py
Normal file
26
scripts/load_plugin.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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))
|
11
scripts/start_server.py
Normal file
11
scripts/start_server.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import os
|
||||||
|
import gen
|
||||||
|
|
||||||
|
JVM_DEBUG_PORT = 25577
|
||||||
|
|
||||||
|
|
||||||
|
if (os.getcwd().endswith("scripts/")):
|
||||||
|
os.chdir("../")
|
||||||
|
|
||||||
|
os.chdir(gen.DEV_SERVER_PATH)
|
||||||
|
os.system("java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address={port} -jar spigot.jar".format(port = JVM_DEBUG_PORT))
|
@ -1,9 +0,0 @@
|
|||||||
package ca.recrown.PACKAGENAME;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hello world!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class App
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
name: PLUGINNAME
|
|
||||||
main: ca.recrown.PACKAGENAME.PLUGINNAME
|
|
||||||
version: 1.0.0
|
|
||||||
description: DESCRIPTION.
|
|
||||||
commands:
|
|
||||||
depend: []
|
|
||||||
load: startup
|
|
||||||
api-version: 1.15
|
|
@ -1,39 +0,0 @@
|
|||||||
# This is the main configuration file for Bukkit.
|
|
||||||
# As you can see, there's actually not that much to configure without any plugins.
|
|
||||||
# For a reference for any variable inside this file, check out the Bukkit Wiki at
|
|
||||||
# https://www.spigotmc.org/go/bukkit-yml
|
|
||||||
#
|
|
||||||
# If you need help on this file, feel free to join us on irc or leave a message
|
|
||||||
# on the forums asking for advice.
|
|
||||||
#
|
|
||||||
# IRC: #spigot @ irc.spi.gt
|
|
||||||
# (If this means nothing to you, just go to https://www.spigotmc.org/go/irc )
|
|
||||||
# Forums: https://www.spigotmc.org/
|
|
||||||
# Bug tracker: https://www.spigotmc.org/go/bugs
|
|
||||||
|
|
||||||
|
|
||||||
settings:
|
|
||||||
allow-end: true
|
|
||||||
warn-on-overload: true
|
|
||||||
permissions-file: permissions.yml
|
|
||||||
update-folder: update
|
|
||||||
plugin-profiling: false
|
|
||||||
connection-throttle: 4000
|
|
||||||
query-plugins: true
|
|
||||||
deprecated-verbose: default
|
|
||||||
shutdown-message: Server closed
|
|
||||||
minimum-api: none
|
|
||||||
spawn-limits:
|
|
||||||
monsters: 70
|
|
||||||
animals: 10
|
|
||||||
water-animals: 15
|
|
||||||
ambient: 15
|
|
||||||
chunk-gc:
|
|
||||||
period-in-ticks: 600
|
|
||||||
ticks-per:
|
|
||||||
animal-spawns: 400
|
|
||||||
monster-spawns: 1
|
|
||||||
water-spawns: 1
|
|
||||||
ambient-spawns: 1
|
|
||||||
autosave: 6000
|
|
||||||
aliases: now-in-commands.yml
|
|
@ -1,8 +0,0 @@
|
|||||||
if (Test-Path ./pid.temp) {
|
|
||||||
$sID = Get-Item -Path ./pid.temp | Get-Content -Tail 1
|
|
||||||
if (Get-Process -Id $sID -ErrorAction SilentlyContinue) {
|
|
||||||
Stop-Process -Id $sID
|
|
||||||
}
|
|
||||||
Remove-Item "./pid.temp"
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
write-Output "Deleting previous world if there was one..."
|
|
||||||
remove-Item -Recurse world -Force -ErrorAction Ignore
|
|
||||||
write-Output "Attempting to copy plugin jar to plugins folder..."
|
|
||||||
copy-Item -Path "..\target\PLUGINNAME*.jar" -Destination "plugins\PLUGINNAME.jar"
|
|
@ -1 +0,0 @@
|
|||||||
Start-Process java -ArgumentList "-Xms512M", "-Xmx1G", "-jar", "paper-195.jar", "nogui"
|
|
@ -1,6 +0,0 @@
|
|||||||
write-Output "Attempting to start Paper test server."
|
|
||||||
$SID = Start-Process java -ArgumentList "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=25566", "-Xms512M", "-Xmx1G", "-jar", "paper-195.jar", "nogui" -PassThru
|
|
||||||
$SID = $SID.Id
|
|
||||||
write-Output "Process started. PID is: $SID"
|
|
||||||
|
|
||||||
$SID | Out-File -FilePath "pid.temp"
|
|
Loading…
x
Reference in New Issue
Block a user