Skip to content

Commit 15faea9

Browse files
committed
first commit
0 parents  commit 15faea9

File tree

14 files changed

+721
-0
lines changed

14 files changed

+721
-0
lines changed

.editorconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# EditorConfig helps maintain consistent coding styles
2+
# https://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_style = space
10+
indent_size = 4
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yml,yaml}]
18+
indent_size = 2
19+
20+
[*.json]
21+
indent_size = 2
22+
23+
[*.xml]
24+
indent_size = 4

.github/workflows/maven.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Java CI with Maven
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: "17"
20+
distribution: "temurin"
21+
cache: maven
22+
23+
- name: Build with Maven
24+
run: mvn -B package --file pom.xml
25+
26+
- name: Upload artifact
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: HytaleSystemGC
30+
path: target/*.jar
31+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: "17"
21+
distribution: "temurin"
22+
cache: maven
23+
24+
- name: Build with Maven
25+
run: mvn -B package --file pom.xml
26+
27+
- name: Create Release
28+
uses: softprops/action-gh-release@v1
29+
with:
30+
files: target/*.jar
31+
generate_release_notes: true

.gitignore

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Compiled class files
2+
*.class
3+
4+
# Log files
5+
*.log
6+
7+
# Package files
8+
*.jar
9+
*.war
10+
*.nar
11+
*.ear
12+
*.zip
13+
*.tar.gz
14+
*.rar
15+
16+
# Maven
17+
target/
18+
pom.xml.tag
19+
pom.xml.releaseBackup
20+
pom.xml.versionsBackup
21+
pom.xml.next
22+
release.properties
23+
dependency-reduced-pom.xml
24+
buildNumber.properties
25+
.mvn/timing.properties
26+
.mvn/wrapper/maven-wrapper.jar
27+
28+
# Gradle
29+
.gradle/
30+
build/
31+
!gradle/wrapper/gradle-wrapper.jar
32+
!**/src/main/**/build/
33+
!**/src/test/**/build/
34+
35+
# IntelliJ IDEA
36+
.idea/
37+
*.iws
38+
*.iml
39+
*.ipr
40+
out/
41+
!**/src/main/**/out/
42+
!**/src/test/**/out/
43+
44+
# Eclipse
45+
.apt_generated
46+
.classpath
47+
.factorypath
48+
.project
49+
.settings
50+
.springBeans
51+
.sts4-cache
52+
bin/
53+
!**/src/main/**/bin/
54+
!**/src/test/**/bin/
55+
56+
# NetBeans
57+
/nbproject/private/
58+
/nbbuild/
59+
/dist/
60+
/nbdist/
61+
/.nb-gradle/
62+
63+
# VS Code
64+
.vscode/
65+
66+
# macOS
67+
.DS_Store
68+
69+
# Windows
70+
Thumbs.db
71+
ehthumbs.db
72+
Desktop.ini
73+
74+
# Virtual Machine
75+
*.swp
76+
*.swo
77+
*~
78+
79+
# Local environment files
80+
.env
81+
.env.local
82+
*.local

.gitinfo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root=https://github.com/zuedev/HytaleSystemGC

