Commit Graph

38 Commits

Author SHA1 Message Date
Josh Roy
f6cb9ff470
Improve command codestyle (#3337)
Co-authored-by: MD <1917406+md678685@users.noreply.github.com>

Fixes #3579 (async `/skull` command)
Fixes #3336 (improve codestyle of commands)
Partially addresses #3339 (`/spawn` and `/setspawn` are now hidden from tabcomplete)
Closes #3087 (`/paytoggle` is now a loop command)
2020-08-11 19:09:22 +01:00
Josh Roy
9aec89f381
Properly handle jail respawn in togglejail (#3522) 2020-07-21 16:22:20 -07:00
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
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
Matthew Steglinski
23f3d69d38 [Fix] Call JailStatusChangeEvent when jailing and unjailing players. Fixes #161 2015-10-28 13:29:29 -06:00
drtshock
dde0b20775 Reformat 2015-04-14 23:06:16 -05:00
KHobbits
36e580474f Converted emulated player class calls to use base class. 2014-04-13 01:01:49 +01:00
FearFree
5724c0c8df Future Java versions may not support _ as identifier. 2014-03-22 16:08:11 +11:00
FearFree
ae89c80d4e Clarify no perm msgs for missing .offline perms
Signed-off-by: KHobbits <rob@khobbits.co.uk>
2013-10-28 00:10:33 +00:00
KHobbits
6f85761f7f Extract CommandSender to CommandSource, this should prevent Ess user object leaks. 2013-10-16 21:05:33 +01:00
Iaccidentally
f1eae9be6f Cleanup imports 2013-06-11 20:45:12 +01:00
KHobbits
09f67c9723 Split util classes. 2013-06-08 22:31:19 +01:00
KHobbits
353423efec Use correct getPlayer method to not match offline users. 2013-03-20 01:29:54 +00:00
KHobbits
e11525ab64 Update offline user check.
Add ban reason to /seen
2012-03-12 01:00:57 +00:00
snowleo
72e187cd5c Updated Jails to use the new config classes 2011-12-06 17:28:48 +01: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
KHobbits
e5a8cd88f0 Code cleanup continued. 2011-11-18 17:48:49 +00:00
okamosy
8d6e3e7c18 Merge branch 'master' of github.com:essentials/Essentials 2011-09-10 09:39:15 +01:00
snowleo
6427a93d14 Correctly charge for the use of commands.
We now first test, if the user could pay it, do the stuff and then charge him. If the command throws an exception, the user will not be charged.
2011-08-27 23:14:49 +02:00
okamosy
bc93bc6ae7 Cleaned up todo lists 2011-08-26 21:03:09 +01:00
KHobbits
040e2bee86 Fixing trade sign messages
Unifying tree/spawnmob code for block selection
Adding TL notes
2011-08-21 17:08:32 +01:00
KHobbits
8d1262fc91 Check jail first, before setting. 2011-08-19 12:16:28 +01:00
snowleo
69d3921a6a Fixes to jail 2011-08-08 16:42:56 +02:00
snowleo
c8ba06f0ee We can't test for essentials.jail.exempt, if the player is offline, so added a new permission essentials.togglejail.offline 2011-07-19 01:27:16 +02:00
snowleo
a65390ed98 More fixes to /tjail
Don't prevent unjailing an admin
Fix time change
2011-07-19 01:12:19 +02:00
snowleo
6b85b306ef Another fix for /tjail offline players 2011-07-19 00:59:43 +02:00
ementalo
15687c20d0 only check hidden if !offline, compare user with offlineplayer class 2011-07-18 22:49:27 +01:00
ementalo
81cc5b1f28 Add yet another way to get a user from our users list, Don't teleport an offline player when jailed
Added playerjoin to jaillistener to teleport a player on login
2011-07-18 22:16:58 +01:00
snowleo
a38fe6acd4 Heavy cleanup of all classes
ItemDb is not static anymore
Essentials.getStatic() removed
2011-07-16 01:33:22 +02:00
ementalo
71c11d05fd remove null check for user in toggle jail. this is handled when we get user 2011-07-07 21:08:42 +01:00
ementalo
ce14779d2b #571 test jailing offline players. Person needs to have visited the server at least once and have a players.yml file 2011-07-07 21:05:08 +01: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
798cb319f9 More translation stuff
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1469 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 23:30:56 +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
snowleo
2f1e22bfb3 [trunk] Fixes tjail if there is a jail stuck in the config.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1138 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-06 00:52:27 +00:00
snowleo
fc2c9d71bb [trunk] Fixes failed back after tjail
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1137 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-06 00:50:16 +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