282 Commits

Author SHA1 Message Date
Dylan K. Taylor
3ea8da2dd3 Use EnumTrait->equals() instead of direct comparison
It's not guaranteed that objects provided are the same as those in the enum registry, so they can't be directly compared.

Implementing comparison with === would require some kind of __equals() implementation or an extension to hook into such functionality.
2019-05-24 17:21:44 +01:00
Dylan K. Taylor
9ea684581f Merge remote-tracking branch 'origin/stable' 2019-05-13 18:17:42 +01:00
Johnmacro
bb93d4f8de TimeCommand: Fix commands.time.query message (#2917) 2019-05-12 09:21:39 +01:00
Dylan K. Taylor
ca7c23c137 Player: remove dead functions
these functions belong in the network session, and they are currently just proxies for them. In the future we might have players who don't have IPs at all depending on how they connected (for example Specter) so this stuff shouldn't be in here.
2019-05-08 19:47:25 +01:00
Dylan K. Taylor
cf0c0e72a9 Assume the player is online when they are, uh, assumed to be online
the checks removed here should never be hit under normal circumstances. If they were hit, they'd just conceal bugs which would cause a crash to happen later anyway.
2019-05-07 19:49:06 +01:00
Dylan T
3cd6e12e71
Renaming "Level" -> "World" (#2907)
This has been a pain point for a long time due to the misleading nature of the name "level". It's also confusing when trying to do things like getting the XP level of the player or such, and also does not translate well to other languages.

This transition was already executed on the UI some time ago (language strings) and now it's time for the same change to occur on the API.

This will burn a lot of plugins, but they'll acclimatize. Despite the scary size of this PR, there isn't actually so many changes to make. Most of this came from renaming `Position->getLevel()` to `Position->getWorld()`, or cosmetic changes like changing variable names or doc comments.
2019-05-07 14:47:28 +01:00
Dylan K. Taylor
293311569d Merge branch 'next-minor' 2019-05-01 18:55:49 +01:00
=?UTF-8?q?Fabian=20Fa=C3=9Fbender?=
932c489de1 Rename addTitle/addSubTitle/addActionBarMessage prefixes to "send", deprecated old variants
closes #2896

these deprecated methods will be removed in 4.0.
2019-05-01 18:54:20 +01:00
Dylan K. Taylor
6aa8276532 Revert "Player: removed useless addActionBarMessage()"
This reverts commit 7d22b2a6d7d372a5020b9a2b44a93cdc821565c8.
2019-04-26 15:41:19 +01:00
Dylan K. Taylor
752e398970 AsyncTask: TLS now supports storing multiple values (now requires a key/value pair) 2019-04-18 18:58:31 +01:00
Dylan K. Taylor
209ae51a67 Merge branch 'stable' 2019-04-15 16:11:49 +01:00
Dylan K. Taylor
4c268acc00 Fixed /whitelist on/off permissions, closes #2849 2019-04-14 17:58:53 +01:00
Dylan K. Taylor
5f23fffdda Merge remote-tracking branch 'origin/3.7' 2019-04-12 18:33:13 +01:00
Dylan K. Taylor
e9a87978a6 Fixed usages of commands.generic.permission
apparently this doesn't exist in the client anymore
2019-04-07 15:07:24 +01:00
Dylan K. Taylor
7d22b2a6d7 Player: removed useless addActionBarMessage()
this is exactly the same as sendTip().
2019-04-02 18:43:14 +01:00
Dylan K. Taylor
f0b85936cf Improved /tell 2019-03-31 19:08:35 +01:00
Dylan K. Taylor
42a263a9df GameMode is now an enum 2019-03-31 16:19:36 +01:00
Dylan K. Taylor
649ce5080b StatusCommand: don't use config for reading global limit 2019-03-27 19:24:06 +00:00
Dylan K. Taylor
7333e7118e Server: remove useless function 2019-03-26 15:52:34 +00:00
Dylan K. Taylor
23071d257e Extract process-related functions from Utils into a separate Process class 2019-03-24 18:57:32 +00:00
Dylan T
d03f0aab37
Remove /reload (#2823)
For many years, this has been the cause of many users (particularly plugin devs) confusion. The reality is that /reload has little to no practical value. It does not reload plugin source code (contrary to popular belief).
2019-03-22 15:01:11 +00:00
Dylan K. Taylor
ad19696364 Make Effect and Enchantment functions less verbose 2019-03-13 15:26:21 +00:00
Dylan K. Taylor
5c12bee874 Backport other part of 2bffd5cc1c326670c25386ce78e5c690f4c5fd54: Add timer measurements for autosave 2019-03-10 11:20:51 +00:00
Dylan K. Taylor
0659d2fbef Backport 6bd43a8215b9e612478fe789da9a58b36f0f0e73: Firehose auto-tick-rate anti-feature, closes #2665 2019-03-09 19:20:53 +00:00
Dylan K. Taylor
6bd43a8215 Firehose auto-tick-rate anti-feature, closes #2665 2019-03-03 13:24:53 +00:00
Dylan K. Taylor
2bffd5cc1c Add timer measurements for autosave 2019-03-02 18:20:25 +00:00
Dylan K. Taylor
6c8fa8ae28 More nullable and void typehints 2019-03-02 10:29:11 +00:00
Dylan K. Taylor
9ad0ea85c7 Rename two misleadingly-named functions 2019-02-27 12:59:12 +00:00
Dylan K. Taylor
c26544475e More PHP 7.1 nullables 2019-02-22 12:55:34 +00:00
Dylan K. Taylor
646fea5a4e Effect: Introduce a bunch of static getters, change a bunch of API to use objects
This introduces static getters for every currently-known effect type. At some point in the near future, the magic number constants (which are really network IDs, by the way) will disappear.

Migrating:
- If you used constants (like any sensible person would): for the most part it's just a case of adding a () anywhere you used an Effect constant.
- If you hardcoded magic numbers: ... well, have fun fixing your code, and I reserve the right to say "I told you so" :)

This achieves multiple goals:
1) creating an EffectInstance for application is much less verbose (see diff for examples, especially the Potion class)
2) plugin devs cannot use magic numbers to apply effects anymore and are forced to use type-safe objects. :)

