mirror of
https://github.com/EternalCodeTeam/EternalCombat.git
synced 2026-11-05 17:12:32 -05:00
Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd8dfbcc83 | ||
|
|
b5c289c2b1 | ||
|
|
5b4f9d1911 | ||
|
|
e024b2fae9 | ||
|
|
b2776936ed | ||
|
|
d2aa5dfa84 | ||
|
|
5c88af692d | ||
|
|
390195edb2 | ||
|
|
8808331f0a | ||
|
|
99b3a5aa27 | ||
|
|
9d1716d9db | ||
|
|
7b94ab4b7a | ||
|
|
daee189865 | ||
|
|
1aef1e6f1d | ||
|
|
788a2a668c | ||
|
|
93d7ffdd0f | ||
|
|
fb6db7a008 | ||
|
|
7d8a01b7d7 | ||
|
|
08c7482cee |
No files matched your search
+1
-2
@@ -1,2 +1 @@
|
||||
* @EternalCodeTeam/eternalcodeteam-maintainers
|
||||
/.github/CODEOWNERS @EternalCodeTeam/eternalcodeteam-maintainers
|
||||
* @EternalCodeTeam/team-maintainer
|
||||
+33
-43
@@ -1,64 +1,54 @@
|
||||
# 👋 Contributing to EternalCombat
|
||||
|
||||
First off, thanks for taking the time to contribute! 🎉
|
||||
We love user contributions and want to make it as easy as possible for you to get involved.
|
||||
Thanks for taking the time to contribute! This page covers everything you need to get started.
|
||||
|
||||
## 🛠️ Development Setup
|
||||
## 🛠️ Requirements
|
||||
|
||||
To start contributing, you'll need to set up your environment:
|
||||
- **JDK 21** (the project targets Java 21)
|
||||
- Git
|
||||
|
||||
1. **Java 21**: We use Java 21 for development. Ensure you have a JDK 21 installed.
|
||||
2. **IDE**: We recommend [IntelliJ IDEA](https://www.jetbrains.com/idea/).
|
||||
3. **Git**: Ensure you have Git installed.
|
||||
The Gradle wrapper is committed, so you don't need Gradle installed.
|
||||
|
||||
### 📥 Getting the Code
|
||||
## 🔨 Building and testing
|
||||
|
||||
```bash
|
||||
# Fork the repository on GitHub first!
|
||||
# https://github.com/EternalCodeTeam/EternalCombat/fork
|
||||
git clone https://github.com/YOUR-USERNAME/EternalCombat.git
|
||||
git clone https://github.com/EternalCodeTeam/EternalCombat.git
|
||||
cd EternalCombat
|
||||
```
|
||||
|
||||
### 🔨 Building the Project
|
||||
|
||||
Run this command in your terminal:
|
||||
|
||||
```bash
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
## 🤝 How to Contribute
|
||||
`./gradlew build` compiles both modules, runs the unit tests and produces the shaded plugin jar in
|
||||
`eternalcombat-plugin/build/libs/`.
|
||||
|
||||
1. **Fork & Clone**: Fork the repo to your own account and clone it.
|
||||
2. **Branch**: Create a new branch for your feature or fix.
|
||||
```bash
|
||||
git checkout -b feat/my-awesome-feature
|
||||
```
|
||||
3. **Code**: Hack away! 💻
|
||||
4. **Test**: Run manual test by `runServer` to ensure you haven't broken anything.
|
||||
```bash
|
||||
./gradlew runServer
|
||||
```
|
||||
5. **Push**: Push your changes to your fork.
|
||||
6. **Pull Request**: Open a PR against the `master` branch.
|
||||
To run only the tests:
|
||||
|
||||
## 📏 Code Style
|
||||
```bash
|
||||
./gradlew test
|
||||
```
|
||||
|
||||
Make sure that your code adheres to the plugin's existing coding style.
|
||||
To try your changes on a real server, start a Paper server with the plugin and its dependencies
|
||||
already installed:
|
||||
|
||||
## 🐛 Reporting Bugs
|
||||
```bash
|
||||
./gradlew runServer
|
||||
```
|
||||
|
||||
If you find a bug, please use the **Bug Report** issue template.
|
||||
- Check if the issue already exists.
|
||||
- Provide a minimal reproduction if possible.
|
||||
- Include logs and screenshots.
|
||||
## 📏 Code style
|
||||
|
||||
## 💡 Feature Requests
|
||||
Formatting rules live in [`.editorconfig`](../.editorconfig) — 4 spaces, UTF-8, LF endings.
|
||||
Enable EditorConfig support in your IDE and match the style of the surrounding code.
|
||||
|
||||
Have an idea? Use the **Feature Request** issue template.
|
||||
- Explain *why* this feature is useful.
|
||||
- Describe how it should look or behave.
|
||||
## 🚀 Pull requests
|
||||
|
||||
1. Fork the repository and create a branch off `master`.
|
||||
2. Keep the change focused — one topic per pull request.
|
||||
3. Add or update tests when you change behaviour that can be tested without a server.
|
||||
4. Make sure `./gradlew build` passes before opening the PR.
|
||||
5. Prefix the PR title with the type of change, for example
|
||||
`feat:`, `fix:`, `chore:`, `docs:`, or `GH-<issue>` when it closes an issue.
|
||||
6. Describe what you changed and why — the pull request template is intentionally short.
|
||||
|
||||
## 📄 License
|
||||
By contributing, you agree that your contributions will be licensed under the project's [License](../LICENSE).
|
||||
|
||||
By contributing, you agree that your contributions will be licensed under the
|
||||
[Apache License 2.0](../LICENSE).
|
||||
@@ -1,20 +1,14 @@
|
||||
name: 🐛 Bug Report
|
||||
description: File a bug report to help us improve EternalCombat
|
||||
description: Report something that is broken in EternalCombat
|
||||
title: "[Bug]: "
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
Please ensure that you have searched the existing issues to see if this bug has already been reported.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Bug description
|
||||
description: A clear and concise description of what the bug is.
|
||||
placeholder: I was doing X and Y happened...
|
||||
label: What happened?
|
||||
description: What went wrong, and what did you expect instead?
|
||||
placeholder: I was doing X and Y happened, but I expected Z.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -22,63 +16,25 @@ body:
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Please provide a step-by-step guide to reproduce the issue.
|
||||
placeholder: |
|
||||
1. Launch the server
|
||||
2. Tag yourself using the '/combat tag' command
|
||||
3. See error
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots/Video
|
||||
description: If applicable, add screenshots or a video to help explain your problem.
|
||||
|
||||
- type: dropdown
|
||||
id: server-software
|
||||
attributes:
|
||||
label: Server Software
|
||||
description: What server software are you using?
|
||||
options:
|
||||
- Paper
|
||||
- Purpur
|
||||
- Spigot
|
||||
- Folia
|
||||
- Other (please specify in logs)
|
||||
1. Start the server
|
||||
2. Run /combatlog tag <player>
|
||||
3. See the error
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: minecraft-version
|
||||
id: versions
|
||||
attributes:
|
||||
label: Minecraft Version
|
||||
description: What version of Minecraft are you running? (e.g. 1.21.11)
|
||||
placeholder: 1.21.11
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: plugin-version
|
||||
attributes:
|
||||
label: Plugin Version
|
||||
description: What version of EternalCombat are you running? (Check with /eternalcombat version)
|
||||
placeholder: v2.4.1
|
||||
label: Versions
|
||||
description: Server software and version, plus the EternalCombat version.
|
||||
placeholder: Paper 1.21.11, EternalCombat 2.5.1
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs / Stack Trace
|
||||
description: Please paste any relevant logs or stack traces here. Use a pastebin service if the log is too long.
|
||||
label: Logs
|
||||
description: Any relevant errors or stack traces. Use a paste service for long logs.
|
||||
render: shell
|
||||
@@ -3,36 +3,16 @@ description: Suggest an idea for EternalCombat
|
||||
title: "[Feature]: "
|
||||
labels: ["feature"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for suggesting a new feature! Please explain your idea in detail.
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
id: idea
|
||||
attributes:
|
||||
label: Is your feature request related to a problem?
|
||||
description: Please describe the problem you are trying to solve.
|
||||
placeholder: I'm always frustrated when...
|
||||
label: What would you like to see?
|
||||
description: Describe the feature and the problem it would solve.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Describe the solution you'd like
|
||||
description: A clear and concise description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Describe alternatives you've considered
|
||||
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
id: context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context or screenshots about the feature request here.
|
||||
description: Optional — alternatives you considered, examples, or screenshots.
|
||||
@@ -1,35 +1,11 @@
|
||||
---
|
||||
name: Pull Request
|
||||
about: Submit a contribution to EternalCombat
|
||||
title: 'GH-{NUMBER} <title>'
|
||||
labels: []
|
||||
assignees: []
|
||||
---
|
||||
## What changed?
|
||||
|
||||
## 📝 Description
|
||||
<!--
|
||||
Please submit your PR using the following title format:
|
||||
feat: Description of the new feature
|
||||
fix: Description of the bug fix
|
||||
chore: Maintenance tasks
|
||||
docs: Documentation changes
|
||||
-->
|
||||
<!-- A short description of the change. -->
|
||||
|
||||
<!-- Describe your changes clearly and concisely. Why is this change needed? What does it accomplish? -->
|
||||
## Why?
|
||||
|
||||
## 🎯 Type of Change
|
||||
<!-- Please check the boxes that apply to your changes -->
|
||||
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] ✨ New feature (non-breaking change which adds functionality)
|
||||
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] 🔧 Refactoring (no functional changes, just code improvements)
|
||||
- [ ] 🎨 Style/Cosmetic (formatting, whitespace, visual changes)
|
||||
- [ ] 📚 Documentation (updates to documentation or README)
|
||||
- [ ] 🤖 CI/CD/Build (changes to workflows, gradle, etc.)
|
||||
<!-- The problem this solves, or the issue it closes (e.g. Closes #123). -->
|
||||
|
||||
**Test Environment:**
|
||||
- **Minecraft Version:** <!-- e.g. 1.20.4 -->
|
||||
- **Java Version:** <!-- e.g. 21 -->
|
||||
- **Platform:** <!-- e.g. Windows/Linux/MacOS -->
|
||||
## Anything else?
|
||||
|
||||
## 📸 Screenshots (if applicable)
|
||||
<!-- Optional: how you tested it, screenshots, or notes for reviewers. -->
|
||||
@@ -0,0 +1,17 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported versions
|
||||
|
||||
Only the latest release of EternalCombat receives security fixes.
|
||||
Please update before reporting an issue.
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
**Please do not open a public issue for security problems.**
|
||||
|
||||
Report them privately to the maintainers on our
|
||||
[Discord server](https://discord.com/invite/FQ7jmGBd6c) — open a ticket or send a
|
||||
direct message to a team member.
|
||||
|
||||
Include the plugin version, your server software and version, and the steps needed to
|
||||
reproduce the problem. We will confirm the report and let you know once a fix is released.
|
||||
@@ -5,44 +5,37 @@ on:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
# The build derives the snapshot version from `git describe --tags`.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '17'
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
|
||||
- name: Set Variables & Build
|
||||
uses: actions/github-script@v9
|
||||
with:
|
||||
script: |
|
||||
const isPR = context.eventName === 'pull_request';
|
||||
const branch = isPR ? context.payload.pull_request.head.ref.replace(/\//g, '-') : 'master';
|
||||
const sha = (isPR ? context.payload.pull_request.head.sha : context.sha).substring(0, 7);
|
||||
|
||||
const artifactName = `EternalCombat ${branch}+${sha}`;
|
||||
core.exportVariable('FULL_ARTIFACT_NAME', artifactName);
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew shadowJar
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ env.FULL_ARTIFACT_NAME }}
|
||||
path: eternalcombat-plugin/build/libs/*.jar
|
||||
path: eternalcombat-plugin/build/libs/EternalCombat*.jar
|
||||
if-no-files-found: error
|
||||
archive: false
|
||||
@@ -7,6 +7,10 @@ on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -14,7 +18,7 @@ jobs:
|
||||
contents: read
|
||||
if: (github.event_name == 'push' && !contains(github.event.head_commit.message, '[ci skip]')) || github.event_name == 'release'
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up JDK 21
|
||||
@@ -22,10 +26,10 @@ jobs:
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
|
||||
|
||||
- name: Publish to Hangar
|
||||
run: ./gradlew :eternalcombat-plugin:publishPluginPublicationToHangar
|
||||
env:
|
||||
|
||||
@@ -7,6 +7,10 @@ on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -14,7 +18,7 @@ jobs:
|
||||
contents: read
|
||||
if: (github.event_name == 'push' && !contains(github.event.head_commit.message, '[ci skip]')) || github.event_name == 'release'
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up JDK 21
|
||||
@@ -22,10 +26,10 @@ jobs:
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
|
||||
|
||||
- name: Publish to Modrinth
|
||||
run: ./gradlew :eternalcombat-plugin:modrinth
|
||||
env:
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
name: Publish EternalCombat API
|
||||
|
||||
on:
|
||||
release:
|
||||
branches: [ master ]
|
||||
types: [ published ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
environment: deployment
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
cache: 'gradle'
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
|
||||
- name: Publish with Gradle
|
||||
run: ./gradlew clean build eternalcombat-api:publish
|
||||
run: ./gradlew build :eternalcombat-api:publish
|
||||
env:
|
||||
ETERNAL_CODE_MAVEN_USERNAME: ${{ secrets.ETERNAL_CODE_MAVEN_USERNAME }}
|
||||
ETERNAL_CODE_MAVEN_PASSWORD: ${{ secrets.ETERNAL_CODE_MAVEN_PASSWORD }}
|
||||
@@ -6,8 +6,8 @@
|
||||
[](https://modrinth.com/plugin/eternalcombat)
|
||||
[](https://hangar.papermc.io/EternalCodeTeam/eternalcombat)
|
||||
|
||||
[](https://discord.com/invite/FQ7jmGBd6c)
|
||||
[](https://docs.eternalcode.pl/eternalcombat/introduction)
|
||||
[](https://discord.com/invite/FQ7jmGBd6c)
|
||||
[](https://eternalcode.pl/docs/eternalcombat/introduction)
|
||||
[](https://bstats.org/plugin/bukkit/EternalCombat/17803)
|
||||
|
||||
[Report Bug](https://github.com/EternalCodeTeam/EternalCombat/issues) • [Request Feature](https://github.com/EternalCodeTeam/EternalCombat/issues) • [Join Discord](https://discord.com/invite/FQ7jmGBd6c)
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
### Information
|
||||
|
||||
## EternalCombat requires PacketEvents plugin to work.
|
||||
#### EternalCombat requires PacketEvents plugin to work.
|
||||
You can download it from [here](https://modrinth.com/plugin/packetevents)
|
||||
|
||||
EternalCombat 2.0 has been tested on Minecraft versions **1.17.1 to 26.1.2**, but it should work seamlessly on most
|
||||
EternalCombat 2.0 has been tested on Minecraft versions **1.19.3 to 26.1.2**, but it should work seamlessly on most
|
||||
other versions too.
|
||||
If you run into any compatibility issues, please let us know in
|
||||
the [Issues tab](https://github.com/EternalCodeTeam/EternalCombat/issues).
|
||||
@@ -91,9 +91,9 @@ Control who can use EternalCombat’s powerful features with these permissions:
|
||||
| `eternalcombat.stats` | View combat statistics with `/combatlog stats`. |
|
||||
| `eternalcombat.reload` | Reload the plugin with `/combatlog reload`. |
|
||||
| `eternalcombat.receiveupdates` | Receive notifications about new plugin versions on join. |
|
||||
| `eternalcombat.bypass` | When exclude `excludeAdminsFromCombat` is set to `true` users with this permission will not be tagged |
|
||||
| `eternalcombat.bypass` | When `excludeAdminsFromCombat` is set to `true`, users with this permission will not be tagged |
|
||||
|
||||
## PlaceholderAPI
|
||||
### PlaceholderAPI
|
||||
|
||||
EternalCombat 2.0 fully supports **PlaceholderAPI**, letting you integrate placeholders into other compatible plugins.
|
||||
Follow the [PlaceholderAPI instructions](https://wiki.placeholderapi.com/users/) to get started.
|
||||
@@ -163,8 +163,12 @@ details on how to get involved and our [code of conduct](https://github.com/Eter
|
||||
### Reporting Issues
|
||||
|
||||
Found a bug?
|
||||
Report it in the [Issues tab](https://github.com/eternalcodeteam/eternalcombat/issues).
|
||||
Report it in the [Issues tab](https://github.com/EternalCodeTeam/EternalCombat/issues).
|
||||
Please include as much detail as possible, like your Minecraft and plugin
|
||||
versions, along with any error messages or logs.
|
||||
Ready to transform your server’s combat experience?
|
||||
Download EternalCombat 2.0 now and let the battles begin!
|
||||
|
||||
### License
|
||||
|
||||
EternalCombat is licensed under the [Apache License 2.0](LICENSE).
|
||||
@@ -8,12 +8,12 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.4.2")
|
||||
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.6.1")
|
||||
implementation("com.modrinth.minotaur:com.modrinth.minotaur.gradle.plugin:2.9.0")
|
||||
implementation("io.papermc.hangar-publish-plugin:io.papermc.hangar-publish-plugin.gradle.plugin:0.1.4")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.4.0")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.4.10")
|
||||
implementation("net.minecrell:plugin-yml:0.6.0")
|
||||
implementation("xyz.jpenilla:run-task:3.0.2")
|
||||
implementation("xyz.jpenilla:run-task:3.1.0")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
object Versions {
|
||||
|
||||
// Keep this version for best compatibility.
|
||||
const val PAPER_API = "1.20.4-R0.1-SNAPSHOT"
|
||||
const val PAPER_API = "1.19.3-R0.1-SNAPSHOT"
|
||||
|
||||
const val JUNIT_JUPITER_API = "6.1.0"
|
||||
const val JUNIT_JUPITER_PARAMS = "6.1.0"
|
||||
const val JUNIT_JUPITER_ENGINE = "6.1.0"
|
||||
const val JUNIT_JUPITER_API = "6.1.3"
|
||||
const val JUNIT_JUPITER_PARAMS = "6.1.3"
|
||||
const val JUNIT_JUPITER_ENGINE = "6.1.3"
|
||||
|
||||
const val JETBRAINS_ANNOTATIONS = "26.1.0"
|
||||
|
||||
const val ETERNALCODE_COMMONS = "1.4.1"
|
||||
const val MULTIFICATION = "1.2.5-SNAPSHOT"
|
||||
const val PACKETS_EVENTS = "2.12.2"
|
||||
const val PACKETS_EVENTS = "2.13.0"
|
||||
|
||||
const val LITE_COMMANDS = "3.10.9"
|
||||
const val LITE_COMMANDS = "3.11.0"
|
||||
const val OKAERI_CONFIGS_SERDES_COMMONS = "5.0.13"
|
||||
const val OKAERI_CONFIGS_SERDES_BUKKIT = "5.0.13"
|
||||
|
||||
@@ -24,7 +24,7 @@ object Versions {
|
||||
const val B_STATS_BUKKIT = "3.2.1"
|
||||
const val WORLD_GUARD_BUKKIT = "7.0.17"
|
||||
|
||||
const val PLACEHOLDER_API = "2.12.2"
|
||||
const val PLACEHOLDER_API = "2.12.3"
|
||||
const val LANDS_API = "7.25.4"
|
||||
const val WORLDEDIT = "3ISh7ADm" //cannot use numeric version bc of duplicated version on modrinth
|
||||
const val PACKETEVENTS = "2.11.1"
|
||||
|
||||
@@ -7,6 +7,7 @@ dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT_JUPITER_API}")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT_JUPITER_PARAMS}")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT_JUPITER_ENGINE}")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
|
||||
@@ -34,6 +34,11 @@ public enum CauseOfTag {
|
||||
ENDER_PEARL,
|
||||
|
||||
|
||||
/**
|
||||
* The player's combat tag was kept active because they were below the void combat height.
|
||||
*/
|
||||
VOID,
|
||||
|
||||
/**
|
||||
* A custom cause, typically defined by external plugins or systems, applied the combat tag.
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,9 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.UUID;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* This event is triggered when a player is tagged in a fight.
|
||||
@@ -15,14 +17,25 @@ public class FightTagEvent extends Event implements Cancellable {
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
private final UUID player;
|
||||
private final CauseOfTag cause;
|
||||
private final UUID tagger;
|
||||
private boolean cancelled = false;
|
||||
private CancelTagReason cancelReason;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #FightTagEvent(UUID, CauseOfTag, UUID)} instead, which also carries the tagger.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public FightTagEvent(UUID player, CauseOfTag cause) {
|
||||
this(player, cause, null);
|
||||
}
|
||||
|
||||
public FightTagEvent(UUID player, CauseOfTag cause, @Nullable UUID tagger) {
|
||||
super(false);
|
||||
|
||||
this.player = player;
|
||||
this.cause = cause;
|
||||
this.tagger = tagger;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,6 +56,16 @@ public class FightTagEvent extends Event implements Cancellable {
|
||||
return this.cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the UUID of the player who caused this tag, if any.
|
||||
*
|
||||
* @return The UUID of the tagger, or {@code null} if the tag was not caused by another player.
|
||||
*/
|
||||
@Nullable
|
||||
public UUID getTagger() {
|
||||
return this.tagger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
|
||||
@@ -8,6 +8,7 @@ plugins {
|
||||
`eternalcombat-publish-hangar`
|
||||
`eternalcombat-publish-modrinth`
|
||||
`eternalcombat-runserver`
|
||||
`eternalcombat-java-unit-test`
|
||||
|
||||
id("de.eldoria.plugin-yml.paper") version "0.9.0"
|
||||
id("com.gradleup.shadow")
|
||||
@@ -71,7 +72,7 @@ dependencies {
|
||||
paper {
|
||||
main = "com.eternalcode.combat.CombatPlugin"
|
||||
authors = listOf("EternalCodeTeam")
|
||||
apiVersion = "1.20.4"
|
||||
apiVersion = "1.19"
|
||||
prefix = "EternalCombat"
|
||||
name = "EternalCombat"
|
||||
generateLibrariesJson = true
|
||||
|
||||
@@ -36,10 +36,12 @@ import com.eternalcode.combat.fight.drop.DropServiceImpl;
|
||||
import com.eternalcode.combat.fight.drop.impl.PercentDropModifier;
|
||||
import com.eternalcode.combat.fight.drop.impl.PlayersHealthDropModifier;
|
||||
import com.eternalcode.combat.fight.blocker.PlaceBlockBlocker;
|
||||
import com.eternalcode.combat.fight.blocker.SignEditingBlocker;
|
||||
import com.eternalcode.combat.fight.effect.FightEffectController;
|
||||
import com.eternalcode.combat.fight.effect.FightEffectService;
|
||||
import com.eternalcode.combat.fight.effect.FightEffectServiceImpl;
|
||||
import com.eternalcode.combat.fight.firework.FireworkController;
|
||||
import com.eternalcode.combat.fight.knockback.KnockbackMountController;
|
||||
import com.eternalcode.combat.fight.knockback.KnockbackRegionController;
|
||||
import com.eternalcode.combat.fight.knockback.KnockbackService;
|
||||
import com.eternalcode.combat.fight.logout.LogoutController;
|
||||
@@ -204,6 +206,7 @@ public final class CombatPlugin extends JavaPlugin implements EternalCombatApi {
|
||||
new RespawnAnchorListener(this, this.fightManager, pluginConfig),
|
||||
new FireworkController(this.fightManager, pluginConfig, noticeService),
|
||||
new InventoryContainersBlocker(this.fightManager, pluginConfig, noticeService),
|
||||
new SignEditingBlocker(this.fightManager, pluginConfig),
|
||||
new CommandsBlocker(this.fightManager, noticeService, pluginConfig),
|
||||
new ElytraBlocker(this.fightManager, pluginConfig),
|
||||
new ElytraEquipBlocker(this.fightManager, noticeService, pluginConfig, server),
|
||||
@@ -211,6 +214,8 @@ public final class CombatPlugin extends JavaPlugin implements EternalCombatApi {
|
||||
new PlaceBlockBlocker(this.fightManager, noticeService, pluginConfig)
|
||||
);
|
||||
|
||||
new KnockbackMountController(noticeService, this.regionProvider, this.fightManager).register(this);
|
||||
|
||||
eventManager.subscribe(
|
||||
PlayerDeathEvent.class,
|
||||
pluginConfig.drop.dropEventPriority,
|
||||
|
||||
+13
@@ -90,6 +90,19 @@ public class CombatSettings extends OkaeriConfig {
|
||||
})
|
||||
public EventPriority quitPunishmentEventPriority = EventPriority.NORMAL;
|
||||
|
||||
@Comment({
|
||||
"# Keep a player's combat tag continuously active while they are below 'voidCombatHeight'.",
|
||||
"# This prevents players from evading combat by falling into the void (e.g. in the End).",
|
||||
"# Set to 'true' to keep resetting the combat timer to its full duration while below that height."
|
||||
})
|
||||
public boolean keepCombatActiveInVoid = false;
|
||||
|
||||
@Comment({
|
||||
"# The Y height below which the combat timer is kept active (see 'keepCombatActiveInVoid').",
|
||||
"# Default: 0, matching the void threshold in worlds such as the End."
|
||||
})
|
||||
public double voidCombatHeight = 0;
|
||||
|
||||
@Comment({
|
||||
"# List of kick reasons where players will NOT be punished for combat logging.",
|
||||
"# If this list is empty, players are ALWAYS punished when kicked during combat.",
|
||||
|
||||
+4
-2
@@ -50,10 +50,12 @@ public class MessagesSettings extends OkaeriConfig {
|
||||
|
||||
@Comment({
|
||||
"# Message displayed when a player enters combat.",
|
||||
"# This message warns the player not to leave the server while in combat."
|
||||
"# This message warns the player not to leave the server while in combat.",
|
||||
"# The {OPPONENT} placeholder is replaced with the name of the player who caused the tag,",
|
||||
"# or the 'unknownPlayerPlaceholder' variable if the tag was not caused by a player."
|
||||
})
|
||||
public Notice playerTagged = Notice.chat(
|
||||
"<gradient:red:yellow>⚠ <white>You are in combat!</white> <u>Do not leave the server!</gradient>");
|
||||
"<gradient:red:yellow>⚠ <white>You are in combat with</white> <yellow>{OPPONENT}</yellow>! <u>Do not leave the server!</gradient>");
|
||||
|
||||
@Comment({
|
||||
"# Message displayed when a player leaves combat.",
|
||||
|
||||
+7
@@ -127,6 +127,13 @@ public class PluginConfig extends OkaeriConfig {
|
||||
})
|
||||
public InventorySettings inventory = new InventorySettings();
|
||||
|
||||
@Comment({
|
||||
" ",
|
||||
"# Settings related to sign editing during combat.",
|
||||
"# Created for sign traps where opening the sign editor can block ender pearl throws."
|
||||
})
|
||||
public SignEditingSettings signEditing = new SignEditingSettings();
|
||||
|
||||
@Comment({
|
||||
" ",
|
||||
"# Settings related to placeholders used in the plugin.",
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.eternalcode.combat.config.implementation;
|
||||
|
||||
import eu.okaeri.configs.OkaeriConfig;
|
||||
import eu.okaeri.configs.annotation.Comment;
|
||||
|
||||
public class SignEditingSettings extends OkaeriConfig {
|
||||
|
||||
@Comment({
|
||||
"# Prevent players from editing signs during combat.",
|
||||
"# Disabled by default; created for sign traps where sign editing blocks ender pearl throws."
|
||||
})
|
||||
public boolean disableSignEditingDuringCombat = false;
|
||||
}
|
||||
+4
-2
@@ -66,12 +66,14 @@ public class CrystalPvpConstants {
|
||||
fightManager.tag(
|
||||
damagerUniqueId,
|
||||
pluginConfig.settings.combatTimerDuration,
|
||||
CauseOfTag.CRYSTAL
|
||||
CauseOfTag.CRYSTAL,
|
||||
victimUniqueId
|
||||
);
|
||||
fightManager.tag(
|
||||
victimUniqueId,
|
||||
pluginConfig.settings.combatTimerDuration,
|
||||
CauseOfTag.CRYSTAL
|
||||
CauseOfTag.CRYSTAL,
|
||||
damagerUniqueId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public class FightManagerImpl implements FightManager {
|
||||
@ApiStatus.Experimental
|
||||
@Override
|
||||
public FightTagEvent tag(UUID target, Duration delay, CauseOfTag causeOfTag, @Nullable UUID tagger) {
|
||||
FightTagEvent event = this.eventManager.publishEvent(new FightTagEvent(target, causeOfTag));
|
||||
FightTagEvent event = this.eventManager.publishEvent(new FightTagEvent(target, causeOfTag, tagger));
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return event;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.eternalcode.combat.fight;
|
||||
|
||||
import com.eternalcode.combat.config.implementation.PluginConfig;
|
||||
import com.eternalcode.combat.fight.event.CauseOfTag;
|
||||
import com.eternalcode.combat.fight.event.CauseOfUnTag;
|
||||
import com.eternalcode.combat.fight.event.FightTagEvent;
|
||||
import com.eternalcode.combat.notification.NoticeService;
|
||||
import com.eternalcode.combat.util.DurationUtil;
|
||||
import java.util.Optional;
|
||||
@@ -41,6 +43,16 @@ public class FightTask implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.config.combat.keepCombatActiveInVoid
|
||||
&& player.getLocation().getY() < this.config.combat.voidCombatHeight
|
||||
&& !this.config.settings.ignoredWorlds.contains(player.getWorld().getName())) {
|
||||
FightTagEvent tagEvent = this.fightManager.tag(playerUniqueId, this.config.settings.combatTimerDuration, CauseOfTag.VOID, fightTag.getTagger());
|
||||
|
||||
if (!tagEvent.isCancelled()) {
|
||||
fightTag = this.fightManager.getTag(playerUniqueId);
|
||||
}
|
||||
}
|
||||
|
||||
Duration remaining = fightTag.getRemainingDuration();
|
||||
|
||||
String opponent = Optional.ofNullable(fightTag.getTagger())
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.eternalcode.combat.fight.blocker;
|
||||
|
||||
import com.eternalcode.combat.config.implementation.PluginConfig;
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SignEditingBlocker implements Listener {
|
||||
|
||||
private final FightManager fightManager;
|
||||
private final PluginConfig config;
|
||||
|
||||
public SignEditingBlocker(FightManager fightManager, PluginConfig config) {
|
||||
this.fightManager = fightManager;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
void onInteract(PlayerInteractEvent event) {
|
||||
if (!this.config.signEditing.disableSignEditingDuringCombat) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block clickedBlock = event.getClickedBlock();
|
||||
if (clickedBlock == null || !isSign(clickedBlock.getType())) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
UUID uniqueId = player.getUniqueId();
|
||||
|
||||
if (!this.fightManager.isInCombat(uniqueId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setUseInteractedBlock(Result.DENY);
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
if (item != null && isEnderPearl(item.getType()) && event.useItemInHand() != Result.DENY) {
|
||||
event.setUseItemInHand(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isSign(Material material) {
|
||||
return material.name().endsWith("_SIGN");
|
||||
}
|
||||
|
||||
static boolean isEnderPearl(Material material) {
|
||||
return material == Material.ENDER_PEARL;
|
||||
}
|
||||
}
|
||||
+13
@@ -5,6 +5,8 @@ import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.fight.event.FightTagEvent;
|
||||
import com.eternalcode.combat.fight.event.FightUntagEvent;
|
||||
import com.eternalcode.combat.notification.NoticeService;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -37,12 +39,23 @@ public class FightMessageController implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String opponent = this.resolveOpponentName(event.getTagger(), player.getUniqueId());
|
||||
|
||||
this.noticeService.create()
|
||||
.player(player.getUniqueId())
|
||||
.notice(this.config.messagesSettings.playerTagged)
|
||||
.placeholder("{OPPONENT}", opponent)
|
||||
.send();
|
||||
}
|
||||
|
||||
private String resolveOpponentName(UUID tagger, UUID taggedPlayer) {
|
||||
return Optional.ofNullable(tagger)
|
||||
.filter(uuid -> !uuid.equals(taggedPlayer))
|
||||
.map(this.server::getPlayer)
|
||||
.map(Player::getName)
|
||||
.orElse(this.config.messagesSettings.unknownPlayerPlaceholder);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
void onUnTag(FightUntagEvent event) {
|
||||
Player player = this.server.getPlayer(event.getPlayer());
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.eternalcode.combat.fight.knockback;
|
||||
|
||||
import com.eternalcode.combat.fight.FightManager;
|
||||
import com.eternalcode.combat.notification.NoticeService;
|
||||
import com.eternalcode.combat.region.RegionProvider;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
// EntityMountEvent moved between org.spigotmc, io.papermc.paper and org.bukkit across versions,
|
||||
// so we resolve it at runtime to stay compatible without bumping the compile API.
|
||||
public final class KnockbackMountController implements Listener {
|
||||
|
||||
private static final String[] EVENT_CLASS_CANDIDATES = {
|
||||
"org.bukkit.event.entity.EntityMountEvent",
|
||||
"io.papermc.paper.event.entity.EntityMountEvent",
|
||||
"org.spigotmc.event.entity.EntityMountEvent",
|
||||
};
|
||||
|
||||
private final NoticeService noticeService;
|
||||
private final RegionProvider regionProvider;
|
||||
private final FightManager fightManager;
|
||||
private final AtomicBoolean mountFailureLogged = new AtomicBoolean();
|
||||
|
||||
public KnockbackMountController(NoticeService noticeService, RegionProvider regionProvider, FightManager fightManager) {
|
||||
this.noticeService = noticeService;
|
||||
this.regionProvider = regionProvider;
|
||||
this.fightManager = fightManager;
|
||||
}
|
||||
|
||||
public void register(Plugin plugin) {
|
||||
Class<? extends Event> eventClass = null;
|
||||
for (String candidate : EVENT_CLASS_CANDIDATES) {
|
||||
try {
|
||||
eventClass = Class.forName(candidate).asSubclass(Event.class);
|
||||
break;
|
||||
} catch (ClassNotFoundException | ClassCastException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (eventClass == null) {
|
||||
plugin.getLogger().warning("Could not find any EntityMountEvent class; mount protection in regions is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
MethodHandle getMountHandle;
|
||||
try {
|
||||
getMountHandle = this.resolveGetMountHandle(eventClass);
|
||||
} catch (NoSuchMethodException | IllegalAccessException exception) {
|
||||
plugin.getLogger().log(Level.WARNING, "EntityMountEvent has incompatible getMount() method; mount protection in regions is disabled.", exception);
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvent(
|
||||
eventClass,
|
||||
this,
|
||||
EventPriority.HIGHEST,
|
||||
(listener, event) -> this.handle(event, getMountHandle, plugin),
|
||||
plugin,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
private MethodHandle resolveGetMountHandle(Class<? extends Event> eventClass) throws NoSuchMethodException, IllegalAccessException {
|
||||
if (!EntityEvent.class.isAssignableFrom(eventClass) || !Cancellable.class.isAssignableFrom(eventClass)) {
|
||||
throw new NoSuchMethodException(eventClass.getName() + " is not a cancellable entity event");
|
||||
}
|
||||
|
||||
Method getMount = eventClass.getMethod("getMount");
|
||||
if (!Entity.class.isAssignableFrom(getMount.getReturnType())) {
|
||||
throw new NoSuchMethodException(eventClass.getName() + "#getMount() does not return Entity");
|
||||
}
|
||||
|
||||
return MethodHandles.publicLookup()
|
||||
.unreflect(getMount)
|
||||
.asType(MethodType.methodType(Entity.class, Event.class));
|
||||
}
|
||||
|
||||
private void handle(Event event, MethodHandle getMountHandle, Plugin plugin) {
|
||||
if (!(event instanceof EntityEvent entityEvent) || !(event instanceof Cancellable cancellable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(entityEvent.getEntity() instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.fightManager.isInCombat(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity mount;
|
||||
try {
|
||||
mount = (Entity) getMountHandle.invokeExact(event);
|
||||
} catch (Throwable exception) {
|
||||
this.logMountFailure(plugin, exception);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mount == null || !this.regionProvider.isInRegion(mount.getLocation())) {
|
||||
return;
|
||||
}
|
||||
|
||||
cancellable.setCancelled(true);
|
||||
this.noticeService.create()
|
||||
.player(player.getUniqueId())
|
||||
.notice(config -> config.messagesSettings.cantEnterOnRegion)
|
||||
.send();
|
||||
}
|
||||
|
||||
private void logMountFailure(Plugin plugin, Throwable exception) {
|
||||
if (!this.mountFailureLogged.compareAndSet(false, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getLogger().log(Level.WARNING, "Could not read EntityMountEvent mount; mount protection in regions is skipped.", exception);
|
||||
}
|
||||
}
|
||||
-22
@@ -14,7 +14,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityMountEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
@@ -132,27 +131,6 @@ public class KnockbackRegionController implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
void onEntityMount(EntityMountEvent event) {
|
||||
if (!(event.getEntity() instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.fightManager.isInCombat(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.regionProvider.isInRegion(event.getMount().getLocation())) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
this.noticeService.create()
|
||||
.player(player.getUniqueId())
|
||||
.notice(config -> config.messagesSettings.cantEnterOnRegion)
|
||||
.send();
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
void onTag(FightTagEvent event) {
|
||||
Player player = this.server.getPlayer(event.getPlayer());
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.eternalcode.combat.config.implementation;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class SignEditingSettingsTest {
|
||||
|
||||
@Test
|
||||
void shouldDisableSignEditingBlockerByDefault() {
|
||||
SignEditingSettings signEditingSettings = new SignEditingSettings();
|
||||
|
||||
assertFalse(signEditingSettings.disableSignEditingDuringCombat);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.eternalcode.combat.fight.blocker;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class SignEditingBlockerTest {
|
||||
|
||||
@Test
|
||||
void shouldRecognizeStandingSignMaterials() {
|
||||
assertTrue(SignEditingBlocker.isSign(Material.OAK_SIGN));
|
||||
assertTrue(SignEditingBlocker.isSign(Material.CRIMSON_SIGN));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRecognizeWallSignMaterials() {
|
||||
assertTrue(SignEditingBlocker.isSign(Material.OAK_WALL_SIGN));
|
||||
assertTrue(SignEditingBlocker.isSign(Material.WARPED_WALL_SIGN));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldIgnoreNonSignMaterials() {
|
||||
assertFalse(SignEditingBlocker.isSign(Material.CHEST));
|
||||
assertFalse(SignEditingBlocker.isSign(Material.ENDER_PEARL));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRecognizeEnderPearlMaterial() {
|
||||
assertTrue(SignEditingBlocker.isEnderPearl(Material.ENDER_PEARL));
|
||||
assertFalse(SignEditingBlocker.isEnderPearl(Material.OAK_SIGN));
|
||||
}
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +29,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
|
||||
Vendored
+2
-2
@@ -19,7 +19,7 @@
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@@ -72,7 +72,7 @@ echo location of your Java installation. 1>&2
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
Reference in new issue
Block a user