TF-EssentialsX/Essentials/src/com/earth2me/essentials
pop4959 9e2b906048
Display date diff correctly (#3292)
There is an age old issue in Essentials which causes date diffs (such as those displayed in teleportation delays, mutes, and temp bans) to display incorrectly to the user when the command is run. After looking into this a bit, it looks like the reason for this is that if there is even a 1 ms time difference between parsing the date diff and displaying it, the time displayed will be truncated by an entire second. This PR fixes this problem by adding 50 ms of buffer time to the date object *only* when it is calculating the date diff string. This is not significant enough to be noticed by users, and allows Essentials code to correctly generate the date diff string as long as it does so within 50 ms of parsing it.

As a theoretical example... lets say a user is muted for 1 year. If 1 ms passed (in code prior to this PR) between parsing and displaying the date diff, then the displayed time will be 11 months, 29 days, 23 hours. This is because 1 year - 1 ms is being truncated down and then Essentials lops off time accuracy beyond the 3 most significant terms. After this PR, the date diff will be parsed normally, but when the display string is being calculated, it will use 1 year + 50 ms (and if 1 ms passed, then that would be 1 year + 49 ms), which gets truncated to 1 year.

As a practical example:
https://user-images.githubusercontent.com/17698576/82106444-d55c0700-96d5-11ea-8290-377442e4f9fe.png

Quite often (I'd say about half of the time) before this PR, the date diff will display like this, when the example command `/mute <player> 1y` is run.

https://user-images.githubusercontent.com/17698576/82106467-063c3c00-96d6-11ea-9da2-3dc1556add14.png

After this PR, the date diff displays correctly every time.

Fixes #3349.
2020-05-30 15:18:16 +01:00
..
api Add UUID and User based economy methods (#3085) 2020-05-04 11:00:25 +01:00
commands Fix issue with eco reset requiring 3 args (#3340) 2020-05-28 11:44:46 -07:00
craftbukkit Fix isStopping MethodHandle invocation on Spigot (#3267) 2020-05-12 20:14:01 +01:00
items Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
messaging implement PrivateMessagePreSendEvent (#3260) 2020-05-13 08:03:28 +01:00
metrics Fix Metrics plugin name reporting 2019-05-13 19:15:33 +01:00
perm Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
register/payment Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
settings Remove unnecessary types 2019-03-08 11:24:42 +00:00
signs Fix invalid charge error when using suffix currency on signs (#3253) 2020-05-11 15:20:00 +01:00
storage Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
textreader Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
utils Display date diff correctly (#3292) 2020-05-30 15:18:16 +01:00
AlternativeCommandsHandler.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Backup.java Fix age old bug with active status in Backup manager (#3262) 2020-05-11 18:09:29 -07:00
ChargeException.java Reformat 2015-04-14 23:06:16 -05:00
CommandSource.java Rewrote messaging structure for more abstractness. 2015-10-27 20:46:58 -06:00
Console.java Add isReachable API to IMessageRecipient. 2015-10-30 19:58:30 +00:00
Enchantments.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Essentials.java Remove 1.8 NMS spawner providers (#3276) 2020-05-13 10:56:50 +01:00
EssentialsBlockListener.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
EssentialsConf.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
EssentialsEntityListener.java Option to send coordinate after death (#3207) 2020-05-27 01:58:54 -07:00
EssentialsPlayerListener.java Add permission for storing user's last location on teleportation (#3272) 2020-05-13 15:53:36 -07:00
EssentialsPluginListener.java Fix compile, consider this stable 2015-06-19 21:48:11 -04:00
EssentialsServerListener.java Ignore CloudNet v3 SLPE (#3288) 2020-05-17 15:35:31 +01:00
EssentialsTimer.java Nullcheck user iteration in EssentialsTimer (fixes #675) 2016-06-25 09:47:06 -06:00
EssentialsUpgrade.java Cleanup after UUID Ignore List PR (#3227) 2020-05-04 14:32:49 +01:00
EssentialsUserConf.java Reformat 2015-04-14 23:06:16 -05:00
ExecuteTimer.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
I18n.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
IConf.java Run IntelliJ IDEA inspections 2015-06-03 14:11:56 -06:00
IEssentials.java Allow toggling public broadcast of AFK messages (#2780) 2020-04-13 14:33:37 +01:00
IEssentialsModule.java Reformat 2015-04-14 23:06:16 -05:00
ISettings.java Add config option to block /pay from ignored users (#3273) 2020-05-27 12:34:11 -07:00
ITarget.java Run IntelliJ IDEA inspections 2015-06-03 14:11:56 -06:00
IUser.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Jails.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Kit.java Fix invalid charge error when using suffix currency on signs (#3253) 2020-05-11 15:20:00 +01:00
Kits.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
LocationTarget.java Reformat 2015-04-14 23:06:16 -05:00
ManagedFile.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
MetaItemStack.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Mob.java Update to 1.15 (#2873) 2019-12-11 07:47:56 +00:00
MobCompat.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
MobData.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
OfflinePlayer.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
PlayerExtension.java Reformat 2015-04-14 23:06:16 -05:00
PlayerList.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
PlayerTarget.java Reformat 2015-04-14 23:06:16 -05:00
Potions.java Compile against 1.13 preview. 2018-01-18 17:52:44 -08:00
Settings.java Add config option to block /pay from ignored users (#3273) 2020-05-27 12:34:11 -07:00
SpawnMob.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Teleport.java Add permission for storing user's last location on teleportation (#3272) 2020-05-13 15:53:36 -07:00
TimedTeleport.java Use PaperLib to load chunks and teleport players async (#2409) 2019-02-20 12:25:05 +00:00
TNTExplodeListener.java Reformat 2015-04-14 23:06:16 -05:00
Trade.java Reformat 2015-04-14 23:06:16 -05:00
User.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
UserData.java Convert ignore list storage to UUID-based (#3209) 2020-05-04 11:06:09 +01:00
UserMap.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
UUIDMap.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Warps.java Cleanup code (#3067) 2020-04-25 13:08:57 +01:00
Worth.java Fix Worth.setPrice on 1.13+; add Javadocs to Worth 2018-12-08 16:32:09 +00:00