CONTRIBUTING.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Contributing to HytaleSystemGC
2+
3+
Thank you for your interest in contributing to HytaleSystemGC! This document provides guidelines and information for contributors.
4+
5+
## How to Contribute
6+
7+
### Reporting Bugs
8+
9+
Before creating a bug report, please check existing issues to avoid duplicates. When creating a bug report, include:
10+
11+
- A clear and descriptive title
12+
- Steps to reproduce the issue
13+
- Expected behavior vs actual behavior
14+
- Your environment (Java version, Hytale server version, OS)
15+
- Any relevant log output
16+
17+
### Suggesting Features
18+
19+
Feature suggestions are welcome! Please provide:
20+
21+
- A clear description of the feature
22+
- The motivation/use case for the feature
23+
- Any potential implementation ideas
24+
25+
### Pull Requests
26+
27+
1. Fork the repository
28+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
29+
3. Make your changes
30+
4. Ensure your code follows the existing style
31+
5. Test your changes thoroughly
32+
6. Commit your changes (`git commit -m 'Add amazing feature'`)
33+
7. Push to the branch (`git push origin feature/amazing-feature`)
34+
8. Open a Pull Request
35+
36+
## Development Setup
37+
38+
### Prerequisites
39+
40+
- Java 17 or higher
41+
- Maven 3.6+
42+
43+
### Building
44+
45+
```bash
46+
# Clone your fork
47+
git clone https://github.com/YOUR_USERNAME/HytaleSystemGC.git
48+
cd HytaleSystemGC
49+
50+
# Build the project
51+
mvn clean package
52+
```
53+
54+
### Code Style
55+
56+
- Use 4 spaces for indentation
57+
- Follow standard Java naming conventions
58+
- Add Javadoc comments for public methods
59+
- Keep methods focused and concise
60+
61+
## Code of Conduct
62+
63+
- Be respectful and inclusive
64+
- Provide constructive feedback
65+
- Focus on the issue, not the person
66+
- Help others learn and grow
67+
68+
## Questions?
69+
70+
Feel free to open an issue for any questions about contributing.

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <https://unlicense.org>

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# HytaleSystemGC
2+
3+
[![Java](https://img.shields.io/badge/Java-17%2B-orange)](https://openjdk.org/)
4+
[![License](https://img.shields.io/badge/License-Unlicense-blue.svg)](LICENSE)
5+
[![Build](https://img.shields.io/badge/Build-Maven-C71A36)](https://maven.apache.org/)
6+
7+
A lightweight Hytale server plugin that automatically triggers garbage collection at configurable intervals to help manage memory usage.
8+
9+
## ✨ Features
10+
11+
- 🔄 **Automatic scheduled garbage collection** - Set it and forget it
12+
- ⚙️ **Configurable interval timing** - Customize GC frequency to your needs
13+
- 📊 **Smart logging** - Only logs when significant memory (>1MB) is reclaimed
14+
- 🪶 **Minimal overhead** - Uses daemon threads for zero impact on server shutdown
15+
16+
## 📋 Requirements
17+
18+
- Java 17 or higher
19+
- Maven 3.6+ (for building)
20+
- Hytale server with plugin support
21+
22+
## 🚀 Installation
23+
24+
### From Release
25+
26+
1. Download the latest release JAR from the [Releases](https://github.com/zuedev/HytaleSystemGC/releases) page
27+
2. Place the JAR in your server's `plugins` folder
28+
3. Restart the server
29+
30+
### Building from Source
31+
32+
```bash
33+
# Clone the repository
34+
git clone https://github.com/zuedev/HytaleSystemGC.git
35+
cd HytaleSystemGC
36+
37+
# Build with Maven
38+
mvn clean package
39+
40+
# The JAR will be in target/HytaleSystemGC-1.0.0.jar
41+
```
42+
43+
## ⚙️ Configuration
44+
45+
The plugin can be configured by modifying the `GCConfig` class or programmatically at runtime:
46+
47+
| Setting | Default | Description |
48+
| ------------------------- | ------- | ---------------------------------------- |
49+
| `autoGcIntervalSeconds` | 10 | Seconds between GC runs (0 to disable) |
50+
| `minMemoryThresholdBytes` | 1048576 | Minimum bytes freed before logging (1MB) |
51+
52+
### Programmatic Configuration
53+
54+
```java
55+
GCConfig config = plugin.getConfig();
56+
config.setAutoGcIntervalSeconds(30); // Run every 30 seconds
57+
config.setMinMemoryThresholdBytes(2097152); // Log when >2MB freed
58+
```
59+
60+
## 📁 Project Structure
61+
62+
```
63+
HytaleSystemGC/
64+
├── src/
65+
│ └── main/
66+
│ ├── java/
67+
│ │ └── com/zuedev/systemgc/
68+
│ │ ├── AutoGC.java # GC scheduling logic
69+
│ │ ├── GCConfig.java # Configuration management
70+
│ │ ├── SystemGCPlugin.java # Main plugin entry point
71+
│ │ └── package-info.java # Package documentation
72+
│ └── resources/
73+
│ └── hytale.json # Plugin manifest
74+
├── pom.xml # Maven build configuration
75+
├── LICENSE # Unlicense (Public Domain)
76+
├── CONTRIBUTING.md # Contribution guidelines
77+
└── README.md # This file
78+
```
79+
80+
## 🤝 Contributing
81+
82+
Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) before submitting a pull request.
83+
84+
## 📄 License
85+
86+
This project is released into the public domain under the Unlicense - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)