mirror of
https://github.com/HMCore/Core.git
synced 2026-01-07 02:02:51 +00:00
Compare commits
44 Commits
v0.1
...
25d15f8f81
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25d15f8f81 | ||
|
|
484ec12477 | ||
|
|
73e79dceed | ||
|
|
6dae008be3 | ||
|
|
30d8815c78 | ||
|
|
b8650b6c99 | ||
|
|
14380c6515 | ||
|
|
627c817769 | ||
|
|
ab7af6f037 | ||
|
|
0ee724bdbe | ||
|
|
076b6ccacd | ||
|
|
55c2ad2cd2 | ||
|
|
e14ede7fc2 | ||
|
|
1b9e9bb904 | ||
|
|
f329af6e9f | ||
|
|
05fe2aacd6 | ||
|
|
ed051fd49e | ||
|
|
42dc3b4e62 | ||
|
|
a50c72323f | ||
|
|
b26a7cf0ac | ||
|
|
6ac30d9f0a | ||
|
|
e23df79b73 | ||
|
|
8e65236c2b | ||
|
|
1fd51a66b2 | ||
|
|
d30fa27dc2 | ||
|
|
35dc220249 | ||
|
|
0507ee3e52 | ||
|
|
6311db9c2e | ||
|
|
40603af040 | ||
|
|
ce9374500c | ||
|
|
2ba2e28ec1 | ||
|
|
a6cbf39485 | ||
|
|
4fc7db7516 | ||
|
|
abb6428a97 | ||
|
|
00dc5f38b9 | ||
|
|
03d9da9128 | ||
|
|
522905d93c | ||
|
|
ba4a5f94e0 | ||
|
|
6bf83d6e75 | ||
|
|
54bc7448a9 | ||
|
|
222e3cdf6c | ||
|
|
a52c81654b | ||
|
|
1f66d85f75 | ||
|
|
6b50a3c74d |
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Please fill in the following information:**
|
||||||
|
- OS: [e.g. Windows]:
|
||||||
|
- Java Version [e.g. 11.0.9]:
|
||||||
|
- Version [e.g. v1.0]:
|
||||||
|
- Used Modules [eg. Ores]:
|
||||||
|
- Used Mods:
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
20
.github/ISSUE_TEMPLATE/module-request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/module-request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Module Request
|
||||||
|
about: Request a new module to be added and maintained officially by HMCore.
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**What module do you want us to add?**
|
||||||
|
A clear description of the module and all its functionalities.
|
||||||
|
|
||||||
|
**Why do you want this module to be added? Has it something to do with a problem you encountered**
|
||||||
|
A clear description of why you want this module to be added. Maybe list some problems that would be solved by this module.
|
||||||
|
|
||||||
|
**How important is this module?**
|
||||||
|
How important the need of this module would be.
|
||||||
|
|
||||||
|
**Anything else to say?**
|
||||||
|
--
|
||||||
10
.github/ISSUE_TEMPLATE/other-issue.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/other-issue.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Other issue
|
||||||
|
about: Do you have any other issue not listed in the other options?
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
40
.github/workflows/nightly.yml
vendored
Normal file
40
.github/workflows/nightly.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# This workflow will run a nightly build and push it to the github releases section
|
||||||
|
name: Deploy Nightly
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * *' # run at 2 AM UTC
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
nightly:
|
||||||
|
name: Build and deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'adopt'
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew build
|
||||||
|
- name: Unzip Javadoc
|
||||||
|
run: ./gradlew unzip
|
||||||
|
- name: Deploy Javadoc🚀
|
||||||
|
uses: JamesIves/github-pages-deploy-action@4.1.2
|
||||||
|
with:
|
||||||
|
branch: gh-pages # The branch the action should deploy to.
|
||||||
|
folder: ./build/unpacked/javadoc # The folder the action should deploy.
|
||||||
|
- name: Deploy release🚀
|
||||||
|
uses: WebFreak001/deploy-nightly@v1.1.0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
|
||||||
|
with:
|
||||||
|
upload_url: https://uploads.github.com/repos/HMCore/Core/releases/42400467/assets{?name,label} # find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases in your browser and copy the full "upload_url" value including the {?name,label} part
|
||||||
|
release_id: 42400467 # same as above (id can just be taken out the upload_url, it's used to find old releases)
|
||||||
|
asset_path: ./build/libs/HMCore-1.1-SNAPSHOT.jar # path to archive to upload
|
||||||
|
asset_name: HMCore_SNAPSHOT-nightly-$$.jar # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
|
||||||
|
asset_content_type: application/java-archive # required by GitHub API
|
||||||
|
max_releases: 3 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
|
||||||
41
.github/workflows/snyk-infrastructure-analysis.yml
vendored
Normal file
41
.github/workflows/snyk-infrastructure-analysis.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# A sample workflow which checks out your Infrastructure as Code Configuration files,
|
||||||
|
# such as Kubernetes, Helm & Terraform and scans them for any security issues.
|
||||||
|
# The results are then uploaded to GitHub Security Code Scanning
|
||||||
|
#
|
||||||
|
# For more examples, including how to limit scans to only high-severity issues
|
||||||
|
# and fail PR checks, see https://github.com/snyk/actions/
|
||||||
|
|
||||||
|
name: Snyk Infrastructure as Code
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ main ]
|
||||||
|
schedule:
|
||||||
|
- cron: '29 13 * * 5'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
snyk:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Run Snyk to check configuration files for security issues
|
||||||
|
# Snyk can be used to break the build when it detects security issues.
|
||||||
|
# In this case we want to upload the issues to GitHub Code Scanning
|
||||||
|
continue-on-error: true
|
||||||
|
uses: snyk/actions/gradle-jdk11@master
|
||||||
|
env:
|
||||||
|
# In order to use the Snyk Action you will need to have a Snyk API token.
|
||||||
|
# More details in https://github.com/snyk/actions#getting-your-snyk-token
|
||||||
|
# or you can signup for free at https://snyk.io/login
|
||||||
|
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: --sarif-file-output=snyk.sarif
|
||||||
|
- name: Upload result to GitHub Code Scanning
|
||||||
|
uses: github/codeql-action/upload-sarif@v1
|
||||||
|
with:
|
||||||
|
sarif_file: snyk.sarif
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -209,4 +209,6 @@ gradle-app.setting
|
|||||||
# End of https://www.toptal.com/developers/gitignore/api/java,eclipse,intellij,gradle
|
# End of https://www.toptal.com/developers/gitignore/api/java,eclipse,intellij,gradle
|
||||||
|
|
||||||
run/
|
run/
|
||||||
test-run/
|
test-run/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
128
CODE_OF_CONDUCT.md
Normal file
128
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement
|
||||||
|
[here](https://discord.gg/y4BVAbf).
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
|
https://www.contributor-covenant.org/translations.
|
||||||
42
README.md
42
README.md
@@ -2,10 +2,50 @@
|
|||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
[](#contributors-)
|
[](#contributors-)
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||||
|
[](https://jitpack.io/#org.hmcore/Core)
|
||||||
## The Core Mod of HMCore which powers the whole system.
|
## The Core Mod of HMCore which powers the whole system.
|
||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
|
|
||||||
|
## Use HMCore
|
||||||
|
|
||||||
|
### Gradle
|
||||||
|
```groovy
|
||||||
|
repositories {
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.hmcore:Core:{version}'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
### Gradle Kotlin DSL
|
||||||
|
*Note: If you use Kotlin, you should probably use [core-ktx](https://github.com/HMCore/Core-ktx) instead*
|
||||||
|
```kotlin
|
||||||
|
repositories {
|
||||||
|
maven("https://jitpack.io")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("org.hmcore:Core:{version}")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
### Maven
|
||||||
|
```xml
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hmcore</groupId>
|
||||||
|
<artifactId>Core</artifactId>
|
||||||
|
<version>{version}</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
## Contributors ✨
|
## Contributors ✨
|
||||||
|
|
||||||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
||||||
@@ -25,4 +65,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
|
|
||||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||||
|
|
||||||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
||||||
|
|||||||
41
build.gradle
41
build.gradle
@@ -1,15 +1,30 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'maven'
|
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
|
id 'com.github.johnrengelman.shadow' version '7.1.1'
|
||||||
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'com.github.HMCore'
|
group 'com.github.HMCore'
|
||||||
version '1.0-SNAPSHOT'
|
version '1.1-SNAPSHOT'
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
maven(MavenPublication) {
|
||||||
|
groupId = 'com.github.HMCore'
|
||||||
|
artifactId = 'Core'
|
||||||
|
version = '1.1'
|
||||||
|
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -18,12 +33,28 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib"
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.9.0'
|
||||||
|
implementation 'org.apache.logging.log4j:log4j-api:2.16.0'
|
||||||
|
implementation 'org.apache.logging.log4j:log4j-core:2.16.0'
|
||||||
|
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
if(JavaVersion.current().isJava9Compatible()) {
|
||||||
|
options.addBooleanOption('html5', true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task unzip(type: Copy) {
|
||||||
|
def zipFile = file('build/libs/HMCore-1.1-SNAPSHOT-javadoc.jar')
|
||||||
|
def outputDir = file("${buildDir}/unpacked/javadoc")
|
||||||
|
|
||||||
|
from zipTree(zipFile)
|
||||||
|
into outputDir
|
||||||
}
|
}
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.hmcore;
|
package org.hmcore;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.hmcore.modules.Module;
|
import org.hmcore.modules.Module;
|
||||||
import org.hmcore.modules.ModuleLoader;
|
import org.hmcore.modules.ModuleLoader;
|
||||||
import org.hmcore.modules.ModuleManager;
|
import org.hmcore.modules.ModuleManager;
|
||||||
@@ -10,11 +12,18 @@ import java.util.HashMap;
|
|||||||
public class HMCore {
|
public class HMCore {
|
||||||
|
|
||||||
public static final HashMap<String, Module> modules = new HashMap<>();
|
public static final HashMap<String, Module> modules = new HashMap<>();
|
||||||
|
public static final Logger logger = LogManager.getLogger("HMCore");
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ModuleManager.loadModules();
|
ModuleManager.loadModules();
|
||||||
ModuleManager.initModules();
|
ModuleManager.initModules();
|
||||||
ModuleManager.hookModules();
|
ModuleManager.hookModules();
|
||||||
|
|
||||||
|
ModuleManager.disableModules();
|
||||||
|
ModuleManager.unloadModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ public class ModuleLoader {
|
|||||||
if(!moduleDir.exists()) moduleDir.mkdirs();
|
if(!moduleDir.exists()) moduleDir.mkdirs();
|
||||||
for (String path:
|
for (String path:
|
||||||
Objects.requireNonNull(moduleDir.list())) {
|
Objects.requireNonNull(moduleDir.list())) {
|
||||||
loadModule(path);
|
loadModule("hm/modules/" + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadModule(String path) throws IOException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
|
private void loadModule(String path) throws IOException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||||
System.out.println("Loading module at: " + path);
|
HMCore.logger.debug("Loading module at: " + path);
|
||||||
JarFile jarFile = new JarFile(path);
|
JarFile jarFile = new JarFile(path);
|
||||||
JarEntry jarEntry = jarFile.getJarEntry("module.json");
|
JarEntry jarEntry = jarFile.getJarEntry("module.json");
|
||||||
String content = getClassPath(jarFile.getInputStream(jarEntry));
|
String content = getClassPath(jarFile.getInputStream(jarEntry));
|
||||||
@@ -40,7 +40,7 @@ public class ModuleLoader {
|
|||||||
Class<?> classToLoad = Class.forName(readable.getClassPath(), true, child);
|
Class<?> classToLoad = Class.forName(readable.getClassPath(), true, child);
|
||||||
Module instance = (Module) classToLoad.getDeclaredConstructor().newInstance();
|
Module instance = (Module) classToLoad.getDeclaredConstructor().newInstance();
|
||||||
HMCore.modules.put(instance.getName(), instance);
|
HMCore.modules.put(instance.getName(), instance);
|
||||||
System.out.println("Loaded " + instance.getName() + " v" + readable.getVersion() + " by " + readable.getCreator());
|
HMCore.logger.info("Loaded " + instance.getName() + " v" + readable.getVersion() + " by " + readable.getCreator());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getClassPath(InputStream jarEntry) {
|
private String getClassPath(InputStream jarEntry) {
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ public class ObjectInfoConfigHandler {
|
|||||||
if(registryModule.objectAndInfoExist(data.objectInfoName, data.objectInfoChosen)) {
|
if(registryModule.objectAndInfoExist(data.objectInfoName, data.objectInfoChosen)) {
|
||||||
registryModule.forceObjectInfoForObject(data.objectInfoName, data.objectInfoChosen);
|
registryModule.forceObjectInfoForObject(data.objectInfoName, data.objectInfoChosen);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[!] Either Object Info " + data.objectInfoChosen + " doesn't exist for " + data.objectInfoName + " or " + data.objectInfoName + " doesn't exist!\n" +
|
HMCore.logger.fatal("[!] Either Object Info " + data.objectInfoChosen + " doesn't exist for " + data.objectInfoName + " or " + data.objectInfoName + " doesn't exist!\n" +
|
||||||
"Please stop the Server, delete objetc-infos.json and let the server regenertate a new config [!]");
|
"Please stop the Server, delete objetc-infos.json and let the server regenerate a new config [!]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ public class ObjectInfoConfigHandler {
|
|||||||
try {
|
try {
|
||||||
object = new GsonBuilder().create().fromJson(content, ObjectInfoConfig.class);
|
object = new GsonBuilder().create().fromJson(content, ObjectInfoConfig.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("[!] Object Info Config not valid!");
|
HMCore.logger.fatal("[!] Object Info Config not valid!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
src/main/resources/log4j2.xml
Normal file
24
src/main/resources/log4j2.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration status="WARN">
|
||||||
|
<appenders>
|
||||||
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="%d{HH:mm:ss} [%t | %-5level] %msg%n"/>
|
||||||
|
</Console>
|
||||||
|
|
||||||
|
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||||
|
<PatternLayout pattern="%d{HH:mm:ss} [%t | %-5level] %msg%n" />
|
||||||
|
<Policies>
|
||||||
|
<TimeBasedTriggeringPolicy />
|
||||||
|
<OnStartupTriggeringPolicy />
|
||||||
|
</Policies>
|
||||||
|
<DefaultRolloverStrategy max="1000"/>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
</appenders>
|
||||||
|
|
||||||
|
<loggers>
|
||||||
|
<root level="debug">
|
||||||
|
<appender-ref ref="Console" level="info"/>
|
||||||
|
<appender-ref ref="File" level="info"/>
|
||||||
|
</root>
|
||||||
|
</loggers>
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user