This is a warning shot for plugin devs who use magic numbers. More changes like this are coming in the not-too-distant future.
2019-02-20 12:05:17 +00:00
Dylan K. Taylor
f49d590794 Level: remove getTiles(), more removal of tiles from user interface 2019-02-15 16:27:00 +00:00
Dylan K. Taylor
470879c9bf Merge branch '3.6' 2019-02-13 14:53:20 +00:00
Jack Noordhuis
27767e7ddb Verify player name command input, closes #2729, closes #2749 2019-02-13 14:50:43 +00:00
Dylan K. Taylor
243c12de7c EffectCommand: fix bounds check, closes #2055 2019-02-13 14:37:40 +00:00
Dylan K. Taylor
78dfcc5f2d Move Effect and EffectInstance to entity\effect namespace 2019-01-28 15:41:07 +00:00
Dylan K. Taylor
0b1bdec3ac GameMode::fromString() now throws InvalidArgumentException 2019-01-26 17:09:54 +00:00
Dylan K. Taylor
6df983da3e Merge branch '3.5' 2019-01-19 16:24:41 +00:00
Dylan K. Taylor
82dddde159 Remove dead code in /time command handler 2019-01-19 15:15:04 +00:00
Dylan K. Taylor
bc709efb77 Prevent stupidity with /enchant 2019-01-19 15:14:51 +00:00
Dylan K. Taylor
6b7710e62b Introduce dedicated NBT data exceptions, fix up some corrupted chunk handling 2019-01-19 12:43:47 +00:00
Dylan K. Taylor
e341f3dce2 Level: rename getName() to getDisplayName() 2019-01-17 16:46:56 +00:00
Dylan K. Taylor
5052b75565 Separate Level management functionality from Server, clean up a bunch of mess 2019-01-12 19:11:05 +00:00
Dylan K. Taylor
27761ac26e Fixed casing: Gamemode -> GameMode
it's two words, not one.
2019-01-12 16:19:31 +00:00
Dylan K. Taylor
a756519e6b Move gamemode constants & functions to their own class
future enhancements:
- make gamemode an object containing information about abilities that players have in this gamemode (gamemodes are just predefined ability sets)
- get the magic numbers out of the API
2019-01-12 16:10:14 +00:00
Dylan K. Taylor
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00:00
Dylan K. Taylor
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
0bacf51729 Fix another swathe of number_format() truncation bugs 2019-01-04 19:39:51 +00:00
Dylan K. Taylor
33f6b441d8 Fixed /gc truncating memory freed
wtf PHP?
2019-01-04 17:30:35 +00:00
Dylan K. Taylor
e1064a9e36 Merge branch '3.5' 2019-01-04 00:37:48 +00:00
Dylan K. Taylor
d71a543d10 Fixed a bunch of things PHPStan finds unpalatable
close #2614, fix a bunch of docs bugs, fix sendCreativeContents() crash on Human holders, move some inline variable declarations
2019-01-04 00:23:09 +00:00