Commit Graph

50 Commits

Author SHA1 Message Date
Josh Roy
d9bf099c3d
Reduce sync loads for teleporting (#3102)
This PR reduces the number of sync loads occurring on any teleport caused by essentials.

Fixes #2861
Fixes #2287
Fixes #3274
Fixes #3201
Fixes #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
2020-06-24 09:52:25 +01:00
md678685
bd8ef2a25d Only show available warps in tab complete
Fixes #2353 by only displaying warps where the player has the permission `essentials.warps.<warp>`.
2019-01-05 15:45:34 +00:00
md678685
301a3a72df Check for essentials.warp.list permission on /warp tab complete (#1378) 2017-07-10 23:07:54 +01:00
Ali 'SupaHam' M
bbe0ca9302 Implement tab completion for all commands. (#1282)
List of supported commands:
```
/afk
/balance
/balancetop
/ban
/banip
/bigtree
/book
/broadcastworld
/burn
/clearinventory
/condense
/delhome
/deljail
/delwarp
/eco
/enchant
/enderchest
/essentials
/exp
/ext
/feed
/fireball
/firework
/gamemode
/getpos
/give
/hat
/heal
/help
/helpop
/home
/ignore
/invsee
/item
/itemdb
/jump
/kick
/kill
/kit
/lightning
/list
/mail
/me
/msg
/mute
/near
/nick
/nuke
/pay
/potion
/powertool
/ptime
/pweather
/recipe
/remove
/repair
/sell
/showkit
/skull
/speed
/tempban
/thunder
/time
/togglejail
/tp
/tpa
/tpaall
/tpahere
/tpall
/tphere
/tpo
/tpohere
/tppos
/tree
/warp
/weather
/world
/worth```
2017-06-11 01:17:43 +01:00
vemacs
73ac6488ce Run IntelliJ IDEA inspections 2015-06-03 14:11:56 -06:00
drtshock
dde0b20775 Reformat 2015-04-14 23:06:16 -05:00
FearFree
5724c0c8df Future Java versions may not support _ as identifier. 2014-03-22 16:08:11 +11:00
Iaccidentally
518650e842 Modifier order consistency 2014-02-04 11:11:43 -05:00
snowleo
9b4e6e5dc6 Fix fromIndex = -20 2013-11-15 20:06:16 +01:00
KHobbits
6f85761f7f Extract CommandSender to CommandSource, this should prevent Ess user object leaks. 2013-10-16 21:05:33 +01:00
KHobbits
59b501b2b1 Clean Imports 2013-10-11 03:44:41 +01:00
KHobbits
3963a528b3 Fix handling max warp pages. 2013-09-10 01:42:11 +01:00
KHobbits
00463a7899 Try to restore basic api functionality 2013-07-14 13:00:03 +01:00
Iaccidentally
dad348d3d0 [API] Move 2.x API to new package, create dummy classes for compatibility 2013-07-13 11:14:39 -04:00
KHobbits
1abacf00df More cleanup 2013-07-07 13:02:40 +01:00
KHobbits
09f67c9723 Split util classes. 2013-06-08 22:31:19 +01:00
KHobbits
f48ed6988d Essentials API cleanup and teleport possession fixing. (UNSTABLE) 2013-06-08 19:34:14 +01:00
KHobbits
66911bb0a9 Improve hidden player matching.
Replace essentials.teleport.hidden with essentials.vanish.interact
Fix perm checks in tpall and tpaall
2013-05-23 22:59:09 +01:00
KHobbits
2d70bb19f7 Economy Madness 2013-05-05 05:12:17 +01:00
KHobbits
353423efec Use correct getPlayer method to not match offline users. 2013-03-20 01:29:54 +00:00
Necrodoom
ea9bf854cc [Fix] offline player matching for online only commands.
/kick,/warp, /burn & /tppos should only match online players
2013-03-19 14:07:42 +00:00
KHobbits
4982cc950e Add alt warp perm for others 2012-10-07 22:40:04 +01:00
KHobbits
aa14cc39d9 Add missing TL key
Fixes #1363
2012-09-15 21:16:31 +01:00
KHobbits
9c9d4e1da5 Move the per kit and warp permissions:
essentials.kit.kitname is moved to essentials.kits.kitname
essentials.warp.warpname is moved to essentials.warps.warpname
2012-09-08 20:32:48 +01:00
KHobbits
7d5e0352d2 Fix /warp command matching in console. 2012-08-18 15:25:14 +01:00
KHobbits
267495a406 Fixing warp command costs. 2012-03-13 16:15:01 +00:00
KHobbits
2699e02f96 Add per warp command costs
Make warp other commands charge the commander, not the warped.
2012-02-13 17:09:07 +00:00
KHobbits
b102c5f3d8 First Refactor of Kits
New sign: [Kit] / <kit name> / [group] / [charge]
2011-12-08 04:44:18 +00:00
ementalo
10597cec2f Catch TeleportClause.COMMAND in the teleport listener.
Changed Teleport methods to pass a TeleportClause param
2011-12-07 01:12:36 +00:00
snowleo
220d68f375 Switch to the new I18n class and format cleanup of all classes 2011-11-21 02:55:26 +01:00
KHobbits
cd9ea163e4 Continuing code cleanup 2011-11-18 22:09:26 +00:00
snowleo
85ef892f0e Null checks 2011-11-18 20:15:26 +01:00
KHobbits
11f02fb947 Code cleanup continues... 2011-11-18 18:11:49 +00:00
KHobbits
e5a8cd88f0 Code cleanup continued. 2011-11-18 17:48:49 +00:00
KHobbits
165d499ef3 Adding op/god mode to whois. 2011-11-04 23:41:39 +00:00
KHobbits
d264c26310 Allow the use of the warp command from the console 2011-11-03 16:17:39 +00:00
KHobbits
afb951461c Adding throw to prevent double charge. 2011-08-30 03:42:31 +01:00
okamosy
6946488e0d updated to use corrected joinList function. 2011-08-23 23:40:48 +01:00
snowleo
d818f705ad Cleanup 2011-08-21 21:30:01 +02:00
snowleo
1ac033a60e Pages for /warp command 2011-08-21 21:27:36 +02:00
snowleo
fd2d2456b9 Renamed the Charge class to Trade 2011-06-13 15:05:11 +02:00
snowleo
117d938ac5 Several bug fixes and cleanup.
Found using PMD and FindBugs.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1553 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 10:40:12 +00:00
snowleo
5ae48481bd Refactoring: New Charge class
user.canAfford(String), user.canAfford(EssentialsCommand), user.charge(String), user.charge(EssentialsCommand) have been removed.
Teleport class has been changed to use the Charge class.
This also fixes some bugs, like the one with warp signs.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1512 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 18:53:23 +00:00
snowleo
5eeb020f01 Finally all commands translated.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1471 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 01:30:54 +00:00
ementalo
cf020d235e [trunk warps should charge only once, and not when an exception happens
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1344 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 23:19:17 +00:00
ementalo
50780f7399 [trunk] adding support to warp other players to warps, this requires the essentials.warp.otherplayers permission
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1342 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 15:53:32 +00:00
ementalo
e025a1a099 [trunk] warps should once again charge if setup in command costs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1334 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-03 23:39:10 +00:00
snowleo
224c18348a This is a big refactoring of the user class and more.
Many commands have been cleaned.

File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.

Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax

New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added

Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
-  time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
zenexer
da1023975b Formatting
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1235 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 19:13:53 +00:00
snowleo
a3ebd254f2 Moving all files to trunk.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@969 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-19 22:39:51 +00:00