mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Merge https://github.com/EssentialsX/Essentials into 1.16
This commit is contained in:
commit
e7aeb5a5d7
23 changed files with 2006 additions and 152 deletions
80
.github/ISSUE_TEMPLATE/help.md
vendored
80
.github/ISSUE_TEMPLATE/help.md
vendored
|
@ -5,42 +5,82 @@ labels: 'type: question'
|
|||
|
||||
---
|
||||
|
||||
<!-- EssentialsX help guide
|
||||
<!-- EssentialsX help request guide
|
||||
|
||||
Don't write inside the arrows as they will be hidden when you post your issue.
|
||||
NOTE: Failure to fill out this template properly may result in your issue being
|
||||
delayed or ignored.
|
||||
|
||||
Want faster support? Come join our Discord server to get help sooner:
|
||||
https://discord.gg/F7gexAQ
|
||||
Don't type between any arrows in the template, as this text will be hidden.
|
||||
This includes this header block and any other explanatory text blocks.
|
||||
|
||||
Want faster support? Come join our Discord server to get help from both
|
||||
developers and community members: https://discord.gg/F7gexAQ
|
||||
|
||||
If you're happy to wait (or you were sent here from Discord), read on:
|
||||
|
||||
1. Fill out the template.
|
||||
This will help us understand what problem you've encountered and help us
|
||||
find a solution.
|
||||
|
||||
2. Check the Common Issues page.
|
||||
1. Check the Common Issues page.
|
||||
Read through the wiki page to see if you've encountered a regular issue:
|
||||
https://essentialsx.net/wiki/Common-Issues.html
|
||||
|
||||
3. Delete this line and all above lines before posting your issue! -->
|
||||
2. Fill out the template.
|
||||
Run the commands in the console. Don't just put "latest" as a version, or
|
||||
we will ignore it. This will help us understand what problem you've
|
||||
encountered and help us find a solution.
|
||||
|
||||
3. 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 when trying to solve issues in the
|
||||
future.
|
||||
**DO NOT drag logs into this text box!**
|
||||
|
||||
4. If you are encountering a performance issue, please include a link to a
|
||||
Timings and/or profiler report.
|
||||
|
||||
-->
|
||||
|
||||
### Information
|
||||
|
||||
Full output of `/ess version`:
|
||||
**Full output of `/ess version`:**
|
||||
<!--
|
||||
Run /ess version in the console, then paste the full output of the command
|
||||
between the ```s.
|
||||
-->
|
||||
```
|
||||
|
||||
<!-- Replace this with the command output -->
|
||||
```
|
||||
|
||||
**Server log:** <!-- Upload `logs/latest.log` to https://gist.github.com/ -->
|
||||
**Server startup log:**
|
||||
<!--
|
||||
Restart your server and upload `logs/latest.log` to
|
||||
https://gist.github.com/. You may redact sensitive data (such as IP
|
||||
addresses), but you should make it clear what data was removed. Once
|
||||
uploaded, paste the link below this block.
|
||||
-->
|
||||
|
||||
|
||||
**EssentialsX config:**
|
||||
<!--
|
||||
Upload `plugins/Essentials/config.yml` (and other config files if relevant)
|
||||
to https://gist.github.com/ then paste the link below this block.
|
||||
-->
|
||||
|
||||
**EssentialsX config** <!-- Upload `plugins/Essentials/config.yml` to https://gist.github.com/ -->
|
||||
|
||||
### Help request
|
||||
|
||||
**Problem**
|
||||
<!-- What problem did you encounter? -->
|
||||
**Problem:**
|
||||
<!-- What problem did you encounter? Type below this line. -->
|
||||
|
||||
**What I have tried**
|
||||
<!-- What have you tried so far? -->
|
||||
**What I have tried:**
|
||||
<!-- What have you tried so far? Type below this line. -->
|
||||
|
||||
**Screenshots**
|
||||
<!-- If relevant, include any screenshots here. -->
|
||||
**Console stack trace:**
|
||||
<!--
|
||||
If you are reporting an error in the console, paste it between the ```s.
|
||||
-->
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
**Screenshots:**
|
||||
<!-- If relevant, include any screenshots or a video below this line. -->
|
||||
|
|
64
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
64
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
|
@ -7,7 +7,11 @@ labels: 'bug: unconfirmed'
|
|||
|
||||
<!-- EssentialsX bug reporting guide
|
||||
|
||||
Don't put anything inside this block, as it won't be included in the issue.
|
||||
NOTE: Failure to fill out this template properly may result in your issue being
|
||||
delayed or ignored.
|
||||
|
||||
Don't type between any arrows in the template, as this text will be hidden.
|
||||
This includes this header block and any other explanatory text blocks.
|
||||
|
||||
If you are reporting a bug, please follow the following steps:
|
||||
|
||||
|
@ -19,7 +23,7 @@ If you are reporting a bug, please follow the following steps:
|
|||
Copy and paste any logs into https://gist.github.com/, then paste a
|
||||
link to them in the relevant parts of the template. Avoid using
|
||||
Hastebin or Pastebin, as this makes providing support more difficult.
|
||||
**DO NOT drag files into this box!**
|
||||
**DO NOT drag files into this text box!**
|
||||
|
||||
3. If you are reporting a performance issue, please include a link to a
|
||||
Timings and/or profiler report.
|
||||
|
@ -27,33 +31,53 @@ If you are reporting a bug, please follow the following steps:
|
|||
4. If you are reporting a bug with commands or something else in-game,
|
||||
please include screenshots to help us diagnose the problem.
|
||||
|
||||
5. Make sure not to write between the arrows, as anything there will be
|
||||
hidden.
|
||||
|
||||
6. Delete this line and all above lines before posting your issue! -->
|
||||
-->
|
||||
|
||||
### Information
|
||||
|
||||
**Full output of `/ess version`**:
|
||||
|
||||
```
|
||||
<!-- Run the command in your console, and copy and paste the whole output here -->
|
||||
**Full output of `/ess version`:**
|
||||
<!--
|
||||
Run /ess version in the console, then paste the full output of the command
|
||||
between the ```s.
|
||||
-->
|
||||
```
|
||||
|
||||
**Server log**: <!-- Upload `logs/latest.log` to https://gist.github.com/, replace this with link -->
|
||||
```
|
||||
|
||||
**Server startup log:**
|
||||
<!--
|
||||
Restart your server and upload `logs/latest.log` to
|
||||
https://gist.github.com/. You may redact sensitive data (such as IP
|
||||
addresses), but you should make it clear what data was removed. Once
|
||||
uploaded, paste the link below this block.
|
||||
-->
|
||||
|
||||
|
||||
**EssentialsX config:**
|
||||
<!--
|
||||
Upload `plugins/Essentials/config.yml` (and other config files if relevant)
|
||||
to https://gist.github.com/ then paste the link below this block.
|
||||
-->
|
||||
|
||||
**EssentialsX config**: <!-- Upload `plugins/Essentials/config.yml` to https://gist.github.com/, replace this with link -->
|
||||
|
||||
### Details
|
||||
|
||||
**Description**
|
||||
<!-- Replace this with a brief summary of the bug. -->
|
||||
**Description:**
|
||||
<!-- What is the bug? Type a brief summary below this line. -->
|
||||
|
||||
**Steps to reproduce**
|
||||
<!-- Replace this with exactly what you did to cause the bug. -->
|
||||
**Steps to reproduce:**
|
||||
<!-- How did you cause it? Describe what you did to cause the bug below. -->
|
||||
|
||||
**Expected behavior**
|
||||
<!-- Replace this with what you expected to happen. -->
|
||||
**Expected behavior:**
|
||||
<!-- What did you expect to happen? Type below this line. -->
|
||||
|
||||
**Screenshots**
|
||||
<!-- Replace this with screenshots, if necessary. -->
|
||||
**Console stack trace:**
|
||||
<!--
|
||||
If you are encountering an error in the console, paste it between the ```s.
|
||||
-->
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
**Screenshots:**
|
||||
<!-- If necessary, include screenshots or a video below this line. -->
|
||||
|
|
24
.github/ISSUE_TEMPLATE/request-a-feature.md
vendored
24
.github/ISSUE_TEMPLATE/request-a-feature.md
vendored
|
@ -7,8 +7,11 @@ labels: 'type: enhancement'
|
|||
|
||||
<!-- EssentialsX feature request guide
|
||||
|
||||
Fill out the template. Don't write inside the arrows as they will be hidden
|
||||
when you post your issue.
|
||||
NOTE: Failure to fill out this template properly may result in your issue being
|
||||
delayed or ignored.
|
||||
|
||||
Don't type between any arrows in the template, as this text will be hidden.
|
||||
This includes this header block and any other explanatory text blocks.
|
||||
|
||||
Not sure if your feature fits in EssentialsX? Feel free to ask on our Discord
|
||||
server: https://discord.gg/F7gexAQ
|
||||
|
@ -27,20 +30,23 @@ If you have a feature suggestion for EssentialsX, read the following tips:
|
|||
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 at https://github.com/EssentialsX/Essentials/releases
|
||||
to see if the feature was recently added.
|
||||
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.
|
||||
|
||||
5. Delete this line and all above lines before posting your issue! -->
|
||||
-->
|
||||
|
||||
### Feature request
|
||||
|
||||
**Feature description**
|
||||
<!-- What feature are you suggesting? -->
|
||||
**Feature description:**
|
||||
<!-- What feature are you suggesting? Type below this line. -->
|
||||
|
||||
**How the feature is useful**
|
||||
<!-- How is the feature useful to players, server owners and/or developers? -->
|
||||
**How the feature is useful:**
|
||||
<!--
|
||||
How is the feature useful to players, server owners and/or developers?
|
||||
Type below this block.
|
||||
-->
|
||||
|
|
82
.github/PULL_REQUEST_TEMPLATE/bug-fix.md
vendored
Normal file
82
.github/PULL_REQUEST_TEMPLATE/bug-fix.md
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
---
|
||||
name: Bug fix
|
||||
about: Use this if your PR fixes a bug in EssentialsX.
|
||||
labels: 'type: bugfix'
|
||||
---
|
||||
|
||||
<!-- EssentialsX bug fix submission guide
|
||||
|
||||
NOTE: Failure to fill out this template properly may result in your PR being
|
||||
delayed or ignored without warning.
|
||||
|
||||
Don't type between any arrows in the template, as this text will be hidden.
|
||||
This includes this header block and any other explanatory text blocks.
|
||||
|
||||
Want to discuss your PR before submitting it? Join the EssentialsX Development
|
||||
server: https://discord.gg/CUN7qVb
|
||||
|
||||
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
|
||||
|
||||
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 into this text box!**
|
||||
|
||||
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 may drag screenshots directly into this box.)
|
||||
|
||||
-->
|
||||
|
||||
### 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:**
|
||||
<!--
|
||||
Below this line, put an "x" inside the box for the environments you have
|
||||
tested this bug fix on, and if relevant alter the OS and Java version
|
||||
accordingly. If this feature does not apply to an environment, strike
|
||||
through the environment using ~~strikethrough~~. If you have tested on
|
||||
other environments, add a new line with relevant details.
|
||||
-->
|
||||
|
||||
- [ ] Paper 1.16.3 (any OS, any Java 8+ version)
|
||||
- [ ] CraftBukkit/Spigot/Paper 1.12.2 (any OS, any Java 8+ version)
|
||||
- [ ] CraftBukkit 1.8.8 (any OS, any Java 8+ version)
|
||||
|
||||
|
||||
**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
.github/PULL_REQUEST_TEMPLATE/config.yml
vendored
Normal file
8
.github/PULL_REQUEST_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
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.)
|
82
.github/PULL_REQUEST_TEMPLATE/new-feature.md
vendored
Normal file
82
.github/PULL_REQUEST_TEMPLATE/new-feature.md
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
---
|
||||
name: Feature addition
|
||||
about: Use this if your PR adds a new feature to EssentialsX.
|
||||
labels: 'type: enhancement'
|
||||
---
|
||||
|
||||
<!-- EssentialsX feature submission guide
|
||||
|
||||
NOTE: Failure to fill out this template properly may result in your PR being
|
||||
delayed or ignored without warning.
|
||||
|
||||
Don't type between any arrows in the template, as this text will be hidden.
|
||||
This includes this header block and any other explanatory text blocks.
|
||||
|
||||
Want to discuss your PR before submitting it? Join the EssentialsX Development
|
||||
server: https://discord.gg/CUN7qVb
|
||||
|
||||
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
|
||||
|
||||
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:**
|
||||
<!--
|
||||
Below this block, put an "x" inside the box for the environments you have
|
||||
tested this bug fix on, and if relevant alter the OS and Java version
|
||||
accordingly. If this feature does not apply to an environment, strike
|
||||
through the environment using ~~strikethrough~~. If you have tested on
|
||||
other environments, add a new line with relevant details.
|
||||
-->
|
||||
|
||||
- [ ] Paper 1.16.3 (any OS, any Java 8+ version)
|
||||
- [ ] CraftBukkit/Spigot/Paper 1.12.2 (any OS, any Java 8+ version)
|
||||
- [ ] CraftBukkit 1.8.8 (any OS, any Java 8+ version)
|
||||
|
||||
**Demonstration:**
|
||||
<!--
|
||||
Below this block, include screenshots/code 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.
|
||||
-->
|
31
CONTRIBUTING.md
Normal file
31
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
Contributing to EssentialsX
|
||||
===========================
|
||||
|
||||
Want to help improve EssentialsX? There are several ways you can support and contribute to the project.
|
||||
|
||||
If you'd like to make a financial contribution to the project, you can join our [Patreon](https://www.patreon.com/essentialsx/),
|
||||
or to make a one-off donation you can visit our [Ko-fi page](https://ko-fi.com/essentialsx). If you can't make a
|
||||
donation, don't worry! There are lots of other ways to contribute:
|
||||
|
||||
* Do you run a server? Take a look at our ["help wanted"](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22)
|
||||
and ["bug: unconfirmed"](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22bug%3A+unconfirmed%22)
|
||||
issues, where you can find issues that need extra testing and investigation.
|
||||
* Do you speak multiple languages? If so, we always welcome contributions to our [Crowdin project](https://crowdin.com/project/essentialsx-official).
|
||||
* Do you enjoy helping others? If so, why not contribute to the [EssentialsX documentation](https://github.com/EssentialsX/wiki)?
|
||||
You can also join the [MOSS Discord community](https://discord.gg/casfFyh) and provide direct community support to
|
||||
other EssentialsX users.
|
||||
* If you're a developer, you could look through our ["open to PR"](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22status%3A+open+to+PR%22)
|
||||
issues. We're always happy to receive bug fixes and feature additions as pull requests.
|
||||
|
||||
Submitting a PR
|
||||
---------------
|
||||
|
||||
EssentialsX has extensive templates for PRs that detail how to submit your PR. To find out more, see the PR templates for:
|
||||
* [Bug fixes](https://github.com/EssentialsX/Essentials/blob/2.x/.github/PULL_REQUEST_TEMPLATE/bug-fix.md)
|
||||
* [New features](https://github.com/EssentialsX/Essentials/blob/2.x/.github/PULL_REQUEST_TEMPLATE/new-feature.md)
|
||||
|
||||
Want to discuss a feature before opening a PR? Join the [EssentialsX Development Discord server](https://discord.gg/CUN7qVb). Note that this server is **not for end-users** - if you need support with EssentialsX, you should join [MOSS](https://discord.gg/casfFyh) instead.
|
||||
|
||||
By contributing to EssentialsX, you agree to license your code under the [GNU General Public License version 3](https://github.com/EssentialsX/Essentials/blob/2.x/LICENSE).
|
||||
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.commands.Commandhat;
|
||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NoChargeException;
|
||||
|
@ -28,6 +27,7 @@ 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.register.payment.Methods;
|
||||
import com.earth2me.essentials.signs.SignBlockListener;
|
||||
|
@ -47,7 +47,9 @@ import net.ess3.api.ISettings;
|
|||
import net.ess3.nms.refl.providers.ReflServerStateProvider;
|
||||
import net.ess3.nms.refl.providers.ReflSpawnEggProvider;
|
||||
import net.ess3.nms.refl.providers.ReflSpawnerBlockProvider;
|
||||
import net.ess3.nms.refl.providers.ReflKnownCommandsProvider;
|
||||
import net.ess3.provider.ContainerProvider;
|
||||
import net.ess3.provider.KnownCommandsProvider;
|
||||
import net.ess3.provider.PotionMetaProvider;
|
||||
import net.ess3.provider.ProviderListener;
|
||||
import net.ess3.provider.ServerStateProvider;
|
||||
|
@ -61,6 +63,7 @@ import net.ess3.provider.providers.FlatSpawnEggProvider;
|
|||
import net.ess3.provider.providers.LegacyPotionMetaProvider;
|
||||
import net.ess3.provider.providers.LegacySpawnEggProvider;
|
||||
import net.ess3.provider.providers.PaperContainerProvider;
|
||||
import net.ess3.provider.providers.PaperKnownCommandsProvider;
|
||||
import net.ess3.provider.providers.PaperRecipeBookListener;
|
||||
import net.ess3.provider.providers.PaperServerStateProvider;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -82,8 +85,6 @@ import org.bukkit.event.player.PlayerEvent;
|
|||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
@ -134,6 +135,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
private transient PotionMetaProvider potionMetaProvider;
|
||||
private transient ServerStateProvider serverStateProvider;
|
||||
private transient ContainerProvider containerProvider;
|
||||
private transient KnownCommandsProvider knownCommandsProvider;
|
||||
private transient ProviderListener recipeBookEventProvider;
|
||||
private transient Kits kits;
|
||||
private transient RandomTeleport randomTeleport;
|
||||
|
@ -154,18 +156,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
super(new JavaPluginLoader(server), new PluginDescriptionFile("Essentials", "", "com.earth2me.essentials.Essentials"), null, null);
|
||||
}
|
||||
|
||||
private static void addDefaultBackPermissionsToWorld(final World w) {
|
||||
final String permName = "essentials.back.into." + w.getName();
|
||||
|
||||
Permission p = Bukkit.getPluginManager().getPermission(permName);
|
||||
if (p == null) {
|
||||
p = new Permission(permName,
|
||||
"Allows access to /back when the destination location is within world " + w.getName(),
|
||||
PermissionDefault.TRUE);
|
||||
Bukkit.getPluginManager().addPermission(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISettings getSettings() {
|
||||
return settings;
|
||||
|
@ -210,8 +200,16 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
|
||||
Console.setInstance(this);
|
||||
|
||||
if (!VersionUtil.isServerSupported()) {
|
||||
getLogger().severe(tl("serverUnsupported"));
|
||||
switch (VersionUtil.getServerSupportStatus()) {
|
||||
case UNSTABLE:
|
||||
getLogger().severe(tl("serverUnsupportedMods"));
|
||||
break;
|
||||
case OUTDATED:
|
||||
getLogger().severe(tl("serverUnsupported"));
|
||||
break;
|
||||
case LIMITED:
|
||||
getLogger().info(tl("serverUnsupportedLimitedApi"));
|
||||
break;
|
||||
}
|
||||
|
||||
final PluginManager pm = getServer().getPluginManager();
|
||||
|
@ -324,6 +322,13 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
}
|
||||
}
|
||||
|
||||
//Known Commands Provider
|
||||
if (PaperLib.isPaper() && VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_11_2_R01)) {
|
||||
knownCommandsProvider = new PaperKnownCommandsProvider();
|
||||
} else {
|
||||
knownCommandsProvider = new ReflKnownCommandsProvider();
|
||||
}
|
||||
|
||||
execTimer.mark("Init(Providers)");
|
||||
reload();
|
||||
|
||||
|
@ -343,17 +348,15 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
|
||||
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
|
||||
|
||||
// Register hat permissions
|
||||
Commandhat.registerPermissionsIfNecessary(getServer().getPluginManager());
|
||||
|
||||
timer = new EssentialsTimer(this);
|
||||
scheduleSyncRepeatingTask(timer, 1000, 50);
|
||||
|
||||
Economy.setEss(this);
|
||||
execTimer.mark("RegHandler");
|
||||
|
||||
for (final World w : Bukkit.getWorlds())
|
||||
addDefaultBackPermissionsToWorld(w);
|
||||
// Register /hat and /back default permissions
|
||||
PermissionsDefaults.registerAllBackDefaults();
|
||||
PermissionsDefaults.registerAllHatDefaults();
|
||||
|
||||
metrics = new MetricsWrapper(this, 858, true);
|
||||
|
||||
|
@ -1013,6 +1016,11 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
return containerProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KnownCommandsProvider getKnownCommandsProvider() {
|
||||
return knownCommandsProvider;
|
||||
}
|
||||
|
||||
private AbstractItemDb getItemDbFromConfig() {
|
||||
final String setting = settings.getItemDbType();
|
||||
|
||||
|
@ -1040,7 +1048,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onWorldLoad(final WorldLoadEvent event) {
|
||||
addDefaultBackPermissionsToWorld(event.getWorld());
|
||||
PermissionsDefaults.registerBackDefaultFor(event.getWorld());
|
||||
|
||||
ess.getJails().onReload();
|
||||
ess.getWarps().reloadConfig();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.earth2me.essentials.api.IJails;
|
|||
import com.earth2me.essentials.api.IWarps;
|
||||
import com.earth2me.essentials.perm.PermissionsHandler;
|
||||
import net.ess3.provider.ContainerProvider;
|
||||
import net.ess3.provider.KnownCommandsProvider;
|
||||
import net.ess3.provider.ServerStateProvider;
|
||||
import net.ess3.provider.SpawnerBlockProvider;
|
||||
import net.ess3.provider.SpawnerItemProvider;
|
||||
|
@ -115,4 +116,6 @@ public interface IEssentials extends Plugin {
|
|||
ServerStateProvider getServerStateProvider();
|
||||
|
||||
ContainerProvider getContainerProvider();
|
||||
|
||||
KnownCommandsProvider getKnownCommandsProvider();
|
||||
}
|
||||
|
|
|
@ -314,11 +314,20 @@ public class Commandessentials extends EssentialsCommand {
|
|||
boolean isMismatched = false;
|
||||
boolean isVaultInstalled = false;
|
||||
boolean isUnsupported = false;
|
||||
final boolean isServerSupported = VersionUtil.isServerSupported();
|
||||
final VersionUtil.SupportStatus supportStatus = VersionUtil.getServerSupportStatus();
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
final String essVer = pm.getPlugin("Essentials").getDescription().getVersion();
|
||||
|
||||
sender.sendMessage(tl(isServerSupported ? "versionOutputFine" : "versionOutputWarn", "Server", server.getBukkitVersion() + " " + server.getVersion()));
|
||||
final String serverMessageKey;
|
||||
if (supportStatus.isSupported()) {
|
||||
serverMessageKey = "versionOutputFine";
|
||||
} else if (supportStatus == VersionUtil.SupportStatus.UNSTABLE) {
|
||||
serverMessageKey = "versionOutputUnsupported";
|
||||
} else {
|
||||
serverMessageKey = "versionOutputWarn";
|
||||
}
|
||||
|
||||
sender.sendMessage(tl(serverMessageKey, "Server", server.getBukkitVersion() + " " + server.getVersion()));
|
||||
sender.sendMessage(tl("versionOutputFine", "EssentialsX", essVer));
|
||||
|
||||
for (final Plugin plugin : pm.getPlugins()) {
|
||||
|
@ -366,8 +375,16 @@ public class Commandessentials extends EssentialsCommand {
|
|||
sender.sendMessage(tl("versionOutputUnsupportedPlugins"));
|
||||
}
|
||||
|
||||
if (!VersionUtil.isServerSupported()) {
|
||||
sender.sendMessage(tl("serverUnsupported"));
|
||||
switch (supportStatus) {
|
||||
case UNSTABLE:
|
||||
sender.sendMessage(tl("serverUnsupportedMods"));
|
||||
break;
|
||||
case OUTDATED:
|
||||
sender.sendMessage(tl("serverUnsupported"));
|
||||
break;
|
||||
case LIMITED:
|
||||
sender.sendMessage(tl("serverUnsupportedLimitedApi"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,16 +3,12 @@ package com.earth2me.essentials.commands;
|
|||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -20,35 +16,14 @@ import java.util.List;
|
|||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commandhat extends EssentialsCommand {
|
||||
/**
|
||||
* The prefix for hat prevention commands
|
||||
*/
|
||||
private static final String PERM_PREFIX = "essentials.hat.prevent-type.";
|
||||
|
||||
// The prefix for hat prevention commands
|
||||
public static final String PERM_PREFIX = "essentials.hat.prevent-type.";
|
||||
|
||||
public Commandhat() {
|
||||
super("hat");
|
||||
}
|
||||
|
||||
/**
|
||||
* Register permissions used by this command.
|
||||
*
|
||||
* @param toRegister The plugin manager to register permissions in.
|
||||
*/
|
||||
public static void registerPermissionsIfNecessary(final PluginManager toRegister) {
|
||||
final Permission hatPerm = toRegister.getPermission(PERM_PREFIX + "*");
|
||||
if (hatPerm != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ImmutableMap.Builder<String, Boolean> children = ImmutableMap.builder();
|
||||
for (final Material mat : Material.values()) {
|
||||
final String matPerm = PERM_PREFIX + mat.name().toLowerCase();
|
||||
children.put(matPerm, true);
|
||||
toRegister.addPermission(new Permission(matPerm, "Prevent using " + mat + " as a type of hat.", PermissionDefault.FALSE));
|
||||
}
|
||||
toRegister.addPermission(new Permission(PERM_PREFIX + "*", "Prevent all types of hats", PermissionDefault.FALSE, children.build()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||
if (args.length == 0 || (!args[0].contains("rem") && !args[0].contains("off") && !args[0].equalsIgnoreCase("0"))) {
|
||||
|
|
|
@ -32,10 +32,6 @@ public class Commandtree extends EssentialsCommand {
|
|||
}
|
||||
if (args[0].equalsIgnoreCase("jungle")) {
|
||||
tree = TreeType.SMALL_JUNGLE;
|
||||
} else if (args[0].equalsIgnoreCase("acacia")) {
|
||||
tree = TreeType.ACACIA;
|
||||
} else if (args[0].equalsIgnoreCase("birch")) {
|
||||
tree = TreeType.BIRCH;
|
||||
}
|
||||
if (tree == null) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
|
|
|
@ -8,13 +8,14 @@ import com.earth2me.essentials.User;
|
|||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -316,17 +317,15 @@ public abstract class EssentialsCommand implements IEssentialsCommand {
|
|||
|
||||
/**
|
||||
* Lists all commands.
|
||||
* <p>
|
||||
* TODO: Use the real commandmap to do this automatically.
|
||||
*/
|
||||
protected final List<String> getCommands(final Server server) {
|
||||
final List<String> commands = Lists.newArrayList();
|
||||
for (final Plugin p : server.getPluginManager().getPlugins()) {
|
||||
final PluginDescriptionFile desc = p.getDescription();
|
||||
final Map<String, Map<String, Object>> cmds = desc.getCommands();
|
||||
if (cmds != null) {
|
||||
commands.addAll(cmds.keySet());
|
||||
protected final List<String> getCommands(Server server) {
|
||||
final Map<String, Command> commandMap = Maps.newHashMap(this.ess.getKnownCommandsProvider().getKnownCommands());
|
||||
final List<String> commands = Lists.newArrayListWithCapacity(commandMap.size());
|
||||
for (final Command command : commandMap.values()) {
|
||||
if (!(command instanceof PluginIdentifiableCommand)) {
|
||||
continue;
|
||||
}
|
||||
commands.add(command.getName());
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
|
@ -356,13 +355,17 @@ public abstract class EssentialsCommand implements IEssentialsCommand {
|
|||
}
|
||||
|
||||
final int numArgs = args.length - index - 1;
|
||||
ess.getLogger().info(numArgs + " " + index + " " + Arrays.toString(args));
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().info(numArgs + " " + index + " " + Arrays.toString(args));
|
||||
}
|
||||
String[] effectiveArgs = new String[numArgs];
|
||||
System.arraycopy(args, index, effectiveArgs, 0, numArgs);
|
||||
if (effectiveArgs.length == 0) {
|
||||
effectiveArgs = new String[] {""};
|
||||
}
|
||||
ess.getLogger().info(command + " -- " + Arrays.toString(effectiveArgs));
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().info(command + " -- " + Arrays.toString(effectiveArgs));
|
||||
}
|
||||
|
||||
return command.tabComplete(sender.getSender(), label, effectiveArgs);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.earth2me.essentials.perm;
|
||||
|
||||
import com.earth2me.essentials.commands.Commandhat;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public final class PermissionsDefaults {
|
||||
|
||||
private PermissionsDefaults() {
|
||||
}
|
||||
|
||||
public static void registerAllBackDefaults() {
|
||||
for (final World world : Bukkit.getWorlds()) {
|
||||
registerBackDefaultFor(world);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerBackDefaultFor(final World w) {
|
||||
final String permName = "essentials.back.into." + w.getName();
|
||||
|
||||
Permission p = Bukkit.getPluginManager().getPermission(permName);
|
||||
if (p == null) {
|
||||
p = new Permission(permName,
|
||||
"Allows access to /back when the destination location is within world " + w.getName(),
|
||||
PermissionDefault.TRUE);
|
||||
Bukkit.getPluginManager().addPermission(p);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerAllHatDefaults() {
|
||||
final PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
|
||||
final Permission hatPerm = pluginManager.getPermission(Commandhat.PERM_PREFIX + "*");
|
||||
if (hatPerm != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ImmutableMap.Builder<String, Boolean> children = ImmutableMap.builder();
|
||||
for (final Material mat : Material.values()) {
|
||||
final String matPerm = Commandhat.PERM_PREFIX + mat.name().toLowerCase();
|
||||
children.put(matPerm, true);
|
||||
pluginManager.addPermission(new Permission(matPerm, "Prevent using " + mat + " as a type of hat.", PermissionDefault.FALSE));
|
||||
}
|
||||
pluginManager.addPermission(new Permission(Commandhat.PERM_PREFIX + "*", "Prevent all types of hats", PermissionDefault.FALSE, children.build()));
|
||||
}
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
package com.earth2me.essentials.textreader;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -17,15 +20,12 @@ import java.util.logging.Logger;
|
|||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class HelpInput implements IText {
|
||||
private static final String DESCRIPTION = "description";
|
||||
private static final String PERMISSION = "permission";
|
||||
private static final String PERMISSIONS = "permissions";
|
||||
private static final Logger logger = Logger.getLogger("Essentials");
|
||||
private final transient List<String> lines = new ArrayList<>();
|
||||
private final transient List<String> chapters = new ArrayList<>();
|
||||
private final transient Map<String, Integer> bookmarks = new HashMap<>();
|
||||
|
||||
public HelpInput(final User user, final String match, final IEssentials ess) throws IOException {
|
||||
public HelpInput(final User user, final String match, final IEssentials ess) {
|
||||
boolean reported = false;
|
||||
final List<String> newLines = new ArrayList<>();
|
||||
String pluginName = "";
|
||||
|
@ -34,7 +34,16 @@ public class HelpInput implements IText {
|
|||
lines.add(tl("helpMatching", match));
|
||||
}
|
||||
|
||||
for (final Plugin p : ess.getServer().getPluginManager().getPlugins()) {
|
||||
final Multimap<Plugin, Command> pluginCommands = HashMultimap.create();
|
||||
for (final Command command : ess.getKnownCommandsProvider().getKnownCommands().values()) {
|
||||
if (!(command instanceof PluginIdentifiableCommand)) {
|
||||
continue;
|
||||
}
|
||||
final PluginIdentifiableCommand pluginIdentifiableCommand = (PluginIdentifiableCommand) command;
|
||||
pluginCommands.put(pluginIdentifiableCommand.getPlugin(), command);
|
||||
}
|
||||
|
||||
for (Plugin p : ess.getServer().getPluginManager().getPlugins()) {
|
||||
try {
|
||||
final List<String> pluginLines = new ArrayList<>();
|
||||
final PluginDescriptionFile desc = p.getDescription();
|
||||
|
@ -48,46 +57,51 @@ public class HelpInput implements IText {
|
|||
}
|
||||
final boolean isOnWhitelist = user.isAuthorized("essentials.help." + pluginNameLow);
|
||||
|
||||
for (final Map.Entry<String, Map<String, Object>> k : cmds.entrySet()) {
|
||||
for (final Command command : pluginCommands.get(p)) {
|
||||
try {
|
||||
if (!match.equalsIgnoreCase("") && !pluginNameLow.contains(match) && !k.getKey().toLowerCase(Locale.ENGLISH).contains(match) && !(k.getValue().get(DESCRIPTION) instanceof String && ((String) k.getValue().get(DESCRIPTION)).toLowerCase(Locale.ENGLISH).contains(match))) {
|
||||
final String commandName = command.getName();
|
||||
final String commandDescription = command.getDescription();
|
||||
|
||||
if (!match.equalsIgnoreCase("")
|
||||
&& (!pluginNameLow.contains(match))
|
||||
&& (!commandName.toLowerCase(Locale.ENGLISH).contains(match))
|
||||
&& (!commandDescription.toLowerCase(Locale.ENGLISH).contains(match))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pluginNameLow.contains("essentials")) {
|
||||
final String node = "essentials." + k.getKey();
|
||||
if (!ess.getSettings().isCommandDisabled(k.getKey()) && user.isAuthorized(node)) {
|
||||
pluginLines.add(tl("helpLine", k.getKey(), k.getValue().get(DESCRIPTION)));
|
||||
final String node = "essentials." + commandName;
|
||||
if (!ess.getSettings().isCommandDisabled(commandName) && user.isAuthorized(node)) {
|
||||
pluginLines.add(tl("helpLine", commandName, commandDescription));
|
||||
}
|
||||
} else {
|
||||
if (ess.getSettings().showNonEssCommandsInHelp()) {
|
||||
final Map<String, Object> value = k.getValue();
|
||||
Object permissions = null;
|
||||
if (value.containsKey(PERMISSION)) {
|
||||
permissions = value.get(PERMISSION);
|
||||
} else if (value.containsKey(PERMISSIONS)) {
|
||||
permissions = value.get(PERMISSIONS);
|
||||
final String permissionRaw = command.getPermission();
|
||||
final String[] permissions;
|
||||
if (permissionRaw == null) {
|
||||
permissions = new String[0];
|
||||
} else {
|
||||
permissions = permissionRaw.split(";");
|
||||
}
|
||||
if (isOnWhitelist || user.isAuthorized("essentials.help." + pluginNameLow + "." + k.getKey())) {
|
||||
pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION)));
|
||||
} else if (permissions instanceof List && !((List<Object>) permissions).isEmpty()) {
|
||||
|
||||
if (isOnWhitelist || user.isAuthorized("essentials.help." + pluginNameLow + "." + commandName)) {
|
||||
pluginLines.add(tl("helpLine", commandName, commandDescription));
|
||||
} else if (permissions.length != 0) {
|
||||
boolean enabled = false;
|
||||
for (final Object o : (List<Object>) permissions) {
|
||||
if (o instanceof String && user.isAuthorized(o.toString())) {
|
||||
|
||||
for (final String permission : permissions) {
|
||||
if (user.isAuthorized(permission)) {
|
||||
enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION)));
|
||||
}
|
||||
} else if (permissions instanceof String && !"".equals(permissions)) {
|
||||
if (user.isAuthorized(permissions.toString())) {
|
||||
pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION)));
|
||||
pluginLines.add(tl("helpLine", commandName, commandDescription));
|
||||
}
|
||||
} else {
|
||||
if (!ess.getSettings().hidePermissionlessHelp()) {
|
||||
pluginLines.add(tl("helpLine", k.getKey(), value.get(DESCRIPTION)));
|
||||
pluginLines.add(tl("helpLine", commandName, commandDescription));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.utils;
|
|||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -44,8 +45,22 @@ public final class VersionUtil {
|
|||
return serverVersion;
|
||||
}
|
||||
|
||||
public static SupportStatus getServerSupportStatus() {
|
||||
try {
|
||||
Class.forName("net.minecraftforge.common.MinecraftForge");
|
||||
return SupportStatus.UNSTABLE;
|
||||
} catch (final ClassNotFoundException ignored) {
|
||||
}
|
||||
|
||||
if (!supportedVersions.contains(getServerBukkitVersion())) {
|
||||
return SupportStatus.OUTDATED;
|
||||
}
|
||||
|
||||
return PaperLib.isPaper() ? SupportStatus.FULL : SupportStatus.LIMITED;
|
||||
}
|
||||
|
||||
public static boolean isServerSupported() {
|
||||
return supportedVersions.contains(getServerBukkitVersion());
|
||||
return getServerSupportStatus().isSupported();
|
||||
}
|
||||
|
||||
public static final class BukkitVersion implements Comparable<BukkitVersion> {
|
||||
|
@ -188,4 +203,22 @@ public final class VersionUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum SupportStatus {
|
||||
FULL(true),
|
||||
LIMITED(true),
|
||||
UNSTABLE(false),
|
||||
OUTDATED(false)
|
||||
;
|
||||
|
||||
private final boolean supported;
|
||||
|
||||
SupportStatus(final boolean supported) {
|
||||
this.supported = supported;
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
return supported;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -706,6 +706,8 @@ serverFull=Server is full\!
|
|||
serverReloading=There's a good chance you're reloading your server right now. If that's the case, why do you hate yourself? Expect no support from the EssentialsX team when using /reload.
|
||||
serverTotal=\u00a76Server Total\:\u00a7c {0}
|
||||
serverUnsupported=You are running an unsupported server version!
|
||||
serverUnsupportedLimitedApi=You are running a server with limited API functionality. EssentialsX will still work, but certain features may be disabled.
|
||||
serverUnsupportedMods=You are running a server that does not properly support Bukkit plugins. Bukkit plugins should not be used with Forge mods! Consider using ForgeEssentials, or SpongeForge + Nucleus.
|
||||
setBal=\u00a7aYour balance was set to {0}.
|
||||
setBalOthers=\u00a7aYou set {0}\u00a7a''s balance to {1}.
|
||||
setSpawner=\u00a76Changed spawner type to\u00a7c {0}\u00a76.
|
||||
|
|
1401
Essentials/test/com/earth2me/essentials/FakeServer.java
Normal file
1401
Essentials/test/com/earth2me/essentials/FakeServer.java
Normal file
File diff suppressed because it is too large
Load diff
|
@ -59,11 +59,11 @@ To depend on EssentialsX 2.18.1, you should use the artifact `net.ess3:Essential
|
|||
Contributing
|
||||
------------
|
||||
|
||||
Want to help improve EssentialsX? There are numerous ways you can contribute to the project.
|
||||
Want to help improve EssentialsX? There are several ways you can support and contribute to the project.
|
||||
|
||||
If you'd like to make a financial contribution to the project, you can join our [Patreon](https://www.patreon.com/essentialsx/),
|
||||
or to make a one-off donation you can visit our [Ko-fi page](https://ko-fi.com/essentialsx). If you can't make a
|
||||
donation, don't worry! There's lots of other ways to contribute:
|
||||
donation, don't worry! There are lots of other ways to contribute:
|
||||
|
||||
* Do you run a server? Take a look at our ["help wanted"](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22)
|
||||
and ["bug: unconfirmed"](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22bug%3A+unconfirmed%22)
|
||||
|
@ -74,3 +74,5 @@ donation, don't worry! There's lots of other ways to contribute:
|
|||
other EssentialsX users.
|
||||
* If you're a developer, you could look through our ["open to PR"](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22status%3A+open+to+PR%22)
|
||||
issues. We're always happy to receive bug fixes and feature additions as pull requests.
|
||||
|
||||
See [CONTRIBUTING.md](https://github.com/EssentialsX/Essentials/blob/2.x/CONTRIBUTING.md) to find out more.
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -64,7 +64,7 @@
|
|||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package net.ess3.provider;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface KnownCommandsProvider extends Provider {
|
||||
Map<String, Command> getKnownCommands();
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package net.ess3.nms.refl.providers;
|
||||
|
||||
import net.ess3.nms.refl.ReflUtil;
|
||||
import net.ess3.provider.KnownCommandsProvider;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ReflKnownCommandsProvider implements KnownCommandsProvider {
|
||||
private final Map<String, Command> knownCommands;
|
||||
|
||||
public ReflKnownCommandsProvider() {
|
||||
Map<String, Command> knownCommands = new HashMap<>();
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Class<? extends Server> craftServerClass = (Class<? extends Server>) ReflUtil.getOBCClass("CraftServer");
|
||||
if (craftServerClass != null) {
|
||||
final Field commandMapField = ReflUtil.getFieldCached(craftServerClass, "commandMap");
|
||||
if (commandMapField != null) {
|
||||
final SimpleCommandMap simpleCommandMap = (SimpleCommandMap) commandMapField.get(Bukkit.getServer());
|
||||
final Field knownCommandsField = ReflUtil.getFieldCached(SimpleCommandMap.class, "knownCommands");
|
||||
if (knownCommandsField != null) {
|
||||
knownCommands = (Map<String, Command>) knownCommandsField.get(simpleCommandMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Exception exception) {
|
||||
exception.printStackTrace();
|
||||
} finally {
|
||||
this.knownCommands = knownCommands;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Command> getKnownCommands() {
|
||||
return this.knownCommands;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "NMS Reflection Known Commands Provider";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package net.ess3.provider.providers;
|
||||
|
||||
import net.ess3.provider.KnownCommandsProvider;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PaperKnownCommandsProvider implements KnownCommandsProvider {
|
||||
@Override
|
||||
public Map<String, Command> getKnownCommands() {
|
||||
return Bukkit.getCommandMap().getKnownCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Paper Known Commands Provider";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue