9200 Commits

Author SHA1 Message Date
Dylan K. Taylor
19614ed25e Entity: move some NBT usages out of constructor, fix missing property defaults 2019-01-10 21:01:19 +00:00
Dylan K. Taylor
f4d07f0c1e Merge branch '3.5' 2019-01-10 19:31:01 +00:00
Dylan K. Taylor
f7d9247d39 Server: Permit NULL value entries in pocketmine.yml worlds
this permits listing worlds to load as keys without values.
2019-01-10 19:30:37 +00:00
Dylan K. Taylor
1f54760dae Config: Make load() private 2019-01-10 18:03:15 +00:00
Dylan K. Taylor
5d8fa2e126 Crash main server thread when RakLib dies
this way we get crashdumps and find out what's actually wrong with RakLib in the wild.
2019-01-09 19:04:12 +00:00
Dylan K. Taylor
cc230034f9 Fixed TransactionData->actions default value, closes #2652 2019-01-09 14:15:06 +00:00
Dylan K. Taylor
b9ce6537a8 Sync composer dependencies (master) 2019-01-09 00:22:42 +00:00
Dylan K. Taylor
8452c7bdbd Sync composer dependencies 2019-01-09 00:18:55 +00:00
Dylan K. Taylor
2924303169 Sync NBT dependency 2019-01-07 22:38:04 +00:00
Dylan K. Taylor
9c16caf27b Fixed an edge-case in AvailableCommandsPacket decoding 2019-01-07 22:23:51 +00:00
Dylan K. Taylor
4f50119b74 LoginPacket: Cater for more error cases
This now doesn't crash unexpectedly at the first sign of broken data.
2019-01-07 14:45:44 +00:00
Dylan K. Taylor
3380aa3ac2 Config: Assert only whitespace precedes .properties key, fixes #commented properties not being skipped 2019-01-07 12:25:05 +00:00
Dylan T
8663be8504
moar issue templates 2019-01-07 00:59:16 +00:00
Dylan K. Taylor
78cb6445a5 Introduce TileFactory 2019-01-07 00:20:24 +00:00
Dylan K. Taylor
7d827a1c65 Introduce EntityFactory
This contains all of the static stuff that was previously embedded in the Entity static root. This solves a bunch of problems like circular dependencies between parent and child classes, encapsulating logic and reducing the size of the enormous Entity.php.
2019-01-06 23:54:29 +00:00
Dylan K. Taylor
b1cef8509a Revamp Entity construction
This is a similar refactor to the one I recently did for tiles.

- Entity::createEntity() is removed. In its place are Entity::create() (runtime creation, use where you'd use a constructor, accepts a ::class parameter, throws exceptions on unknown entities) and Entity::createFromData() (internal, used to restore entities from chunks, swallows unknown entities and returns null).
- Entity::registerEntity() is renamed to Entity::register().
- Added Entity::override() to allow overriding factory classes without touching save IDs. This allows more cleanly extending & overriding entities. This method only allows overriding registered Entity classes with children of that class, which makes code using the factory much more sane and allows to provide safety guarantees which make the code less nasty.
- Entity::getKnownEntityTypes() is renamed to Entity::getKnownTypes().
- ProjectileItem::getProjectileEntityType() now returns a ::class constant instead of a stringy ID.
- Cleaned up a bunch of nasty code, particularly in Bow.
2019-01-06 23:33:36 +00:00
Dylan K. Taylor
3ae722867c Merge branch '3.5' 2019-01-06 20:19:18 +00:00
Dylan K. Taylor
6a9cad8fb7 3.5.6 is next 2019-01-06 20:18:32 +00:00
Dylan K. Taylor
c9e598cdb9 Release 3.5.5 3.5.5 2019-01-06 19:55:21 +00:00
Dylan K. Taylor
a6e5b6e158 Log a debug message when not sending crash due to folder plugin 2019-01-06 19:52:20 +00:00
Dylan K. Taylor
22a6b817d7 Distinguish between direct and indirect plugin crash involvement
If a plugin was involved in a crash, we can't safely blame it for the crash, since it might have innocently triggered a core bug. Furthermore, it's difficult to accurately detect plugin causing things like invalid argument crashes.
2019-01-06 18:07:29 +00:00
Dylan K. Taylor
2cdf97b7b5 CrashDump: Scan full stack trace to determine plugin involvement 2019-01-06 18:07:29 +00:00
Dylan K. Taylor
836cb67850 Server: don't abuse random_bytes() to generate integers 2019-01-06 17:22:31 +00:00
Dylan K. Taylor
f0733f6ab6 Merge branch '3.5' 2019-01-06 01:09:34 +00:00
Dylan K. Taylor
ab37df4484 Server: micro-optimization: avoid unnecessary array_shift()
it's much less expensive to just calculate the modulo of the current tick and 20, and overwrite past entries. The effect is the same. The only difference is that the arrays won't be ordered by time, but that doesn't matter anyway.
2019-01-06 01:08:56 +00:00
Dylan K. Taylor
f80eeee20f Merge branch '3.5' 2019-01-05 18:59:13 +00:00
Dylan K. Taylor
93969197f7 Enable status,gc,dumpmemory OOB
dumpmemory has been confined to console by default due to the hazards it poses to a running server.

closes #2528
2019-01-05 18:56:57 +00:00
Dylan K. Taylor
946a1036f1 Drop warn-if-enabled for asserts
I don't know why this is optional when no other debug warnings are.
2019-01-05 18:49:15 +00:00
Dylan K. Taylor
43410cdafb Server: warn on assertions !== -1, closes #2640 2019-01-05 18:47:29 +00:00
Dylan K. Taylor
cdf2f98e26 Merge branch '3.5' 2019-01-05 17:41:26 +00:00
Dylan K. Taylor
a99e15012c Backport no-ai hack to disable pre-spawn movement 2019-01-05 17:39:20 +00:00
Dylan K. Taylor
b22a2ef914 Living: Despawn in endDeathAnimation()
this removes the necessity for the player to do this.
2019-01-05 12:46:11 +00:00
Dylan K. Taylor
532def67ab Merge branch '3.5' 2019-01-05 11:12:34 +00:00
Dylan K. Taylor
f7f7be896e Server: drop misleading config values 2019-01-05 11:12:09 +00:00
Dylan K. Taylor
d83f024a1f Merge branch '3.5' 2019-01-05 09:27:16 +00:00
Dylan K. Taylor
254281cd5e Ice: don't create water for creative players, fixes #2622 2019-01-05 09:26:35 +00:00
Dylan K. Taylor
226db35cf9 Merge branch '3.5' 2019-01-04 23:56:53 +00:00
Dylan K. Taylor
5dfceeea98 Fix typo in command.op.take permission description 2019-01-04 23:56:29 +00:00
Dylan K. Taylor
d8d04aeb53 fixup some imports 2019-01-04 23:49:32 +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
febf1b1801 Merge branch '3.5' 2019-01-04 11:46:12 +00:00
Dylan K. Taylor
11b59498d9 TakeItemEntityPacket: add missing decode, close #2633 2019-01-04 11:45:37 +00:00
Dylan K. Taylor
7a4e2371e6 master-specific PHPStan nits 2019-01-04 00:40:09 +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
Dylan K. Taylor
8ef15d728a HandshakeSessionHandler: fix a doc comment bug
thank you PHPStan ❤️
2019-01-03 22:36:31 +00:00
Dylan K. Taylor
c559dfccfe DataPacket: encode() and decode() are now final, encodePayload() and decodePayload() are now abstract 2019-01-03 21:14:54 +00:00