# Contributing to the Plugin

### Ways to Contribute

### **1. Suggest Features**

* Go to the [issues page](https://github.com/blax-k/SpawnElytra/issues/new) on the Spawn Elytra GitHub repository
* Add an Issue
* Label it as "enhancement"
* Write your idea
* Create the Issue

### 2. Report Bugs

Found a bug? Help improve the plugin by reporting it:

1. Check [existing issues](https://github.com/blax-k/SpawnElytra/issues) to avoid duplicates
2. Create a new issue with:
   * Clear bug description
   * Steps to reproduce
   * Expected vs actual behavior
   * Server version and plugin version
   * Relevant configuration sections
   * Error messages or stack traces

**Bug Report Template:**

````markdown
**Description**
A clear description of the bug.

**Steps to Reproduce**
1. Configure plugin with...
2. Try to activate elytra by...
3. Observe that...

**Expected Behavior**
What should happen.

**Actual Behavior**
What actually happens.

**Environment**
- Minecraft Version: 1.21.4
- Server Type: Paper
- Plugin Version: 1.4
- Java Version: 21

**Configuration**
```yaml
# Relevant config sections
````

**Error Log**

```
# Any error messages
```

### 3. Submit Code

**Development Setup**

1. **Fork the Repository**

   ```bash
   git clone https://github.com/blax-k/SpawnElytra.git
   cd SpawnElytra
   ```
2. **Set Up Development Environment**
   * Java 21 or higher
   * Maven
   * IDE (IntelliJ IDEA recommended)
3. **Build the Project**

   ```bash
   mvn clean package
   ```

**Code Standards**

Follow these guidelines:

1. **Java Conventions**
   * Use meaningful variable names
   * Follow standard Java naming conventions
   * Add JavaDoc comments for public methods
   * Keep methods focused and concise
2. **Code Style**

   ```java
   public class ExampleClass {
       private final Main plugin;
       
       public ExampleClass(Main plugin) {
           this.plugin = plugin;
       }
       
       /**
        * Brief description of method.
        * 
        * @param player The player to process
        * @return true if successful
        */
       public boolean processPlayer(Player player) {
           // Implementation
       }
   }
   ```
3. **Configuration Updates**
   * Maintain backward compatibility
   * Use ConfigUpdater class for migrations
   * Document new options thoroughly
4. **Error Handling**
   * Use try-catch for external operations
   * Log errors appropriately
   * Provide fallback behavior

**Pull Request Process**

1. **Create Feature Branch**

   ```bash
   git checkout -b feature/your-feature-name
   ```
2. **Make Changes**
   * Write clean, documented code
   * Add unit tests if applicable
   * Update configuration if needed
3. **Test Thoroughly**
   * Test on different Minecraft versions
   * Verify backward compatibility
   * Check edge cases
4. **Submit Pull Request**
   * Clear title and description
   * Reference related issues
   * Describe changes made
   * Include testing notes

**PR Template:**

```markdown
**Description**
Brief description of changes.

**Type of Change**
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

**Testing**
- [ ] Tested on Minecraft 1.21.x
- [ ] Configuration migration tested
- [ ] Performance impact assessed

**Related Issues**
Fixes #123

**Screenshots** (if applicable)
```

### 4. Add Translations

Help make the plugin accessible worldwide:

1. **Create Language File**

   ```yaml
   # lang/your_language.yml
   press_to_boost: "Your translation here"
   boost_activated: "Your translation here"
   # ... other messages
   ```
2. **Translation Guidelines**
   * Keep placeholders (like `<value>`, `<key:key.swapOffhand>`) unchanged
   * Maintain MiniMessage formatting tags
   * Preserve the meaning and tone
   * Use proper grammar and spelling
3. **Submit Translation**
   * Create PR with new language file
   * Update documentation
   * Test in-game display

### 5. Improve Documentation

Documentation always needs updates:

1. **Fix Typos and Errors**
   * Correct spelling/grammar
   * Update outdated information
   * Clarify confusing sections
2. **Add Examples**
   * Configuration examples
   * Use case scenarios
   * Integration guides
3. **Create Tutorials**
   * Video guides
   * Step-by-step tutorials
   * Advanced usage guides

### 6. Test Pre-releases

Help test new versions:

1. Download pre-release versions
2. Test in various environments
3. Report any issues found
4. Provide feedback on new features

### Code Architecture

#### Project Structure

```
SpawnElytra/
├── src/
│   └── com/blaxk/spawnelytra/
│       ├── Main.java              # Main plugin class
│       ├── command/
│       │   └── CommandHandler.java # Command processing
│       ├── config/
│       │   ├── ConfigUpdater.java  # Configuration migration
│       │   └── LanguageUpdater.java # Language file updates
│       ├── data/
│       │   └── PlayerDataManager.java # Player statistics
│       ├── integration/
│       │   └── PlaceholderAPIIntegration.java # PlaceholderAPI
│       ├── listener/
│       │   └── SpawnElytra.java    # Core functionality
│       ├── setup/
│       │   ├── SetupManager.java   # Setup wizard
│       │   └── SetupSession.java   # Setup session state
│       └── util/
│           ├── MessageUtil.java    # Message handling
│           ├── SchedulerUtil.java  # Task scheduling
│           └── UpdateUtil.java     # Auto-update functionality
├── resources/
│   ├── config.yml
│   ├── plugin.yml
│   └── lang/                       # Language files
└── pom.xml
```

### Development Guidelines

#### Adding New Features

1. **Plan the Feature**
   * Consider configuration options
   * Think about permissions
   * Plan for backward compatibility
2. **Implement**
   * Follow existing patterns
   * Add configuration options
   * Update ConfigUpdater if needed
   * Add language keys
3. **Document Everything**
   * Update README.md
   * Add configuration comments
   * Create documentation pages

#### Performance Considerations

* Minimize calculations in event handlers
* Cache frequently used values
* Use appropriate data structures
* Avoid blocking operations

#### Security Considerations

* Validate all user input
* Use proper permissions
* Avoid exposing sensitive data

### Release Process

1. **Version Numbering**
   * Major: Breaking changes
   * Minor: New features
   * Patch: Bug fixes
2. **Pre-release Testing**
   * Test on multiple versions
   * Verify configuration migration
   * Check all features work
3. **Release Checklist**
   * Update version numbers
   * Update changelog
   * Create GitHub release
   * Upload to Modrinth

### Recognition

Contributors are recognized in:

* GitHub contributors page
* Release notes
* Plugin documentation
* Community announcements

Thank you for contributing to Spawn Elytra!

### License

By contributing, you agree that your contributions will be licensed under the project's existing license. ([GPL-3.0](https://github.com/blax-k/SpawnElytra/blob/main/LICENSE))
