Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Auto detect text files and normalize line endings to LF
* text=auto eol=lf

# Explicitly declare text files
*.java text
*.yml text
*.yaml text
*.md text
*.txt text
*.gradle text
*.kts text
*.properties text

# Declare files that will always have CRLF line endings on checkout
*.bat text eol=crlf

# Denote all files that are truly binary and should not be modified
*.jar binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.zip binary
*.tar binary
*.gz binary
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build SleepPlugin

on:
push:
branches: [ master, main, develop ]
pull_request:
branches: [ master, main ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: SleepPlugin-${{ github.sha }}
path: build/libs/*.jar
retention-days: 30

- name: Display build info
run: |
echo "Build completed successfully!"
echo "Artifact location: build/libs/"
ls -lh build/libs/
41 changes: 41 additions & 0 deletions .github/workflows/quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Code Quality Check

on:
push:
branches: [ master, main, develop ]
pull_request:
branches: [ master, main ]

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run Gradle check
run: ./gradlew check

- name: Verify JAR can be built
run: ./gradlew jar

- name: Check for Java warnings
run: ./gradlew compileJava --warning-mode all

- name: Display results
if: always()
run: |
echo "Code quality check completed!"
echo "Build directory contents:"
ls -R build/ || echo "Build directory not found"
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build

- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Extract changelog for this version
id: changelog
run: |
# Extract changelog section for current version
VERSION=${{ steps.get_version.outputs.VERSION }}
CHANGELOG=$(sed -n "/## Version $VERSION/,/^## Version/p" CHANGELOG.md | sed '$d' | tail -n +2)
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: build/libs/*.jar
body: |
# SleepPlugin v${{ steps.get_version.outputs.VERSION }}

## Changes
${{ steps.changelog.outputs.CHANGELOG }}

## Installation
1. Download `SleepPlugin-${{ steps.get_version.outputs.VERSION }}.jar`
2. Place in your server's `plugins/` folder
3. Restart the server

## Requirements
- Minecraft: 1.21.5
- Server: Paper (or compatible)
- Java: 21+
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# SleepPlugin Changelog

## Version 1.0.3 (2025-10-xx)

### New Features
- Added support for custom language files - users can now create their own localizations beyond English and Russian
- Added `template.yml` language file template for easier translation creation
- Added GitHub Actions for automated builds and releases

### Improvements
- Removed language file validation restrictions - any custom language file is now automatically supported
- Enhanced LanguageManager to dynamically load any .yml language file from the lang/ directory
- Added automated CI/CD pipeline with GitHub Actions
- Added build status badges to README

### Technical Changes
- Language files are no longer restricted to en_EN and ru_RU only
- Plugin now accepts any valid language code format (e.g., de_DE, fr_FR, es_ES, etc.)
- Created three GitHub Actions workflows: build, release, and quality check
- Automated release creation when version tags are pushed

---

## Version 1.0.2 (2025-05-25)

### New Features
Expand Down
149 changes: 149 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Contributing to SleepPlugin

Thank you for your interest in contributing to SleepPlugin! This document provides guidelines for contributing to the project.

## How to Contribute

### Reporting Bugs

If you find a bug, please open an issue on GitHub with:
- A clear, descriptive title
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Your server version, plugin version, and Java version
- Any relevant logs or error messages

### Suggesting Features

Feature suggestions are welcome! Please open an issue with:
- A clear description of the feature
- Why this feature would be useful
- Any implementation ideas (optional)

### Pull Requests

1. **Fork the repository** and create your branch from `master`
2. **Make your changes** following the code style guidelines below
3. **Test your changes** on a local Paper server
4. **Update documentation** if needed (README.md, CHANGELOG.md)
5. **Commit your changes** with clear, descriptive commit messages
6. **Push to your fork** and submit a pull request

## Code Style Guidelines

### Java Code Style

- **Indentation**: 4 spaces (no tabs)
- **Naming conventions**:
- Classes: `PascalCase`
- Methods: `camelCase`
- Variables: `camelCase`
- Constants: `UPPER_SNAKE_CASE`
- **Braces**: Opening brace on same line
- **Comments**: Use Javadoc for public methods, inline comments for complex logic
- **Line length**: Try to keep lines under 120 characters

Example:
```java
public class MyClass {
private static final int MAX_VALUE = 100;
private String myVariable;

/**
* Does something useful
* @param input the input parameter
* @return the result
*/
public String doSomething(String input) {
if (input == null) {
return null;
}
return input.toUpperCase();
}
}
```

### Configuration Files

- **YAML files**: Use 2 spaces for indentation
- **Comments**: Add comments for complex configurations
- **Keys**: Use `kebab-case` for multi-word keys

### Commit Messages

Write clear, descriptive commit messages:
- Use present tense ("Add feature" not "Added feature")
- Keep first line under 50 characters
- Add detailed description after blank line if needed

Good examples:
```
Add storm skip functionality
Fix null pointer in bed leave event
Update documentation for custom languages
```

## Development Setup

1. **Prerequisites**:
- Java 21 or higher
- Gradle 8.x (wrapper included)
- A Paper 1.21.5 test server

2. **Clone and build**:
```bash
git clone https://github.com/NovaDAndrew/sleep-plugin.git
cd sleep-plugin
./gradlew build
```

3. **Test**:
- Copy `build/libs/SleepPlugin-*.jar` to your test server's `plugins/` folder
- Start the server and test your changes
- Check console for errors

## Testing Guidelines

Before submitting a pull request, test:
- Plugin loads without errors
- All features work as expected
- No console errors or warnings
- Config updates correctly
- Language files load properly
- Multi-world support works
- Edge cases (1 player, odd numbers, etc.)

## Adding Translations

To add a new language:

1. Copy `src/main/resources/lang/template.yml`
2. Rename to your language code (e.g., `de_DE.yml`)
3. Translate all message strings
4. Test by setting `language: de_DE` in config.yml
5. Submit a pull request with your translation

## Documentation

When making changes that affect:
- **User-facing features**: Update README.md and modrinth.md
- **Configuration**: Update config examples in documentation
- **Breaking changes**: Add migration notes to CHANGELOG.md

## Questions?

If you have questions about contributing:
- Open a discussion on GitHub
- Check existing issues and pull requests
- Contact the maintainer: NovaDAndrew

## Code of Conduct

- Be respectful and constructive
- Focus on the code, not the person
- Accept constructive criticism gracefully
- Help others learn and grow

## License

By contributing, you agree that your contributions will be licensed under the MIT License.
Loading