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
132 changes: 71 additions & 61 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,131 +21,141 @@ ij_formatter_tags_enabled = true
ij_formatter_on_tag = @formatter:on
ij_formatter_off_tag = @formatter:off

[{*.kt, *.kts}]
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_continuation_indent_size = 4 # To match ktlint settings
ij_kotlin_keep_indents_on_empty_lines = false
[{*.kt,*.kts}]
# Tabs and Indents
# continuation_indent_size = 4 to match ktlint settings
ij_kotlin_continuation_indent_size = 4
ij_kotlin_keep_indents_on_empty_lines = unset

## Wrapping and Braces
# Keep when reformatting
# Spaces
## Before parentheses
ij_kotlin_space_before_if_parentheses = true
ij_kotlin_space_before_for_parentheses = true
ij_kotlin_space_before_while_parentheses = true
ij_kotlin_space_before_catch_parentheses = true
ij_kotlin_space_before_when_parentheses = true
## Around operators
ij_kotlin_spaces_around_assignment_operators = true
ij_kotlin_spaces_around_logical_operators = true
ij_kotlin_spaces_around_equality_operators = true
ij_kotlin_spaces_around_relational_operators = true
ij_kotlin_spaces_around_additive_operators = true
ij_kotlin_spaces_around_multiplicative_operators = true
ij_kotlin_spaces_around_unary_operator = false
ij_kotlin_spaces_around_range = false
## Other
ij_kotlin_space_before_comma = false
ij_kotlin_space_after_comma = true
ij_kotlin_space_before_type_colon = false
ij_kotlin_space_after_type_colon = true
ij_kotlin_space_before_extend_colon = true
ij_kotlin_space_after_extend_colon = true
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_spaces_around_function_type_arrow = true
ij_kotlin_spaces_around_when_arrow = true
ij_kotlin_space_before_lambda_arrow = true

# Wrapping and Braces
## Keep when reformatting
ij_kotlin_keep_line_breaks = true
ij_kotlin_keep_first_column_comment = true
# Extends/implements list
## Extends/implements list
ij_kotlin_extends_list_wrap = normal
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_continuation_indent_in_supertype_lists = false
# Function declaration parameters
## Function declaration parameters
ij_kotlin_method_parameters_wrap = on_every_item
ij_kotlin_align_multiline_parameters = true
ij_kotlin_method_parameters_new_line_after_left_paren = true
ij_kotlin_method_parameters_right_paren_on_new_line = true
ij_kotlin_continuation_indent_in_parameter_lists = false
# Function call arguments
## Function call arguments
ij_kotlin_call_parameters_wrap = on_every_item
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_call_parameters_new_line_after_left_paren = true
ij_kotlin_call_parameters_right_paren_on_new_line = true
ij_kotlin_continuation_indent_in_argument_lists = false
# Function parentheses
## Function parentheses
ij_kotlin_align_multiline_method_parentheses = false
# Chained function calls
## Chained function calls
ij_kotlin_method_call_chain_wrap = normal
ij_kotlin_wrap_first_method_in_call_chain = false
ij_kotlin_continuation_indent_for_chained_calls = false
# 'if()' statement
## 'if()' statement
ij_kotlin_else_on_new_line = false
ij_kotlin_if_rparen_on_new_line = true
ij_kotlin_continuation_indent_in_if_conditions = false
# 'do ... while()' statement
## 'do ... while()' statement
ij_kotlin_while_on_new_line = false
# 'try' statement
## 'try' statement
ij_kotlin_catch_on_new_line = false
ij_kotlin_finally_on_new_line = false
# Binary expressions
## Binary expressions
ij_kotlin_align_multiline_binary_operation = false
# Wraps
## Wraps
ij_kotlin_assignment_wrap = normal
ij_kotlin_enum_constants_wrap = off
ij_kotlin_class_annotation_wrap = split_into_lines
ij_kotlin_method_annotation_wrap = split_into_lines
ij_kotlin_field_annotation_wrap = split_into_lines
ij_kotlin_parameter_annotation_wrap = off
ij_kotlin_variable_annotation_wrap = off
# 'when' statements
## 'when' statements
ij_kotlin_align_in_columns_case_branch = false
# Braces placement
ij_kotlin_line_break_after_multiline_when_entry = true
ij_kotlin_indent_before_arrow_on_new_line = true
## Braces placement
ij_kotlin_lbrace_on_next_line = false
# Expression body functions
## Expression body functions
ij_kotlin_wrap_expression_body_functions = 1
ij_kotlin_continuation_indent_for_expression_bodies = false
# Elvis expressions
## Elvis expressions
ij_kotlin_wrap_elvis_expressions = 1
ij_kotlin_continuation_indent_in_elvis = false

