Commit Graph

54 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
mart-r
b19dec120a
Don't show hidden players in /balance unless exact name entered (#3218)
Fixes #2305

Not looking for hidden players within the command, yet looking for offline players.
Only matching a hidden player if the name match was exact (i.e not matching nicknames).
2020-05-04 10:36:01 +01:00
Josh Roy
23f0f98af3
Cleanup code (#3067)
Co-Authored-By: md678685 <1917406+md678685@users.noreply.github.com>

Basically cleans up a bunch of warnings that are easily suppressed.
2020-04-25 13:08:57 +01:00
latiku
89743f9900
implement command teleporting to a player's last known logout location (#2505)
* implement /offlinetp command, teleports to a player's last known logout location

* send a message to /tp user when they try teleporting to an offline player

* getHidden is now false, you are no longer able to teleport to offline players using offline tp

* change /offlinetp to /tpoffline to match essentialsx conventions
2020-03-30 20:35:23 -07:00
AgentTroll
eaac3049af Fix getPlayer(...) for offline players having similar names 2019-03-09 18:50:55 -08:00
Ali Moghnieh
12930cfce4
Return online players instead of nothing when tab completing. (Fixes #1331) 2017-06-29 03:41:13 +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
Pokechu22
4c0857fbb5
Implement tab completion framework (#1203) 2017-06-06 01:31:41 +01:00
drtshock
dde0b20775 Reformat 2015-04-14 23:06:16 -05:00
KHobbits
ffea359661 rework /seen to be a little stricter on argument matching. 2014-08-18 21:00:03 +01:00
md_5
465041b98b Optimize player / user iteration.
* Add a method for backwards compatability with unmapped code.
* Convert all getOnlinePlayers() calls to use this method, part of the IEssentials interface
* Add a new method getOnlineUsers() Ljava/lang/Iterable;
* Convert appropriate calls to use this method
* Update Bukkit to #1945
* Update CraftBukkit to #3103
2014-07-19 20:07:50 +01:00
KHobbits
6269ce9a3f Update essentials to support 3rd party vanish toggling. 2014-06-27 01:46:37 +01:00
KHobbits
0557aa58b0 Switch AFK check to use UUID. 2014-04-27 01:10:44 +01: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
Iaccidentally
518650e842 Modifier order consistency 2014-02-04 11:11:43 -05:00
KHobbits
427b97433e Logger cleanup pt 1. 2013-12-07 20:03:05 +00: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
03368e45df Extract user match looping 2013-09-28 21:33:22 +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
3d29248ace Misc cleanup 2013-07-07 12:38:01 +01:00
KHobbits
09f67c9723 Split util classes. 2013-06-08 22:31:19 +01:00
KHobbits
423c8c54dc Simplify player matching. 2013-05-26 17:37:11 +01:00
KHobbits
3bcd3390fe [Fix] Fix vanished player matching in: /seen /give /burn /nuke /tpall /tpaall 2013-05-26 16:02:40 +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
5c05870490 Improve user matching 2013-05-20 18:50:14 +01:00
KHobbits
353423efec Use correct getPlayer method to not match offline users. 2013-03-20 01:29:54 +00:00
KHobbits
ae7c64619c Allow kicking of hidden players 2012-10-14 13:04:00 +01:00
KHobbits
e11525ab64 Update offline user check.
Add ban reason to /seen
2012-03-12 01:00:57 +00:00
snowleo
019b49ef11 Updated EssentialsSpawn to use the new config code
/spawn and /home now call the PlayerRespawnEvent to make it more compatible with other plugins.
2011-12-06 13:41:29 +01:00
snowleo
b5e9ad02ae arrrgggss 2011-11-27 00:31:14 +01:00
snowleo
c70700f7b8 Fix banning random player (and all other commands where a empty player is given) 2011-11-27 00:23:40 +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
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
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
snowleo
a085503c84 Users are now loaded async, so we have a new internal structure where they are saved.
I also did some cleanup on the classes that I worked on.

This needs testing, it might break, because it does not behave 100% identical like before.

it's possible that /balancetop now needs more time to finish, if not all users are loaded into memory.
2011-08-08 14:40:40 +02:00
snowleo
815b700eac Don't return offline players with getPlayer() 2011-07-20 22:14:56 +02:00
snowleo
6dbb5bc605 Always use lowercase if accessing users map. 2011-07-19 00:02:35 +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
be83383fd5 Added option to hide player from /list /who ... login message.
This is for other plugins, that want to hide a player.
Use IEssentials.getUser(Player p).setHidden(boolean)
2011-07-18 03:42:21 +02: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
0a924bf226 Cleanup 2011-06-23 14:58:37 +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
eb49497c07 Fix noPlayerFound => playerNotFound
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1484 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 14:02:22 +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