Adds an event which allows developers to see & cancel when users attempt to teleport home. This event is needed over `PreTeleportEvent` due to the fact that it would be extremely difficult to accurately filter it by the /home command.
Closes#3401
This PR replaces UserTeleportEvent with two new teleport events called at different stages:
- TeleportWarmupEvent; called before a user's teleport warmup begins and allows plugins to skip it or prevent a teleportation
- PreTeleportEvent; called after the warmup completes but before any safety checks are carried out
This is a **breaking change** as it removes UserTeleportEvent, but the previous event isn't useful or descriptive in its current form and was only recently introduced, so it's unlikely that many plugins already depend on this.
Closes#2506.
Adds `/tpr` and `/settpr` commands, which respectively allow you to teleport randomly or set teleportation parameters.
Server owners are expected to set the center with `/settpr` before players can use `/tpr`. They can also set the minimum and maximum range to be teleported from the center (default 0-1000).
Also includes an event where plugins can adjust or cancel the teleport.
Closes#3154.
Co-authored-by: pop4959 <pop4959@gmail.com>
Co-authored-by: MD <1917406+md678685@users.noreply.github.com>
Adds a command to add to or clear an item's lore.
Closes#1911.
This PR introduces a new private messaging related event `PrivateMessageSentEvent` and fixes a mistake made on my part during the implementation of `PrivateMessagePreSendEvent`.
Recently when attempting to use the pre-send event in order to play a sound to the recipient of a message, I found that the event was not completely adequate for my use case. Between the firing of the pre-send event and the end of the delivery attempt, the message delivery could fail for a number of reasons (e.g. messages toggled off, sender ignored, unreachable recipient) with no straightforward way of determining this using the existing event.
I believe that a second event fired after the message sending attempt has been fully processed will provide a simple method of determining whether or not a message was successfully delivered by including the [`MessageResponse`](60f54ee37d/Essentials/src/com/earth2me/essentials/messaging/IMessageRecipient.java (L84)) in the event.
Additionally, I found that when implementing the pre-send event, I mistakenly passed an incorrect reference for the `sender` meaning that currently there's no clean or reliable way to determine if `sender` is the `Console` or a `User` (`instanceof` doesn't work, which leaves checking by name or using reflection).
This subtly changes how backend permissions plugins are reported on
bStats. (Previously, somehow the LP service provider was detected as
originating from Vault...?)
This PR updates the version of the bStats Metrics class to the latest version, supporting plugin IDs in place of just plugin names. It also adds the following graphs:
- Active permissions backend
- Active economy backend
- Whether or not a command has been used as a bar chart (pending bStats backend implementation)
- Version history graph as a multiline graph (also pending bStats impl)
It also removes the weird `getMetrics` and `setMetrics` APIs which should never have been API in the first place.
This allows deleting kits ignoring case; fixes#3370.
I don't know if this is the ideal fix, but everything else for kits seems to nuke the letter casing. Not really sure why in `Kits.java`, the keys needs to get lowercased in a new mock `ConfigurationSection`. It just seems like this would purely make it harder to access the same section again in the real config. Instead, I just added a different method that matches the real config name of the kit (as set in `/createkit`, which currently allows uppercase).
Fixes#3189
This PR makes improvements to the suicide and kill commands, namely:
1) Call `EntityDamageEvent` with damage equal to `Float.MAX_VALUE`, which is the amount that is inflicted by `/minecraft:kill`.
2) Removes the calls to `Damageable::damage` which ends up damaging the player with `DamageSource.GENERIC`, and later causing another `EntityDamageEvent` where as a result the last damage cause gets set to `EntityDamageEvent.DamageCause.CUSTOM`. Thus, the `EntityDamageEvent` that Essentials calls gets rendered useless when someone tries to get the damage cause of the player in `PlayerDeathEvent`. Setting health to zero forcibly kills the player without causing damage.
3) Add `getTabCompleteOptions` to the suicide command, as it currently incorrectly suggests players.
This PR replaces the current `items.json` file with one generated *solely* by ItemDbGenerator.
In 1.13.x, the `items.json` shipped with EssentialsX was generated using the [genItemsFlat script and data](https://github.com/md678685/essx-scripts). For 1.14 and 1.15, this was merged with the output of [ItemDbGenerator](https://github.com/EssentialsX/ItemDbGenerator), but this is an awkward and unreliable process involving three separate tools. This has now been consolidated into a single tool, which is now on par with the old process.
This PR reduces the number of sync loads occurring on any teleport caused by essentials.
Fixes#2861Fixes#2287Fixes#3274Fixes#3201Fixes#2120
Before this PR, essentials would get a block multiple times causing sync loads to check if it was safe to teleport to. Now, the target block's chunk if fetched async with PaperLib and passed along to `LocationUtil#isBlockUnsafeForUser` (which internally calls other LocationUtil methods what that chunk object) resulting in the chunk only loading once, off the main thread. The only operations remaining on the main thread is `LocationUtil#getSafeDestination`. This is due to the method's recursion which would be a pain to move async. **However:** since the chunk was already loaded async, `LocationUtil#getSafeDestination` most of the time won't cause sync chunk loads. The only time it would cause sync chunk loads is with an unsafe location near a chunk border.
-----------------------------------------
* Reduce sync teleporting loads
* Avoid argument re-assigning
* Remove async teleports when unnecessary
* Make exceptions cleaner
* Async all the things
Made an async version of every method with fallbacks for deprecated methods.
* Remove old now fallback method
* Migrate everything to the new async teleport API
* Update ITeleport javadocs
* Fix invoking via async context
* Fix /jail using deprecated method
* Fix jail join handler using deprecated method
* Rename all teleport classes to indicate async
* Remove deprecated methods
* Add (and deprecate) old teleport api
* Revert TimedTeleport.java
* Reduce Diff
* Add legacy sendToJail method
* Reduce Diff Further
* Use getNewExceptionFuture in Commandtpo
* Use getNewExceptionFuture everywhere
* Fix even more usages
* Revert LocationUtil.java
* Fix issue causing unsafe locations to not work properly
* Add deprecated notice in IUser implementation
* Use CompletableFuture#completeExceptionally for exceptions
* Use Essentials' logger in EssentialsCommand#showError
* Return implementation rather than interface
* Avoid possible deadlocks with entity ejections
* Nuke some sync loads with homes
Took 7 hours and 2 PRs to paper but it's here!
* Fix ABI and make the codestyle worse
* Make the codestyle worse because muh diff
* Further ruin the codestyle
* Fix error messages not showing in TimedTeleports
* Improve messages around beds for /home
* Fix#3274
Allow unsafe locations for different worlds + spectator mode
* Fix fly safety operators
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
Co-authored-by: pop4959 <pop4959@gmail.com>
Adds protection settings to Protect to block item damage when entities such as wither skulls, fireballs, TNT and creepers explode.
Closes#2284.
Add an optional `serialize` method to `ItemResolver`s which plugins can implement in order to add custom items to `/createkit`. Also improves ItemResolver docs.
Closes#3305, closes#3216.
Adds an `allow-selling-named-items` config option, which allows server admins to enable/disable the ability to sell named items with `/sell`.
Closes#1988.
Closes#908.
Closes#2196.
Co-authored-by: triagonal <10545540+triagonal@users.noreply.github.com>
"The player's bed respawn point is still set by Minecraft even if `update-bed-at-daytime` is set to `false` in config, meaning that the entire feature is indeed ineffective on Minecraft 1.15 and above."