## Spaces
# Before Parentheses
ij_kotlin_space_before_if_parentheses = true
ij_kotlin_space_before_for_parentheses = true
ij_kotlin_space_before_while_parentheses = true
ij_kotlin_space_before_catch_parentheses = true
ij_kotlin_space_before_when_parentheses = true
# Around Operators
ij_kotlin_spaces_around_assignment_operators = true
ij_kotlin_spaces_around_logical_operators = true
ij_kotlin_spaces_around_equality_operators = true
ij_kotlin_spaces_around_relational_operators = true
ij_kotlin_spaces_around_additive_operators = true
ij_kotlin_spaces_around_multiplicative_operators = true
ij_kotlin_spaces_around_unary_operator = false
ij_kotlin_spaces_around_range = false
# Other
ij_kotlin_space_before_comma = false
ij_kotlin_space_after_comma = true
ij_kotlin_space_before_type_colon = false
ij_kotlin_space_after_type_colon = true
ij_kotlin_space_after_extend_colon = true
ij_kotlin_space_before_extend_colon = true
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_spaces_around_function_type_arrow = true
ij_kotlin_spaces_around_when_arrow = true
ij_kotlin_space_before_lambda_arrow = true

## Blank Lines
# Keep Maximum Blank Lines
# Blank Lines
## Keep maximum blank lines
ij_kotlin_keep_blank_lines_in_declarations = 1
ij_kotlin_keep_blank_lines_in_code = 1
ij_kotlin_keep_blank_lines_before_right_brace = 0
# Minimum Blank Lines
## Minimum blank lines
ij_kotlin_blank_lines_after_class_header = 0
ij_kotlin_blank_lines_around_block_when_branches = 1
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1

## Imports
# Imports
ij_kotlin_name_count_to_use_star_import = 5
ij_kotlin_name_count_to_use_star_import_for_members = 3
ij_kotlin_import_nested_classes = false
ij_kotlin_packages_to_use_import_on_demand = java.util.*, kotlinx.android.synthetic.**, io.ktor.**
ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^
ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.**
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^

## Other
# Other
## Trailing comma
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_allow_trailing_comma_on_call_site = false

## Code generation
# Code generation
## Comment code
ij_kotlin_line_comment_at_first_column = true
ij_kotlin_line_comment_add_space = false
ij_kotlin_line_comment_add_space_on_reformat = false
ij_kotlin_block_comment_at_first_column = true
ij_kotlin_block_comment_add_space = false

# Load/Save
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL

[*.md]
trim_trailing_whitespace = false

[{*.yaml, *.yml}]
[{*.yaml,*.yml}]
indent_size = 2
ij_yaml_spaces_within_brackets = false
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_indents_on_empty_lines = unset
ij_yaml_keep_line_breaks = true
ij_yaml_spaces_within_brackets = false

[{*.bash, *.sh, *.zsh}]
[{*.bash,*.sh,*.zsh}]
indent_size = 2
tab_width = 2

Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@

### Changed

- **Breaking change!**
Refactor development server implementation to use [jpenilla/run-task](https://github.com/jpenilla/run-task/) plugin and integrate run-paper for server execution,
improving maintainability and compatibility with various server versions.
- Set the default [JVM toolchain](https://docs.gradle.org/current/userguide/toolchains.html) version
instead of setting JVM target and source compatibility to 1.8.
The default JVM version depends on [Paper requirements](https://docs.papermc.io/paper/getting-started#requirements).
By default, the minimal supported JVM version compatible with the specified `bukkit.server.version` is used.
- Use lazy API for `bukkit.apiVersion` and `bukkit.generateMeta` properties.
- Accept EULA using CLI parameter `-Dcom.mojang.eula.agree=true` instead of changing `eula.txt`
- Change the default value of `bukkit.server.debug` to `false`.
It is recommended to use IDE facilities to run server with enabled debugging.

### Fixed

Expand Down
85 changes: 49 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
BukkitGradle
[![Version](https://img.shields.io/github/release/EndlessCodeGroup/BukkitGradle/all.svg?style=flat-square)](https://plugins.gradle.org/plugin/ru.endlesscode.bukkitgradle)
[![Build Status](https://img.shields.io/travis/EndlessCodeGroup/BukkitGradle.svg?style=flat-square)](https://travis-ci.org/EndlessCodeGroup/BukkitGradle)
[![license](https://img.shields.io/github/license/EndlessCodeGroup/BukkitGradle.svg?style=flat-square)](https://github.com/EndlessCodeGroup/BukkitGradle/blob/master/LICENSE)

============
Gradle utilities for easier writing Bukkit plugins.
Gradle utilities to simplify Bukkit/Spigot plugins writing and debugging.

> [!WARNING]
> This plugin is not being maintained anymore,
Expand Down Expand Up @@ -33,16 +33,15 @@ Gradle utilities for easier writing Bukkit plugins.
- Provides short extension functions to add common repositories and dependencies
- Generates plugin.yml from Gradle project information
- Allows running dev server from IDE
- Supports two cores for dev server: Spigot and Paper
- Automatically downloads and updates BuildTools or Paperclip
- Automatically copies your plugin to plugins dir on server running
- Runs server using [jpenilla/run-task]

#### TODO:
- Add smart dependency system

## Installation

[BukkitGradle on plugins.gradle.org](https://plugins.gradle.org/plugin/ru.endlesscode.bukkitgradle)
> **Note:** Gradle 6.6+ required
> **Note:** Gradle 8.0+ is required

#### With new plugins mechanism
```kotlin
Expand Down Expand Up @@ -197,62 +196,75 @@ Some dependencies also add a repository needed for them.
If you need more extension-functions, [create issue][issue].

## Running Dev server
Before running server you should configure dev server location.

You can define it in `local.properties` file (that was automatically created in project directory on refresh):
```properties
# Absolute path to dev server
server.dir=/path/to/buildtools/
This plugin pre-configures [jpenilla/run-task] according to the specified [configuration](#dev-server-configuration).
Use `:runServer` task to run the dev server:

```bash
./gradlew runServer
```

If you use Spigot (see `bukkit.server.core`) you also should specify BuildTools location. For Paper no additional actions
needed.
> [!TIP]
> It is possible to create a run configuration for IDEA by running `:buildIdeaRun` task.
> The configuration will be stored in `<projectDir>/.run` directory so it can be shared through VCS.
> The directory can be changed by configuring the `:buildIdeaRun` task:
> ```kotlin
> tasks.buildIdeaRun {
> configurationsDir = file(".idea/runConfigurations")
> }
> ```

By default, the server will be located at `<projectDir>/run` but you can change it by providing Gradle property `bukkitgradle.server.dir`:

```properties
# Absolute path to directory that contains BuildTools.jar
buildtools.dir=/path/to/buildtools/
# gradle.properties
bukkitgradle.server.dir=build/run
```
If there no BuildTools.jar it will be automatically downloaded.

> **Tip:** you can define it globally, for all projects that uses BukkitGradle.
> Specify environment variables `BUKKIT_DEV_SERVER_HOME`
and `BUKKIT_BUILDTOOLS_HOME`.

#### On IntelliJ IDEA
Run `:buildIdeaRun` task.
Run Configuration will be added to your IDE.
It will be automatically refreshed when you change server configurations.
Alternatively, you can configure `runServer` task:

![Run Configuration](http://image.prntscr.com/image/1a12a03b8ac54fccb7d5b70a335fa996.png)
```kotlin
tasks.runServer {
runDirectory.set(file("build/run"))
}
```

#### On other IDEs
Run `:runServer` task.
> [!TIP]
> It is possible to configure server directory shared between multiple projects.
> Set the `bukkitgradle.server.dir` property in `$HOME/.gradle/gradle.properties`.
>
> This file contains local configurations to be used for all Gradle projects.
> The value specified in project's `gradle.properties` takes precedence over the global one.

### Dev server configuration
To accept EULA and change settings use `bukkit.server` section:

Use `bukkit.server` section to accept EULA and configure the server:

```groovy
bukkit {
// INFO: Here used default values
// INFO: Default values are used here
server {
// Core type. It can be 'spigot' or 'paper'
core = "spigot"
// Server version
version = "1.16.4" // If not specified, apiVersion will be used
version = "1.16.4" // If not specified, bukkit.apiVersion will be used
// Accept EULA
eula = false
// Set online-mode flag
onlineMode = false
// Debug mode (listen 5005 port, if you use running from IDEA this option will be ignored)
// Debug mode (listen to 5005 port)
debug = true
// Set server encoding (flag -Dfile.encoding)
// Set default file encoding (flag -Dfile.encoding)
encoding = "UTF-8"
// JVM arguments
javaArgs("-Xmx1G")
// Bukkit arguments
bukkitArgs("nogui")
bukkitArgs()
}
}
```
EULA and online-mode settings in `build.gradle` always rewrites settings in `eula.txt` and `server.properties`

> [!NOTE]
> `eula` and `online-mode` options specified in `bukkit.server` always take precedence over the values specified
> in `eula.txt` and `server.properties`

## Migration Guide

Expand Down Expand Up @@ -321,4 +333,5 @@ If there are any problems, [create an issue][issue].

[MIT](LICENSE) (c) 2020 EndlessCode Group

[jpenilla/run-task]: https://github.com/jpenilla/run-task/
[issue]: https://github.com/EndlessCodeGroup/BukkitGradle/issues/new
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ tasks.test {

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
implementation("xyz.jpenilla.run-paper:xyz.jpenilla.run-paper.gradle.plugin:2.3.1")
implementation("de.undercouch:gradle-download-task:5.6.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
implementation("com.charleskorn.kaml:kaml:0.74.0")
Expand All @@ -50,7 +52,7 @@ publishing {

gradlePlugin {
website = "https://github.com/EndlessCodeGroup/BukkitGradle"
vcsUrl = website
vcsUrl = "$website.git"

plugins {
create("bukkitGradle") {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=ru.endlesscode
description=Bukkit Gradle integration plugins
version=0.10.1
version=0.11.0-SNAPSHOT
org.gradle.jvmargs=-Xmx3G
org.gradle.parallel=true
org.gradle.daemon=true
Expand Down
Loading
Loading