Commit Graph

43 Commits

Author SHA1 Message Date
df13e967fd imports cleanup 2020-06-14 10:27:15 +01:00
a2543ff80d Position: add getLevelNonNull()
this allows assuming that a position has a valid world in places where it's never expected to not be valid. Since this is the vast majority of usages, it eliminates a lot of possible null-pointer warnings given by static analysers.
TODO: Consider whether we can make Position->getLevel/World use this behaviour out of the box in the next major version.
2020-04-14 11:08:37 +01:00
9f44adf04a pass 2, manual removal of incorrect non-nullable @param for nullable native types 2020-01-21 15:44:34 +00:00
c4793241f5 Mass removal of useless @param/@return PHPDoc annotations, pass 1 2020-01-21 15:10:18 +00:00
260869c0d5 Position: populate missing return type information for fromObject() 2020-01-18 17:44:14 +00:00
e8d3a25028 Position::__construct() accepts floats for x,y,z 2019-12-12 16:15:49 +00:00
39c607cbd5 Position: mark level field as nullable
allowing the level to be null is, to be honest, a big design flaw, but one that can't be fixed without BC breaks.
2019-12-04 21:31:35 +00:00
562179bdd6 Backport 58cafc853f: s/level/world (strings only)
we should look at doing this for code too, but for now I'm not planning to break everyone's plugins.
2019-03-10 11:35:46 +00:00
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
b8523cb304 Merge branch 'remove-weak-position' 2018-05-10 13:53:07 +01:00
5eb1ee3416 Position: use setLevel() in constructor to validate level 2018-03-24 10:02:10 +00:00
8d645b714f Position: Destroy references to Level in isValid() 2018-03-20 10:55:24 +00:00
3d89bf5693 Updated PocketMine Math dependency 2018-03-18 18:08:24 +00:00
dd844f7ad3 Position: call parent constructor 2018-03-15 10:29:21 +00:00
3af8cf48b2 Removed setComponents() override in Position 2018-01-18 19:03:53 -05:00
ecba80fd63 Fixed some trailing whitespace
$ shopt -s globstar
 $ sed -i 's/[ \t]*$//' src/pocketmine/*/**.php

:P
2017-08-05 21:07:21 +01:00
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
b8a30309bb Improve checks for Position::equals() and Location::equals() (#929)
* Add files via upload

* Position::$level can be null.

* Use getLevel() in place of $level

because of WeakPosition.
2017-07-04 20:25:25 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
f0d12a0b30 Implemented asVector3(), asPosition() and asLocation()
Squash merge, closes #973
2017-06-07 16:40:45 +08:00
b28e38ab26 Move some exceptions out of utils into their relevant namespaces, move some Chunk methods to ChunkUtils for I/O, refactor "colour" -> "color" 2017-01-15 11:31:12 +00:00
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
6fbb9b6083 Check for closed target Levels in Position (#241)
More foolproof
2017-01-09 13:18:28 +00:00
03003ffa50 Improved invalid spawnpoint checking 2016-10-31 14:05:50 +00:00
7a1cdf88e8 Fixed bugs related to #24 such as getName() on null 2016-10-31 13:50:18 +00:00
cf3d8f449e Added some asserts 2015-09-27 19:48:42 +02:00
3ffdb8e552 Removed @deprecated classes, methods and properties, added some type hints 2015-09-12 17:10:11 +02:00
a4735eaf76 Replaced some instanceof to null checks 2014-12-09 02:22:18 +01:00
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +01:00
8c4faa8622 Added extra Exceptions 2014-10-28 21:07:12 +01:00
350cee3d41 Added Event allocation pool, updated SPL with Class::onClassLoaded() 2014-10-28 10:47:40 +01:00
144a871c07 Improved Vector3 and Block handling, less allocation on Positions 2014-10-28 10:03:10 +01:00
43a97c407d New PlayerMoveEvent, improved player movement event firing 2014-10-14 16:10:50 +02:00
01ebe74974 Performance improvements in blocks and Entities 2014-08-24 14:08:17 +02:00
e10c70e776 A typo fix 2014-08-06 11:06:30 +08:00
2cead226db Fixes Position::fromObject() $strong parameter neglected 2014-08-05 23:45:09 +08:00
ec055fd8d1 Items spawn, Tiles spawn, both are saved, blocks drop 2014-05-24 17:25:37 +02:00
53749483c3 Implemented new Inventory windows on Player, Chest and Furnace 2014-05-23 20:53:06 +02:00
c1546aac9c Updated Position to use Weak / strong references for Level objects 2014-05-22 04:14:06 +02:00
99818a26f5 Added object metadata for Plugins, use WeakMap on perms 2014-05-19 20:07:27 +02:00
abccfeac37 Updated Vector-related classes 2014-04-10 05:04:58 +02:00
dd17652aca Fixed wrong paths 2014-04-01 05:06:12 +02:00