35 Commits

Author SHA1 Message Date
Dylan K. Taylor
363556e9b6 AvailableCommandsPacket: encode & decode for enum value constraints
This is a peculiarly overengineered system that is used for restricting access to enum members under certain conditions, e.g. to disallow changing specific gamerules in survival.
2019-11-30 12:31:31 +00:00
Dylan K. Taylor
6f08853b29 Merge branch 'stable' into drew-1.13 2019-11-30 12:04:46 +00:00
Dylan K. Taylor
42d8357821 AvailableCommandsPacket: fixed missing decoded overloads with 0 arguments
these should be listed even if they have 0 arguments
2019-11-30 11:58:29 +00:00
Stephen
f682c16740 Changed eduMode to eduEditionOffer and added an unsignedVarInt in availablecommandspacket 2019-11-21 14:55:29 -05:00
Stephen
6105198313 Update AvailableCommandsPacket constants 2019-11-20 22:47:48 -05:00
Dylan K. Taylor
d1ca779c1a fix PHPStan @throws incompatible warning 2019-10-25 15:49:47 +01:00
Dylan K. Taylor
da17ade575 AvailableCommandsPacket: fixed wrong parameter type doc for putEnum() 2019-10-22 12:23:01 +01:00
Dylan K. Taylor
7d5c3c9b46 backport 4364d2a94: AvailableCommandsPacket: Clean up internals
this is still disgusting, but it's a little more bearable now.
2019-10-21 14:51:36 +01:00
Frago9876543210
cff2d37add backport ec0558597b6ca948228846b25751c2b1863cbf3f: CommandParameter: change byte1 field to "flags" (#3115) 2019-10-21 10:03:59 +01:00
Dylan K. Taylor
00644dd529 Fixed an edge-case in AvailableCommandsPacket decoding 2019-04-26 12:32:42 +01:00
Sandertv
2659ed8d91 AvailableCommandsPacket: Updated the argument type constants for 1.10. (#2824) 2019-03-22 15:07:15 +00:00
Dylan K. Taylor
9c01ecbe7e Merge branch '3.6' into 3.7 2019-03-21 19:02:20 +00:00
Dylan K. Taylor
cce99b07af 1.10.0 updates 2019-03-20 19:17:41 +00:00
Sandertv
1a8b33dafe AvailableCommandsPacket: Updated the ARG_TYPE constants
closes #2817
2019-03-18 08:58:07 +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
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
Dylan K. Taylor
566f3c6262 AvailableCommandsPacket: stricter decode and handling 2018-08-21 17:14:54 +01:00
Dylan K. Taylor
0d05dcec08 AvailableCommandsPacket: deal with dynamic enums
somehow I missed this, thanks @NiclasOlofsson for pointing it out
2018-08-21 17:14:53 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
c7544c1d25 AvailableCommandsPacket: update arg types 2018-05-02 12:03:29 +01:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
f477cfa1bf Fixed a mistake in AvailableCommandsPacket 2017-11-25 11:15:20 +00:00
Dylan K. Taylor
1fd9994056 Merge branch 'master' into mcpe-1.2.5 2017-11-21 16:48:18 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
Dylan K. Taylor
784ecef805 Remove unnecessary count() 2017-11-08 19:44:10 +00:00
Dylan K. Taylor
41f363d0c1 Added encode for AvailableCommandsPacket, bring back command lists (no arguments yet) 2017-11-08 11:52:06 +00:00
Dylan K. Taylor
8d0b881762 fixed command arg types 2017-09-10 13:56:34 +01:00
Dylan K. Taylor
0eb866bf25 Updated AvailableCommandsPacket 2017-09-09 14:23:19 +01:00
Dylan K. Taylor
1576a79644 more packets 2017-08-13 17:43:33 +01:00
Dylan K. Taylor
7886918140 Cleaned up some bad code in DataPacket, added encode/decodeHeader and made encode/decodePayload protected 2017-08-06 17:21:51 +01:00
Dylan K. Taylor
2726f2a011 Solved packet encode/decode boilerplate code issue
Something as simple as forgetting the reset() when encoding would cause lots of problems which could go unnoticed. This should be fully backwards-compatible but needs more tests.
2017-07-07 13:59:09 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
22ba017965 Binary strict types (#969)
* Some Binary cleanup, type-hints and strict types
yes, I know this is very crashy... that's good, because it highlights unexpected behaviour

* added some default values
2017-06-03 09:39:45 +01:00
Dylan K. Taylor
0a4d62b405 Added encode and decode methods for more packets 2017-05-15 15:56:59 +01:00
Dylan K. Taylor
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00