Update gradle to 8.14.2, add auto formatting

This commit is contained in:
NotAlexNoyle committed 2025-06-27 12:50:54 -04:00
1 parent 41a8b41569
commit 22639cdd59
31 files changed
+52 -1599

No files matched your search

-183
View File
@@ -1,183 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!-- based on https://github.com/KyoriPowered/adventure/blob/master/.checkstyle/checkstyle.xml -->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml"/>
<property name="severity" value="error"/>
<!-- https://checkstyle.org/config_filefilters.html#BeforeExecutionExclusionFileFilter -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- https://checkstyle.org/config_whitespace.html#FileTabCharacter -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<!-- https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
<module name="SuppressionFilter">
<property name="file" value="${configDirectory}/suppressions.xml"/>
</module>
<!-- https://checkstyle.org/config_filters.html#SuppressWithPlainTextCommentFilter -->
<module name="SuppressWithPlainTextCommentFilter"/>
<module name="TreeWalker">
<!-- https://checkstyle.org/config_misc.html#ArrayTypeStyle -->
<module name="ArrayTypeStyle"/>
<!-- https://checkstyle.org/config_imports.html#AvoidStarImport -->
<module name="AvoidStarImport"/>
<!-- https://checkstyle.org/config_misc.html#AvoidEscapedUnicodeCharacters -->
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowByTailComment" value="true"/>
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
<property name="severity" value="info"/>
</module>
<!-- https://checkstyle.org/config_misc.html#CommentsIndentation -->
<module name="CommentsIndentation"/>
<!-- https://checkstyle.org/config_whitespace.html#EmptyForInitializerPad -->
<module name="EmptyForInitializerPad"/>
<!-- https://checkstyle.org/config_whitespace.html#EmptyForIteratorPad -->
<module name="EmptyForIteratorPad"/>
<!-- https://checkstyle.org/config_whitespace.html#EmptyLineSeparator -->
<module name="EmptyLineSeparator">
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="tokens"
value="CLASS_DEF, CTOR_DEF, ENUM_DEF, IMPORT, INSTANCE_INIT, INTERFACE_DEF, METHOD_DEF, STATIC_IMPORT, STATIC_INIT, VARIABLE_DEF"/> <!-- remove PACKAGE_DEF, temporarily remove COMPACT_CTOR_DEF, RECORD_DEF -->
</module>
<!-- https://checkstyle.org/config_coding.html#FallThrough -->
<module name="FallThrough">
<property name="checkLastCaseGroup" value="true"/>
</module>
<!-- https://checkstyle.org/config_design.html#FinalClass -->
<module name="FinalClass"/>
<!-- https://checkstyle.org/config_coding.html#FinalLocalVariable -->
<module name="FinalLocalVariable"/>
<!-- https://checkstyle.org/config_whitespace.html#GenericWhitespace -->
<module name="GenericWhitespace"/>
<!-- https://checkstyle.org/config_design.html#HideUtilityClassConstructor -->
<module name="HideUtilityClassConstructor"/>
<!-- https://checkstyle.org/config_imports.html#IllegalImport -->
<module name="IllegalImport">
<property name="illegalPkgs" value="sun, jdk, com.sun"/>
</module>
<!-- https://checkstyle.org/config_coding.html#IllegalTokenText -->
<module name="IllegalTokenText">
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
<property name="tokens" value="CHAR_LITERAL, STRING_LITERAL"/>
</module>
<!-- https://checkstyle.org/config_misc.html#Indentation -->
<module name="Indentation"/>
<!-- https://checkstyle.org/config_blocks.html#LeftCurly -->
<module name="LeftCurly"/>
<!-- https://checkstyle.org/config_naming.html#MethodName -->
<module name="MethodName">
<property name="format" value="^[_]?[a-z][a-zA-Z0-9]*$"/>
</module>
<!-- https://checkstyle.org/config_whitespace.html#MethodParamPad -->
<module name="MethodParamPad"/>
<!-- https://checkstyle.org/config_javadoc.html#MissingJavadocMethod -->
<module name="MissingJavadocMethod">
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="tokens" value="METHOD_DEF, ANNOTATION_FIELD_DEF"/> <!-- remove CTOR_DEF, COMPACT_CTOR_DEF -->
</module>
<!-- https://checkstyle.org/config_javadoc.html#MissingJavadocType -->
<module name="MissingJavadocType"/>
<!-- https://checkstyle.org/config_coding.html#NoFinalizer -->
<module name="NoFinalizer"/>
<!-- https://checkstyle.org/config_whitespace.html#NoLineWrap -->
<module name="NoLineWrap"/>
<!-- https://checkstyle.org/config_whitespace.html#NoWhitespaceAfter -->
<module name="NoWhitespaceAfter">
<property name="allowLineBreaks" value="false"/>
</module>
<!-- https://checkstyle.org/config_whitespace.html#NoWhitespaceBefore -->
<module name="NoWhitespaceBefore">
<property name="allowLineBreaks" value="true"/>
</module>
<!-- https://checkstyle.org/config_coding.html#OneStatementPerLine -->
<module name="OneStatementPerLine"/>
<!-- https://checkstyle.org/config_misc.html#OuterTypeFilename -->
<module name="OuterTypeFilename"/>
<!-- https://checkstyle.org/config_imports.html#RedundantImport -->
<module name="RedundantImport"/>
<!-- https://checkstyle.org/config_modifier.html#RedundantModifier -->
<module name="RedundantModifier">
<property name="tokens"
value="ANNOTATION_FIELD_DEF, CLASS_DEF, CTOR_DEF, ENUM_DEF, INTERFACE_DEF, VARIABLE_DEF"/> <!-- remove METHOD_DEF and RESOURCE -->
</module>
<!-- https://checkstyle.org/config_coding.html#RequireThis -->
<module name="RequireThis"/>
<!-- https://checkstyle.org/config_blocks.html#RightCurly -->
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_DEF, INSTANCE_INIT, LITERAL_FOR, LITERAL_WHILE, METHOD_DEF, STATIC_INIT"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="option" value="same"/>
<property name="tokens"
value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_TRY"/> <!-- add LITERAL_DO -->
</module>
<!-- https://checkstyle.org/config_whitespace.html#SingleSpaceSeparator -->
<module name="SingleSpaceSeparator">
<property name="validateComments" value="true"/>
</module>
<!-- https://checkstyle.org/config_whitespace.html#TypecastParenPad -->
<module name="TypecastParenPad"/>
<!-- https://checkstyle.org/config_coding.html#UnnecessaryParentheses -->
<module name="UnnecessaryParentheses"/>
<!-- https://checkstyle.org/config_imports.html#UnusedImports -->
<module name="UnusedImports"/>
</module>
</module>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "http://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files=".*[\\/]test[\\/]java[\\/].*" checks="RequireExplicitVisibilityModifier"/>
<!-- TODO: don't suppress I-prefixed API interfaces under com.earth2me.essentials -->
<suppress files="(com[\\/]earth2me[\\/]essentials[\\/]|net[\\/]ess3[\\/]|net[\\/]essentialsx[\\/])(?:[^\\/]+$|(?!api)[^\\/]+[\\/])" checks="MissingJavadoc(Method|Type)"/>
</suppressions>
-13
View File
@@ -1,13 +0,0 @@
# Currently used
patreon: EssentialsX
ko_fi: essentialsx
github: EssentialsX
open_collective: EssentialsX
# Currently not used
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#custom: # Replace with a single custom sponsorship URL
-17
View File
@@ -1,17 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: View common issues
url: https://github.com/EssentialsX/Essentials/issues/3956
about: Check the list of known common issues to see if it solves your problem.
- name: Check past help requests
url: https://github.com/EssentialsX/Essentials/discussions/categories/q-a
about: Visit the Q&A forum to search for previous help requests.
- name: Check past feature suggestions
url: https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+label%3A%22type%3A+enhancement%22
about: Visit the Feature Suggestions forum to view and discuss existing feature suggestions.
- name: Create help request
url: https://github.com/EssentialsX/Essentials/discussions/new?category=q-a
about: Create a support ticket to get help from developers.
- name: Get help from the community on Discord
url: https://discord.gg/casfFyh
about: Join the MOSS Discord for community-powered EssentialsX support!
-79
View File
@@ -1,79 +0,0 @@
name: Report bug
description: Report a bug in EssentialsX.
labels: 'bug: unconfirmed'
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report an EssentialsX bug! Fill out the form below to provide us with info to help fix the bug.
Only use this if you're 100% sure you've found a bug and can reproduce it. If you're looking for general help with EssentialsX, try the Q&A forum or MOSS Discord server.
- type: dropdown
attributes:
label: Type of bug
description: What type of bug is this? Choose all that apply.
multiple: true
options:
- Performance issue or memory leak
- Data loss
- Exploit
- Compatibility issue
- Error in console
- Other unexpected behaviour
validations:
required: true
- type: input
attributes:
label: "`/ess dump all` output"
description: Run `/ess dump all` in the console, then copy and paste the link from the output of the command into this box. (If this command doesn't work, you should [update EssentialsX](https://essentialsx.net/downloads.html) and try again.)
validations:
required: true
- type: input
attributes:
label: Error log (if applicable)
description: If you are reporting a console error, upload any relevant log excerpts to either https://paste.gg or https://gist.github.com, save and the paste the link in this box. If you included those files in the same paste as your startup log, paste the same link here.
placeholder: "Example: https://paste.gg/p/anonymous/109dd6a10a734a3aa430d5a351ea5210"
- type: textarea
attributes:
label: Bug description
description: Describe roughly what the bug is here.
placeholder: |
Example: "When running /nuke after putting everyone into adventure mode, there aren't any explosions..."
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Provide an example of how to trigger the bug.
placeholder: |
Example:
1. Have at least 3 people online
2. Run `/gma *` to put everyone into adventure mode
3. Run `/nuke`
validations:
required: true
- type: textarea
attributes:
label: Expected behaviour
description: Explain what you should expect to happen.
placeholder: |
Example: "Everything should explode!"
validations:
required: true
- type: textarea
attributes:
label: Actual behaviour
description: Explain what actually happens.
placeholder: |
Example: "Everything doesn't explode :("
validations:
required: true
- type: markdown
attributes:
value: |
In the text box below, you can attach any relevant screenshots, files and links to Timings/spark profiler reports.
You can also include a link to a heapdump if necessary, but please make sure you don't include any private player data in the heapdump.
If you suspect this issue is related to a prior issue/PR/commit, please mention it here.
@@ -1,40 +0,0 @@
name: Request a feature
description: Suggest a feature you want to see in EssentialsX!
labels: 'type: enhancement'
body:
- type: markdown
attributes:
value: |
If you have a feature suggestion for EssentialsX, read the following tips:
1. Fill out the template.
This will help us understand what you're requesting and why you want us
to add it.
2. Keep it simple.
Make sure it's easy to understand what you're requesting. A good way is
to keep it to one request per GitHub issue, as we can then easily track
feature requests.
3. Check whether it has already been asked or added.
You can search the issue tracker to see if your feature has already been
requested at https://github.com/EssentialsX/Essentials/issues. You can
also check the changelogs to see if the feature was recently added:
https://github.com/EssentialsX/Essentials/releases
4. Ask yourself: "Does this belong in EssentialsX?"
There are lots of features that we reject because most servers won't
need or use them. If your feature is very specific or already exists in
another plugin, it might not be a good fit for EssentialsX.
- type: textarea
attributes:
label: Feature description
description: Explain what you should expect to happen.
placeholder: |
What feature are you suggesting?
validations:
required: true
- type: textarea
attributes:
label: How the feature is useful
description: Explain what actually happens.
placeholder: |
How is the feature useful to players, server owners and/or developers?
validations:
required: true
-94
View File
@@ -1,94 +0,0 @@
<!--
EssentialsX bug fix submission guide
====================================
NOTE: Failure to fill out this template properly may result in your PR being
delayed or ignored without warning.
NOTE: Don't type between any arrows in the template, as this text will be
hidden. This includes this header block and any other explanation text
blocks.
Want to discuss your PR before submitting it? Join the EssentialsX Development
server: https://discord.gg/CUN7qVb
EssentialsX is GPL
------------------
By contributing to EssentialsX, you agree to license your code under the
GNU General Public License version 3, which can be found at the link below:
https://github.com/EssentialsX/Essentials/blob/2.x/LICENSE
Instructions
------------
If you are submitting a bug fix, please follow the following steps:
1. Fill out the template in full.
This includes providing screenshots and a link to the original bug
report. If there isn't an existing bug report, we recommend opening a new
detailed bug report BEFORE opening your PR to fix it, else your PR may be
delayed or rejected without warning.
You can open a new bug report by following this link:
https://github.com/EssentialsX/Essentials/issues/new/choose
2. When linking logs or config files, do not attach them to the post!
Copy and paste any logs into https://gist.github.com/, then paste a
link to them in the relevant parts of the template. Do not use Hastebin
or Pastebin, as this can cause issues with future reviews.
DO NOT drag logs directly into this text box, as we cannot read these!
3. If you are fixing a performance issue, please include a link to a
Timings and/or profiler report, both before and after your PR.
4. If you are fixing a visual bug, such as in commands, please include
screenshots so that we can more easily review the proposed fix.
(You can drag screenshots into the bottom of the editor.)
-->
### Information
<!--
Replace #nnnn with the number of the original issue. If this PR fixes
multiple issues, you should repeat the phrase "fixes #nnnn" for each issue.
-->
This PR fixes #nnnn.
### Details
**Proposed fix:**
<!-- Type a description of your proposed fix below this line. -->
**Environments tested:**
<!-- Type the OS you have used below. -->
OS:
<!-- Type the JDK version (from java -version) you have used below. -->
Java version:
<!--
Put an "x" inside the boxes for the server software you have tested this
bug fix on. If this feature does not apply to a server, strike through the server software using ~~strikethrough~~. If you have tested on other
environments, add a new line with relevant details.
-->
- [ ] Most recent Paper version (1.XX.Y, git-Paper-BUILD)
- [ ] CraftBukkit/Spigot/Paper 1.12.2
- [ ] CraftBukkit 1.8.8
**Demonstration:**
<!--
Below this block, include screenshots/log snippets from before and after as
necessary. If you have created or used a test case plugin, please link to a
download of the plugin, source code and exact version used where possible.
-->
-8
View File
@@ -1,8 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: MOSS Discord Server
url: https://discord.gg/casfFyh
about: Need help with using EssentialsX? Join the MOSS Discord server for help.
- name: EssentialsX Development Discord Server
url: https://discord.gg/CUN7qVb
about: Got questions or want to discuss changes before opening your PR? Join the EssentialsX Development Discord server. (Need help? Join MOSS instead.)
@@ -1,93 +0,0 @@
<!--
EssentialsX feature submission guide
====================================
NOTE: Failure to fill out this template properly may result in your PR being
delayed or ignored without warning.
NOTE: Don't type between any arrows in the template, as this text will be
hidden. This includes this header block and any other explanation text
blocks.
Want to discuss your PR before submitting it? Join the EssentialsX Development
server: https://discord.gg/CUN7qVb
EssentialsX is GPL
------------------
By contributing to EssentialsX, you agree to license your code under the
GNU General Public License version 3, which can be found at the link below:
https://github.com/EssentialsX/Essentials/blob/2.x/LICENSE
Instructions
------------
If you are submitting a new feature, please follow the following steps:
1. Fill out the template in full.
This includes providing screenshots and a link to the original feature
request. If there isn't an existing feature request, we strongly
recommend opening a new feature request BEFORE opening your PR to
implement it, as this allows us to review whether we're likely to accept
your feature in advance, and also allows us to discuss possible
implementations for the feature. If there is no associated feature
request, your PR may be delayed or rejected without warning.
You can open a new feature request by following this link:
https://github.com/EssentialsX/Essentials/issues/new/choose
2. If you are fixing a performance issue, please use the "Bug fix" PR template
instead. The "bug fix" template is better suited to performance issues.
3. Include a demonstration.
If you are adding commands, please provide screenshots and/or a video
demonstration of the feature. Similarly, if you are adding a new API,
please include a link to example code that takes advantage of your
proposed API. This will aid us in reviewing PRs and speed up the process
significantly.
-->
### Information
<!--
Replace #nnnn with the number of the original issue. If this PR implements
features from multiple issues, you should repeat the phrase "closes #nnnn"
for each issue.
-->
This PR closes #nnnn.
### Details
**Proposed feature:**
<!-- Type a description of your proposed feature below this line. -->
**Environments tested:**
<!-- Type the OS you have used below. -->
OS:
<!-- Type the JDK version (from java -version) you have used below. -->
Java version:
<!--
Put an "x" inside the boxes for the server software you have tested this
bug fix on. If this feature does not apply to a server, strike through the server software using ~~strikethrough~~. If you have tested on other
environments, add a new line with relevant details.
-->
- [ ] Most recent Paper version (1.XX.Y, git-Paper-BUILD)
- [ ] CraftBukkit/Spigot/Paper 1.12.2
- [ ] CraftBukkit 1.8.8
**Demonstration:**
<!--
Below this block, include screenshots/log snippets from before and after as
necessary. If you have created or used a test case plugin, please link to a
download of the plugin, source code and exact version used where possible.
-->
-10
View File
@@ -1,10 +0,0 @@
You need to select a pull request template!
If you're adding a new feature, copy and paste the following parameter at the end of the URL:
?template=new-feature.md
If you're fixing a bug, copy and paste the following parameter at the end of the URL:
?template=bug-fix.md
For more information about contributing to EssentialsX, see CONTRIBUTING.md:
https://github.com/EssentialsX/Essentials/blob/2.x/CONTRIBUTING.md
-91
View File
@@ -1,91 +0,0 @@
name: Build EssentialsX
on:
push:
branches:
- 2.x
- dev/*
release:
types:
- published
jobs:
build:
name: Build and upload
runs-on: ubuntu-latest
steps:
- name: Checkout Git repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build --stacktrace
- name: Archive plugin jars on GitHub
uses: actions/upload-artifact@v3
with:
name: EssentialsX plugin jars
path: jars/
- name: Deploy to Maven repo
if: ${{ success() && github.event_name == 'push' && github.repository == 'EssentialsX/Essentials' && github.ref == 'refs/heads/2.x' }}
env:
ORG_GRADLE_PROJECT_essxUsername: ${{ secrets.ESSENTIALSX_DEPLOY_USERNAME }}
ORG_GRADLE_PROJECT_essxPassword: ${{ secrets.ESSENTIALSX_DEPLOY_PASSWORD }}
run: |
./gradlew publish
- name: Prepare Javadocs
run: |
mv Essentials/build/docs/javadoc/ javadocs/
cp -r EssentialsAntiBuild/build/docs/javadoc/ javadocs/EssentialsAntiBuild/
cp -r EssentialsChat/build/docs/javadoc/ javadocs/EssentialsChat/
cp -r EssentialsDiscord/build/docs/javadoc/ javadocs/EssentialsDiscord/
cp -r EssentialsDiscordLink/build/docs/javadoc/ javadocs/EssentialsDiscordLink/
cp -r EssentialsGeoIP/build/docs/javadoc/ javadocs/EssentialsGeoIP/
cp -r EssentialsProtect/build/docs/javadoc/ javadocs/EssentialsProtect/
cp -r EssentialsSpawn/build/docs/javadoc/ javadocs/EssentialsSpawn/
cp -r EssentialsXMPP/build/docs/javadoc/ javadocs/EssentialsXMPP/
- name: Archive Javadocs
uses: actions/upload-artifact@v3
with:
name: javadocs
path: javadocs/
publish-jd:
name: Publish Javadocs
needs: build
if: ${{ github.event_name == 'push' && github.repository == 'EssentialsX/Essentials' && github.ref == 'refs/heads/2.x' }}
runs-on: ubuntu-latest
steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Download Javadocs
uses: actions/download-artifact@v3
with:
name: javadocs
path: javadocs/
- name: Deploy Javadocs
run: npx netlify-cli deploy --dir=javadocs/ --prod --message="GitHubActionsDeploy"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_JD_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_JD_2X_SITE_ID }}
-43
View File
@@ -1,43 +0,0 @@
name: Build Pull Request
on:
push:
branches:
- mc/* # MC version updates
- pr/* # PR rebases
pull_request:
branches:
- 2.x
- mc/*
- dev/*
jobs:
build:
name: Build and upload
runs-on: ubuntu-latest
steps:
- name: Checkout Git repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build --stacktrace
- name: Archive plugin jars on GitHub
uses: actions/upload-artifact@v3
with:
name: EssentialsX plugin jars
path: jars/
+2 -10
View File
@@ -1,6 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("com.gradleup.shadow")
id("essentials.shadow-module")
}
@@ -9,13 +10,9 @@ dependencies {
exclude(group = "org.bukkit", module = "bukkit")
}
compileOnly("net.luckperms:api:5.0")
api("io.papermc:paperlib:1.0.6")
api("org.bstats:bstats-bukkit:2.2.1")
implementation("org.spongepowered:configurate-yaml:4.1.2")
implementation("org.checkerframework:checker-qual:3.14.0")
api(project(":providers:BaseProviders"))
api(project(":providers:PaperProvider"))
api(project(":providers:NMSReflectionProvider")) {
@@ -34,13 +31,11 @@ tasks.test {
}
tasks.named<ShadowJar>("shadowJar") {
dependsOn(tasks.spotlessApply)
archiveFileName.set("Essentials-OG-${rootProject.extra["FULL_VERSION"]}.jar")
destinationDirectory.set(rootProject.layout.buildDirectory.dir("libs"))
dependencies {
include(dependency("io.papermc:paperlib"))
include(dependency("org.bstats:bstats-bukkit"))
include(dependency("org.bstats:bstats-base"))
include(dependency("org.spongepowered:configurate-yaml"))
include(dependency("org.spongepowered:configurate-core"))
include(dependency("org.yaml:snakeyaml"))
@@ -52,14 +47,11 @@ tasks.named<ShadowJar>("shadowJar") {
include(project(":providers:1_8Provider"))
include(project(":providers:1_12Provider"))
}
relocate("io.papermc.lib", "com.earth2me.essentials.paperlib")
relocate("org.bstats", "com.earth2me.essentials.libs.bstats")
relocate("org.spongepowered.configurate","com.earth2me.essentials.libs.configurate")
relocate("org.yaml.snakeyaml", "com.earth2me.essentials.libs.snakeyaml")
relocate("io.leangen.geantyref", "com.earth2me.essentials.libs.geantyref")
relocate("org.checkerframework", "com.earth2me.essentials.libs.checkerframework")
minimize { include(dependency("org.checkerframework:checker-qual")) }
}
@@ -29,7 +29,6 @@ import com.earth2me.essentials.items.AbstractItemDb;
import com.earth2me.essentials.items.CustomItemResolver;
import com.earth2me.essentials.items.FlatItemDb;
import com.earth2me.essentials.items.LegacyItemDb;
import com.earth2me.essentials.metrics.MetricsWrapper;
import com.earth2me.essentials.perm.PermissionsDefaults;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.signs.SignBlockListener;
@@ -163,7 +162,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
private transient ExecuteTimer execTimer;
private transient MailService mail;
private transient I18n i18n;
private transient MetricsWrapper metrics;
private transient EssentialsTimer timer;
private transient SpawnerItemProvider spawnerItemProvider;
private transient SpawnerBlockProvider spawnerBlockProvider;
@@ -481,8 +479,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
}
});
metrics = new MetricsWrapper(this, 858, true);
execTimer.mark("Init(External)");
final String timeroutput = execTimer.end();
@@ -719,7 +715,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
@Override
public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args) {
metrics.markCommand(command.getName(), true);
return onCommandEssentials(sender, command, commandLabel, args, Essentials.class.getClassLoader(), "com.earth2me.essentials.commands.Command", "essentials.", null);
}
@@ -3,22 +3,14 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.NumberUtil;
import com.earth2me.essentials.utils.VersionUtil;
import com.google.common.collect.Lists;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.HangingSign;
import org.bukkit.block.data.type.WallHangingSign;
import org.bukkit.block.data.type.WallSign;
import org.bukkit.block.sign.Side;
import org.bukkit.entity.Player;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.util.Vector;
import java.util.Collections;
import java.util.List;
@@ -40,7 +32,7 @@ public class Commandeditsign extends EssentialsCommand {
if (!(target.getState() instanceof Sign)) {
throw new Exception(tl("editsignCommandTarget"));
}
final ModifiableSign sign = wrapSign((Sign) target.getState(), user);
final Sign sign = (Sign) target.getState();
try {
if (args[0].equalsIgnoreCase("set") && args.length > 2) {
final String[] existingLines = sign.getLines();
@@ -116,18 +108,8 @@ public class Commandeditsign extends EssentialsCommand {
}
}
private boolean callSignEvent(final ModifiableSign sign, final Player player, final String[] lines) {
final SignChangeEvent event;
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_20_1_R01)) {
if (sign.isWaxed() && !player.hasPermission("essentials.editsign.waxed.exempt")) {
return true;
}
event = new SignChangeEvent(sign.getBlock(), player, lines, sign.isFront() ? Side.FRONT : Side.BACK);
} else {
//noinspection deprecation
event = new SignChangeEvent(sign.getBlock(), player, lines);
}
private boolean callSignEvent(final Sign sign, final Player player, final String[] lines) {
final SignChangeEvent event = new SignChangeEvent(sign.getBlock(), player, lines);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
if (ess.getSettings().isDebug()) {
@@ -153,7 +135,7 @@ public class Commandeditsign extends EssentialsCommand {
final int line = Integer.parseInt(args[1]);
final Block target = user.getTargetBlock(5);
if (target.getState() instanceof Sign && line <= 4) {
final ModifiableSign sign = wrapSign((Sign) target.getState(), user);
final Sign sign = (Sign) target.getState();
return Lists.newArrayList(FormatUtil.unformatString(user, "essentials.editsign", sign.getLine(line - 1)));
}
return Collections.emptyList();
@@ -161,105 +143,5 @@ public class Commandeditsign extends EssentialsCommand {
return Collections.emptyList();
}
}
private ModifiableSign wrapSign(final Sign sign, final User user) {
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_20_1_R01)) {
final Vector eyeLocLessSign = user.getBase().getEyeLocation().toVector().subtract(sign.getLocation().add(.5, .5, .5).toVector());
final BlockData signBlockData = sign.getBlockData();
final BlockFace signDirection;
if (signBlockData instanceof org.bukkit.block.data.type.Sign) {
signDirection = ((org.bukkit.block.data.type.Sign) signBlockData).getRotation();
} else if (signBlockData instanceof WallSign) {
signDirection = ((WallSign) signBlockData).getFacing();
} else if (signBlockData instanceof HangingSign) {
signDirection = ((HangingSign) signBlockData).getRotation();
} else if (signBlockData instanceof WallHangingSign) {
signDirection = ((WallHangingSign) signBlockData).getFacing();
} else {
throw new IllegalStateException("Unknown block data for sign: " + signBlockData.getClass());
}
final Side side = eyeLocLessSign.dot(signDirection.getDirection()) > 0 ? Side.FRONT : Side.BACK;
return new ModifiableSign(sign) {
@Override
String[] getLines() {
return sign.getSide(side).getLines();
}
@Override
String getLine(int line) {
return sign.getSide(side).getLine(line);
}
@Override
void setLine(int line, String text) {
sign.getSide(side).setLine(line, text);
}
@Override
boolean isFront() {
return side == Side.FRONT;
}
@Override
boolean isWaxed() {
return sign.isWaxed();
}
};
}
return new ModifiableSign(sign) {
@Override
String[] getLines() {
return sign.getLines();
}
@Override
String getLine(int line) {
return sign.getLine(line);
}
@Override
void setLine(int line, String text) {
sign.setLine(line, text);
}
@Override
boolean isFront() {
return true;
}
@Override
boolean isWaxed() {
return false;
}
};
}
private abstract static class ModifiableSign {
protected final Sign sign;
protected ModifiableSign(final Sign sign) {
this.sign = sign;
}
abstract String getLine(int line);
abstract String[] getLines();
abstract void setLine(int line, String text);
abstract boolean isFront();
abstract boolean isWaxed();
Block getBlock() {
return sign.getBlock();
}
void update() {
sign.update();
}
}
}
@@ -1,107 +0,0 @@
package com.earth2me.essentials.metrics;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.economy.EconomyLayer;
import com.earth2me.essentials.economy.EconomyLayers;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.AdvancedBarChart;
import org.bstats.charts.CustomChart;
import org.bstats.charts.DrilldownPie;
import org.bstats.charts.MultiLineChart;
import org.bstats.charts.SimplePie;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Map;
public class MetricsWrapper {
private final Essentials ess;
private final Metrics metrics;
private final JavaPlugin plugin;
private final Map<String, Boolean> commands = new HashMap<>();
public MetricsWrapper(final JavaPlugin plugin, final int pluginId, final boolean includeCommands) {
this.plugin = plugin;
this.ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
this.metrics = new Metrics(plugin, pluginId);
plugin.getLogger().info("Starting Metrics. Opt-out using the global bStats config.");
addPermsChart();
addEconomyChart();
addReleaseBranchChart();
// bStats' backend currently doesn't support multi-line charts or advanced bar charts
// These are included for when bStats is ready to accept this data
addVersionHistoryChart();
if (includeCommands) addCommandsChart();
}
public void markCommand(final String command, final boolean state) {
commands.put(command, state);
}
public void addCustomChart(final CustomChart chart) {
metrics.addCustomChart(chart);
}
private void addPermsChart() {
metrics.addCustomChart(new DrilldownPie("permsPlugin", () -> {
final Map<String, Map<String, Integer>> result = new HashMap<>();
final String handler = ess.getPermissionsHandler().getName();
final Map<String, Integer> backend = new HashMap<>();
backend.put(ess.getPermissionsHandler().getBackendName(), 1);
result.put(handler, backend);
return result;
}));
}
private void addEconomyChart() {
metrics.addCustomChart(new DrilldownPie("econPlugin", () -> {
final Map<String, Map<String, Integer>> result = new HashMap<>();
final Map<String, Integer> backend = new HashMap<>();
final EconomyLayer layer = EconomyLayers.getSelectedLayer();
if (layer != null) {
backend.put(layer.getBackendName(), 1);
result.put(layer.getPluginName(), backend);
} else {
backend.put("Essentials", 1);
result.put("Essentials", backend);
}
return result;
}));
}
private void addVersionHistoryChart() {
metrics.addCustomChart(new MultiLineChart("versionHistory", () -> {
final HashMap<String, Integer> result = new HashMap<>();
result.put(plugin.getDescription().getVersion(), 1);
return result;
}));
}
private void addReleaseBranchChart() {
metrics.addCustomChart(new SimplePie("releaseBranch", ess.getUpdateChecker()::getVersionBranch));
}
private void addCommandsChart() {
for (final String command : plugin.getDescription().getCommands().keySet()) {
markCommand(command, false);
}
metrics.addCustomChart(new AdvancedBarChart("commands", () -> {
final Map<String, int[]> result = new HashMap<>();
for (final Map.Entry<String, Boolean> entry : commands.entrySet()) {
if (entry.getValue()) {
result.put(entry.getKey(), new int[]{1, 0});
} else {
result.put(entry.getKey(), new int[]{0, 1});
}
}
return result;
}));
}
}
-13
View File
@@ -1,13 +0,0 @@
plugins {
id("essentials.module-conventions")
}
dependencies {
compileOnly(project(":EssentialsX"))
}
tasks.jar {
archiveFileName.set("EssentialsXSpawn-OG-${rootProject.extra["FULL_VERSION"]}.jar")
destinationDirectory.set(rootProject.layout.buildDirectory.dir("libs"))
}
@@ -1,29 +0,0 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.User;
import com.earth2me.essentials.commands.EssentialsCommand;
import org.bukkit.Server;
import java.util.Collections;
import java.util.List;
import static com.earth2me.essentials.I18n.tl;
public class Commandsetspawn extends EssentialsCommand {
public Commandsetspawn() {
super("setspawn");
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) {
final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
((SpawnStorage) module).setSpawn(user.getLocation(), group);
user.sendMessage(tl("spawnSet", group));
}
@Override
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
return Collections.emptyList();
}
}
@@ -1,92 +0,0 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NoChargeException;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import net.essentialsx.api.v2.events.UserTeleportSpawnEvent;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import static com.earth2me.essentials.I18n.tl;
public class Commandspawn extends EssentialsCommand {
public Commandspawn() {
super("spawn");
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
if (args.length > 0 && user.isAuthorized("essentials.spawn.others")) {
final User otherUser = getPlayer(server, user, args, 0);
final CompletableFuture<Boolean> future = new CompletableFuture<>();
future.thenAccept(success -> {
if (success) {
if (!otherUser.equals(user)) {
otherUser.sendMessage(tl("teleportAtoB", user.getDisplayName(), "spawn"));
}
}
});
respawn(user.getSource(), user, otherUser, charge, commandLabel, future);
} else {
respawn(user.getSource(), user, user, charge, commandLabel, new CompletableFuture<>());
}
throw new NoChargeException();
}
@Override
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
if (args.length == 0) {
throw new NotEnoughArgumentsException();
}
final User user = getPlayer(server, args, 0, true, false);
final CompletableFuture<Boolean> future = new CompletableFuture<>();
respawn(sender, null, user, null, commandLabel, future);
future.thenAccept(success -> {
if (success) {
user.sendMessage(tl("teleportAtoB", Console.DISPLAY_NAME, "spawn"));
}
});
}
@Override
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
if (args.length == 1 && sender.isAuthorized("essentials.spawn.others", ess)) {
return getPlayers(server, sender);
}
return Collections.emptyList();
}
private void respawn(final CommandSource sender, final User teleportOwner, final User teleportee, final Trade charge, final String commandLabel, final CompletableFuture<Boolean> future) throws Exception {
final Location spawn = ((SpawnStorage) this.module).getSpawn(teleportee.getGroup());
if (spawn == null) {
return;
}
sender.sendMessage(tl("teleporting", spawn.getWorld().getName(), spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()));
future.exceptionally(e -> {
showError(sender.getSender(), e, commandLabel);
return false;
});
final UserTeleportSpawnEvent spawnEvent = new UserTeleportSpawnEvent(teleportee, teleportOwner, teleportee.getGroup(), spawn);
ess.getServer().getPluginManager().callEvent(spawnEvent);
if (spawnEvent.isCancelled()) {
return;
}
if (teleportOwner == null) {
teleportee.getAsyncTeleport().now(spawn, false, TeleportCause.COMMAND, future);
return;
}
teleportOwner.getAsyncTeleport().teleportPlayer(teleportee, spawn, charge, TeleportCause.COMMAND, future);
}
}
@@ -1,94 +0,0 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.EssentialsLogger;
import com.earth2me.essentials.metrics.MetricsWrapper;
import net.ess3.api.IEssentials;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.earth2me.essentials.I18n.tl;
public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
private transient IEssentials ess;
private transient SpawnStorage spawns;
private transient MetricsWrapper metrics = null;
@Override
public void onEnable() {
EssentialsLogger.updatePluginLogger(this);
final PluginManager pluginManager = getServer().getPluginManager();
ess = (IEssentials) pluginManager.getPlugin("Essentials");
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
getLogger().log(Level.WARNING, tl("versionMismatchAll"));
}
if (!ess.isEnabled()) {
this.setEnabled(false);
return;
}
spawns = new SpawnStorage(ess);
ess.addReloadListener(spawns);
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
final EventPriority respawnPriority = ess.getSettings().getRespawnPriority();
if (respawnPriority != null) {
pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, respawnPriority, (ll, event) ->
((EssentialsSpawnPlayerListener) ll).onPlayerRespawn((PlayerRespawnEvent) event), this);
}
final EventPriority joinPriority = ess.getSettings().getSpawnJoinPriority();
if (joinPriority != null) {
pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, joinPriority, (ll, event) ->
((EssentialsSpawnPlayerListener) ll).onPlayerJoin((PlayerJoinEvent) event), this);
}
if (metrics == null) {
metrics = new MetricsWrapper(this, 3817, true);
}
}
public static Logger getWrappedLogger() {
try {
return EssentialsLogger.getLoggerProvider("EssentialsSpawn");
} catch (Throwable ignored) {
// In case Essentials isn't installed/loaded
return Logger.getLogger("EssentialsSpawn");
}
}
@Override
public void onDisable() {
}
@Override
public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args) {
metrics.markCommand(command.getName(), true);
return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns);
}
@Override
public void setSpawn(final Location loc, final String group) {
if (group == null) {
throw new IllegalArgumentException("Null group");
}
spawns.setSpawn(loc, group);
}
@Override
public Location getSpawn(final String group) {
if (group == null) {
throw new IllegalArgumentException("Null group");
}
return spawns.getSpawn(group);
}
}
@@ -1,163 +0,0 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.Kit;
import com.earth2me.essentials.OfflinePlayerStub;
import com.earth2me.essentials.User;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.SimpleTextPager;
import com.earth2me.essentials.utils.VersionUtil;
import net.ess3.api.IEssentials;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.earth2me.essentials.I18n.tl;
class EssentialsSpawnPlayerListener implements Listener {
private static final Logger logger = EssentialsSpawn.getWrappedLogger();
private final transient IEssentials ess;
private final transient SpawnStorage spawns;
EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns) {
super();
this.ess = ess;
this.spawns = spawns;
}
void onPlayerRespawn(final PlayerRespawnEvent event) {
final User user = ess.getUser(event.getPlayer());
if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) {
return;
}
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01) && event.isAnchorSpawn() && ess.getSettings().isRespawnAtAnchor()) {
return;
}
if (ess.getSettings().getRespawnAtHome()) {
final Location home;
Location bed = null;
if (ess.getSettings().isRespawnAtBed()) {
// cannot nuke this sync load due to the event being sync so it would hand either way
bed = user.getBase().getBedSpawnLocation();
}
if (bed != null) {
home = bed;
} else {
home = user.getHome(user.getLocation());
}
if (home != null) {
event.setRespawnLocation(home);
return;
}
}
final Location spawn = spawns.getSpawn(user.getGroup());
if (spawn != null) {
event.setRespawnLocation(spawn);
}
}
void onPlayerJoin(final PlayerJoinEvent event) {
ess.runTaskAsynchronously(() -> delayedJoin(event.getPlayer()));
}
private void delayedJoin(final Player player) {
if (player.hasPlayedBefore()) {
logger.log(Level.FINE, "Old player join");
final List<String> spawnOnJoinGroups = ess.getSettings().getSpawnOnJoinGroups();
if (!spawnOnJoinGroups.isEmpty()) {
final User user = ess.getUser(player);
if (ess.getSettings().isUserInSpawnOnJoinGroup(user) && !user.isAuthorized("essentials.spawn-on-join.exempt")) {
ess.scheduleSyncDelayedTask(() -> {
final Location spawn = spawns.getSpawn(user.getGroup());
if (spawn == null) {
return;
}
final CompletableFuture<Boolean> future = new CompletableFuture<>();
future.exceptionally(e -> {
ess.showError(user.getSource(), e, "spawn-on-join");
return false;
});
user.getAsyncTeleport().nowUnsafe(spawn, TeleportCause.PLUGIN, future);
});
}
}
return;
}
final User user = ess.getUser(player);
if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn())) {
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
}
ess.scheduleSyncDelayedTask(() -> {
if (!user.getBase().isOnline()) {
return;
}
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
if (ess.getSettings().getAnnounceNewPlayers()) {
final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user.getSource(), ess);
final SimpleTextPager pager = new SimpleTextPager(output);
for (final String line : pager.getLines()) {
ess.broadcastMessage(user, line);
}
}
final String kitName = ess.getSettings().getNewPlayerKit();
if (!kitName.isEmpty()) {
try {
final Kit kit = new Kit(kitName.toLowerCase(Locale.ENGLISH), ess);
kit.expandItems(user);
} catch (final Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
}
}
logger.log(Level.FINE, "New player join");
}, 2L);
}
private class NewPlayerTeleport implements Runnable {
private final transient User user;
NewPlayerTeleport(final User user) {
this.user = user;
}
@Override
public void run() {
if (user.getBase() instanceof OfflinePlayerStub || !user.getBase().isOnline()) {
return;
}
final Location spawn = spawns.getSpawn(ess.getSettings().getNewbieSpawn());
if (spawn != null) {
final CompletableFuture<Boolean> future = new CompletableFuture<>();
future.exceptionally(e -> {
logger.log(Level.WARNING, tl("teleportNewPlayerError"), e);
return false;
});
user.getAsyncTeleport().now(spawn, false, TeleportCause.PLUGIN, future);
}
}
}
}
@@ -1,25 +0,0 @@
package com.earth2me.essentials.spawn;
import org.bukkit.Location;
import org.bukkit.plugin.Plugin;
public interface IEssentialsSpawn extends Plugin {
/**
* Sets the spawn for a given group to a given location.
*
* @param loc The location to set the spawn to
* @param group The group to set the spawn of, or 'default' for the default spawn
* @throws IllegalArgumentException If group is null
*/
void setSpawn(Location loc, String group);
/**
* Gets the spawn location for a given group.
*
* @param group The group to get the spawn of, or 'default' for the default spawn
* @return The spawn location set for the given group
* @throws IllegalArgumentException If group is null
*/
Location getSpawn(String group);
}
@@ -1,72 +0,0 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.IConf;
import com.earth2me.essentials.IEssentialsModule;
import com.earth2me.essentials.config.EssentialsConfiguration;
import com.earth2me.essentials.config.entities.LazyLocation;
import net.ess3.api.IEssentials;
import org.bukkit.Location;
import org.bukkit.World;
import java.io.File;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class SpawnStorage implements IEssentialsModule, IConf {
private final IEssentials ess;
private final EssentialsConfiguration config;
private final Map<String, LazyLocation> spawns = new HashMap<>();
SpawnStorage(final IEssentials ess) {
this.ess = ess;
this.config = new EssentialsConfiguration(new File(ess.getDataFolder(), "spawn.yml"));
reloadConfig();
}
@Override
public void reloadConfig() {
synchronized (spawns) {
config.load();
spawns.clear();
// need to outsource this because transitive relocations :)
spawns.putAll(config.getLocationSectionMap("spawns"));
}
}
void setSpawn(final Location loc, String group) {
group = group.toLowerCase(Locale.ENGLISH);
synchronized (spawns) {
spawns.put(group, LazyLocation.fromLocation(loc));
config.setProperty("spawns." + group, loc);
config.save();
}
}
Location getSpawn(String group) {
if (group == null) {
return getWorldSpawn();
}
group = group.toLowerCase(Locale.ENGLISH);
synchronized (spawns) {
if (!spawns.containsKey(group)) {
if (spawns.containsKey("default")) {
return spawns.get("default").location();
}
return getWorldSpawn();
}
return spawns.get(group).location();
}
}
private Location getWorldSpawn() {
for (final World world : ess.getServer().getWorlds()) {
if (world.getEnvironment() != World.Environment.NORMAL) {
continue;
}
return world.getSpawnLocation();
}
return ess.getServer().getWorlds().get(0).getSpawnLocation();
}
}
@@ -1,76 +0,0 @@
package net.essentialsx.api.v2.events;
import net.ess3.api.IUser;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called before a user is teleported to spawn via the /spawn command.
*/
public class UserTeleportSpawnEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final IUser user;
private final IUser controller;
private final String spawnGroup;
private final Location target;
private boolean cancelled = false;
public UserTeleportSpawnEvent(final IUser user, final IUser controller, final String spawnGroup, final Location target) {
this.user = user;
this.controller = controller;
this.spawnGroup = spawnGroup;
this.target = target;
}
/**
* @return The user who is being teleported to spawn.
*/
public IUser getUser() {
return user;
}
/**
* @return The user who caused teleport to spawn or null if the teleport was caused by the console.
*/
public IUser getController() {
return controller;
}
/**
* The {@link #getUser() user's} group used to determine their spawn location.
* @return The user's group.
*/
public String getSpawnGroup() {
return spawnGroup;
}
/**
* The spawn location of the {@link #getUser() user's} {@link #getSpawnGroup() group}.
* @return The spawn location of the user's group.
*/
public Location getSpawnLocation() {
return target;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(final boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
@@ -1,23 +0,0 @@
# This determines the command prefix when there are conflicts (/name:home, /name:help, etc.)
name: EssentialsSpawn
main: com.earth2me.essentials.spawn.EssentialsSpawn
# Note to developers: This next line cannot change, or the automatic versioning system will break.
version: ${full.version}
website: https://essentialsx.net/
description: Provides spawn control commands, utilizing Essentials.
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, SupaHam, mdcfe, DoNotSpamPls, JRoy]
depend: [Essentials]
api-version: 1.13
commands:
setspawn:
description: Sets the spawn point to your current position.
usage: /<command> <group>
aliases: [esetspawn]
spawn:
description: Teleports to the spawn point.
usage: /<command> [player]
aliases: [espawn]
permissions:
essentials.spawn-on-join.exempt:
default: false
description: "Bypass spawn teleportation on join when spawn-on-join is true."
+1 -4
View File
@@ -9,9 +9,6 @@ repositories {
dependencies {
implementation("net.kyori:indra-common:3.1.1")
implementation("xyz.jpenilla:run-task:2.1.0")
implementation(
"com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:8.1.1"
)
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:8.3.6")
}
@@ -3,14 +3,11 @@ import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id("java")
id("net.kyori.indra")
id("net.kyori.indra.checkstyle")
id("net.kyori.indra.publishing")
}
val baseExtension = extensions.create<EssentialsBaseExtension>("essentials", project)
val checkstyleVersion = "8.36.2"
val spigotVersion = "1.20.1-R0.1-SNAPSHOT"
val spigotVersion = "1.19.4-R0.1-SNAPSHOT"
val junit5Version = "5.7.0"
val mockitoVersion = "3.2.0"
@@ -32,30 +29,9 @@ afterEvaluate {
api("org.spigotmc", "spigot-api", spigotVersion)
}
}
if (baseExtension.injectBstats.get()) {
dependencies {
implementation("org.bstats", "bstats-bukkit", "1.8")
}
}
}
tasks {
// Version Injection
processResources {
// Always process resources if version string or git branch changes
val fullVersion = rootProject.ext["FULL_VERSION"] as String
val gitBranch = rootProject.ext["GIT_BRANCH"] as String
inputs.property("fullVersion", fullVersion)
inputs.property("gitBranch", gitBranch)
filter<ReplaceTokens>(
"beginToken" to "\${",
"endToken" to "}",
"tokens" to mapOf(
"full.version" to fullVersion,
"git.branch" to gitBranch
)
)
}
compileJava {
options.compilerArgs.add("-Xlint:-deprecation")
}
@@ -81,41 +57,11 @@ configurations.all {
}
indra {
checkstyle(checkstyleVersion)
github("EssentialsX", "Essentials")
gpl3OnlyLicense()
publishReleasesTo("essx", "https://repo.essentialsx.net/releases/")
publishSnapshotsTo("essx", "https://repo.essentialsx.net/snapshots/")
configurePublications {
pom {
description.set("The essential plugin suite for Minecraft servers.")
url.set("https://essentialsx.net")
developers {
developer {
id.set("mdcfe")
name.set("MD")
email.set("md@n3fs.co.uk")
}
developer {
id.set("pop4959")
}
developer {
id.set("JRoy")
name.set("Josh Roy")
}
}
ciManagement {
system.set("Jenkins")
url.set("https://ci.ender.zone/job/EssentialsX")
}
}
}
javaVersions {
target(8)
target(17)
minimumToolchain(17)
}
}
@@ -2,7 +2,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("essentials.module-conventions")
id("com.github.johnrengelman.shadow")
id("com.gradleup.shadow")
}
tasks {
+24 -10
View File
@@ -1,20 +1,34 @@
plugins {
eclipse
id("java")
id("com.diffplug.spotless") version "7.0.4"
id("essentials.parent-build-logic")
}
group = "net.essentialsx"
version = "2.21.0-SNAPSHOT"
val gitCommit: String = indraGit.commit()?.abbreviate(7)?.name() ?: "unknown"
val gitDepth: Int = GitUtil.commitsSinceLastTag(project) ?: 0
val gitBranch: String = GitUtil.headBranchName(project) ?: "detached"
version = "1.19.4"
extra.apply {
this["GIT_COMMIT"] = gitCommit
this["GIT_DEPTH"] = gitDepth
this["GIT_BRANCH"] = gitBranch
this["FULL_VERSION"] =
version.toString().replace("-SNAPSHOT", "-dev+${gitDepth}-${gitCommit}")
extra.apply { this["FULL_VERSION"] = version.toString() }
subprojects {
apply(plugin = "com.diffplug.spotless")
plugins.withId("java") {
the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.GRAAL_VM)
}
}
}
spotless {
java {
removeUnusedImports()
palantirJavaFormat()
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) }
target("build.gradle.kts", "settings.gradle.kts")
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+16 -17
View File
@@ -1,50 +1,49 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://repo.purpurmc.org/snapshots/")
maven("https://repo.purpurmc.org/snapshots/")
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://jitpack.io") {
content { includeGroup("com.github.milkbowl") }
content { includeGroup("com.github.MinnDevelopment") }
}
maven("https://repo.codemc.org/repository/maven-public") {
content { includeGroup("org.bstats") }
}
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") {
content { includeGroup("me.clip") }
}
maven("https://libraries.minecraft.net/") {
content { includeGroup("com.mojang") }
}
maven("https://libraries.minecraft.net/") { content { includeGroup("com.mojang") } }
mavenCentral {
content { includeGroup("net.dv8tion") }
content { includeGroup("net.kyori") }
content { includeGroup("org.apache.logging.log4j") }
content { includeGroup("com.google.googlejavaformat") }
}
}
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
}
pluginManagement {
repositories { gradlePluginPortal() }
plugins {
id("com.diffplug.spotless") version "7.0.4"
id("com.gradleup.shadow") version "8.3.6"
}
includeBuild("build-logic")
}
rootProject.name = "EssentialsXParent"
// Modules
sequenceOf(
"",
"Spawn",
).forEach {
include(":EssentialsX$it")
project(":EssentialsX$it").projectDir = file("Essentials$it")
}
include(":EssentialsX")
project(":EssentialsX").projectDir = file("Essentials")
// Providers
include(":providers:BaseProviders")
include(":providers:NMSReflectionProvider")
include(":providers:PaperProvider")
include(":providers:1_8Provider")
include(":providers:1_12Provider")