7696 Commits

Author SHA1 Message Date
Dylan K. Taylor
c464d39401 Player: Order chunks immediately on receiving chunk radius request 2018-03-23 19:44:03 +00:00
Dylan K. Taylor
a185b78486 Player: fixed logic of move-into-bad-chunk checks
particularly the hack with chunk switching was causing unexpected behaviour wrt. invisible players.
2018-03-23 19:34:45 +00:00
SOFe
c19cf22ac5
Fixed #2110 2018-03-21 21:52:55 +08:00
Dylan K. Taylor
d2fb32c28a PluginManager: added event call recursion limit, closes #2109
This prevents unexplained segfaults on accidental event call recursion by limiting the max depth of event call stack to 50. If another event attempts to be called, an exception will be thrown.
2018-03-21 10:40:08 +00:00
SOFe
49fbbea7bf Implemented event handler inheritance, allow registering handlers for any valid event (#1792)
* Event handlers always handle subclass events. public static $handlerList no longer required.
* Removed $handlerList declarations
* HandlerList cleanup: Removed HandlerList->handlers and related bake methods
* Removed obsolete Event->getHandlers()
* EventPriority: Added fromString()
* PluginManager: throw exceptions on registering handlers with invalid priorities

This allows specifying a handler of `EntityDamageEvent` which will handle any instanceof it (as per current behaviour), AND also now allows specifying a handler specifically for `EntityDamageByEntityEvent`, which only handles `EntityDamageEvent`.

This was not previously possible due to limitations in the way handlers were registered.

Abstract events may not be handled unless they declare the `@allowHandle` PhpDoc tag.
2018-03-20 17:05:09 +00:00
Dylan K. Taylor
1648fff916 Replaced Position->getLevel() null checks with isValid() 2018-03-20 11:10:36 +00:00
Dylan K. Taylor
8d645b714f Position: Destroy references to Level in isValid() 2018-03-20 10:55:24 +00:00
Dylan K. Taylor
403e996d2f Level: Removed WeakPosition
This is a bad fix for an issue found in one specific use-case. This is redundant because the only places this is used are places where it's guaranteed to be valid, or places where it is checked to be valid anyway.

The Level leak originally noted that led to the creation of this class is something I consider to be a non-issue, because all the heavy things will be cleaned up anyway.
2018-03-20 10:49:23 +00:00
Dylan K. Taylor
73e09392b6 Timings: Clean up some terrible code, move namespaces 2018-03-19 19:05:51 +00:00
Dylan K. Taylor
209e28dfe5 Level: Removed MovingObjectPosition 2018-03-19 16:58:45 +00:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
24c5d7557e Updated PreProcessor submodule 2018-03-19 12:44:54 +00:00
Dylan K. Taylor
3d89bf5693 Updated PocketMine Math dependency 2018-03-18 18:08:24 +00:00
Dylan K. Taylor
e48ec9fb71 Ore: replaced a sub-optimal multiply()->divide() on Vector2 2018-03-18 18:06:04 +00:00
Dylan K. Taylor
95606b6e04 Generator: fixed a couple of hardcoded block IDs 2018-03-18 18:03:23 +00:00
Dylan K. Taylor
c243daabe1 DumpMemoryCommand: removed token annoyance, use date/time to identify memory dumps by default 2018-03-18 12:17:31 +00:00
Dylan K. Taylor
357674cb54 DumpMemoryCommand: move memory dumps to their own folder
this is for ease of ignoring in IDEs.
2018-03-18 12:06:15 +00:00
Dylan K. Taylor
9d5eeb328e Player: cleanup how login verification is handled
Players are now only considered authenticated if they have an XUID AND have a keychain with a Mojang signature in it somewhere.
2018-03-17 18:44:26 +00:00
Dylan K. Taylor
b2ee6b2ca5 Player: consolidate and add type docs for fields 2018-03-17 17:42:01 +00:00
Dylan K. Taylor
2860e9e8ee Player: remove clientSecret (useless) 2018-03-17 16:44:34 +00:00
Dylan K. Taylor
e82073834f Player: protect some fields 2018-03-17 16:43:34 +00:00
Dylan K. Taylor
7fcc538a75 Level: clone Block object passed to setBlock() if set successfully
closes #2042
2018-03-17 16:35:10 +00:00
Dylan K. Taylor
7f6b8ad7c2 Moved \pocketmine\math to a separate library 2018-03-17 12:45:55 +00:00
Dylan K. Taylor
313b224bec Updated Composer dependency names and repo URLs 2018-03-17 12:19:14 +00:00
Dylan K. Taylor
d12b1d3e07 Updated RakLib dependency 2018-03-17 11:27:56 +00:00
Dylan K. Taylor
eeeef8df51 Fixed concrete powder not falling 2018-03-16 16:43:47 +00:00
Dylan K. Taylor
9c786089f8 Level: don't create objects which aren't going to be used 2018-03-16 13:00:16 +00:00
Dylan K. Taylor
e3cae7364f Level: don't send empty block update batches 2018-03-16 12:58:46 +00:00
Dylan K. Taylor
d542bbc736 Level: Fixed race condition between direct and batched block updating
This happened when a block was set into the world with a direct update, when an entry for that block was already present in the changedBlocks map. This fixes the bug by removing the entry from the changedBlocks map to avoid sending outdated block updates in batches.
2018-03-16 11:44:57 +00:00
Dylan K. Taylor
e88541b269 TeleportCommand: add /teleport alias 2018-03-16 10:49:57 +00:00
Dylan K. Taylor
fdad965db8 Player: if command has aliases, add command name as alias if not found
closes #2106

For some strange reason, using aliases overwrites the original command name instead of coexisting with it. This is rather astonishing behaviour, and probably a bug in the client. However, this workaround is the same thing vanilla does (see /tp in vanilla).
2018-03-16 10:41:00 +00:00
Dylan K. Taylor
dd844f7ad3 Position: call parent constructor 2018-03-15 10:29:21 +00:00
Dylan K. Taylor
596c8a7b4f Tile: Removed cyclic dependence on Chunks
Chunks were used by tiles for a couple of things:
- 1. for coordinates - which can be gotten using bitshifts
- 2. setChanged() - which is unnecessary as seen in the previous commit

Removing this circular dependency was actually remarkably easy to do.
2018-03-15 10:21:42 +00:00
Dylan K. Taylor
9c598d1345 Spawnable: don't mark chunk as changed onChanged()
this is unnecessary because a chunk is considered "changed" if it has tiles on it anyway.
2018-03-15 09:48:28 +00:00
Dylan K. Taylor
a2af838b1d Level: fixed autosave not kicking in when entities are updated in a chunk (e.g. moving, dying, spawning) 2018-03-15 09:46:04 +00:00
Dylan K. Taylor
bf97eab98f Block: remove redundant local variable from collidesWithBB() 2018-03-15 09:38:14 +00:00
Dylan K. Taylor
a9a55e9558 GlowingRedstoneOre: fixed infinite recursion and crash on block update
closes #2104

The inheritance of GlowingRedstoneOre from RedstoneOre maybe should be reconsidered. They only share properties in reality.
2018-03-15 09:24:48 +00:00
Dylan K. Taylor
95fb1d1602
AxisAlignedBB: added epsilon for floating-point comparison (#2101)
This fixes bugs where, for example, one cannot place a block below oneself at y=7.0.
2018-03-14 16:52:05 +00:00
Dylan K. Taylor
fa644edef3 Entity: removed redundant return values for move() 2018-03-14 13:39:23 +00:00
Dylan K. Taylor
ddc9dca8b4 Player: fixed being able to eat cake in creative
closes #2070
2018-03-13 18:32:08 +00:00
Dylan K. Taylor
86eee429bb Block: Split onUpdate() into several functions, removed Level::BLOCK_UPDATE_* constants
This allows the removal of lots of ugly code, and also exposes lots of similarities with how this update type was handled. This can be further improved in the future to more generically handle cases.

I realized in the process of changing this, that it might actually be simpler to treat to treat scheduled updates and neighbour updates as one and the same. They use the same mechanism for being saved on chunks (TileTicks),
and doing that would make updating only require one queue instead of two.

RedstoneOre: use onActivate() to trigger glowing
this is not technically correct behaviour, but this preserves the current behaviour.
2018-03-13 17:29:46 +00:00
Dylan K. Taylor
4f20a504e3 Level: remove dead function
this is handled by a queue now instead of ondemand, to avoid recursion bugs.
2018-03-13 11:46:23 +00:00
Dylan K. Taylor
6a1f8640f6 Cactus: fix bugs in local block updating 2018-03-13 11:40:45 +00:00
Dylan K. Taylor
8a0414f306 Server: Changed logic of isLevelGenerated() to prevent astonishing behaviour
Previously to this, a level would be considered "not generated" if no level providers registered as valid for that directory. This caused astonishing behaviour when the user's world has, for example, a mixture of .mca and .mcr region files - the world would instead get _re-generated_ according to the default level format, which might or might not load the existing regions depending on the format used for generation. This behaviour is utterly absurd.

This changes the behaviour of the generated check to check for a non-empty directory in the given path. Non-empty directories without recognized world files in them are now considered to have an unknown format.
2018-03-12 10:24:59 +00:00
Dylan K. Taylor
d478661961 Minor cleanup to LevelDB constructor 2018-03-11 18:15:20 +00:00
Dylan K. Taylor
b8064aa45c LevelDB: fixed more usages of CompoundTag ArrayAccess API 2018-03-11 17:55:35 +00:00
Dylan K. Taylor
00f596c4f8 Level: typehint hashing methods 2018-03-11 16:42:57 +00:00
Dylan K. Taylor
3f7b14bf59 Level: Remove dead generator leftovers
This is all handled by the population mechanism now. Nothing uses these things anymore since years.
2018-03-11 13:56:41 +00:00
Dylan K. Taylor
ba0a256834 SplashPotion: fix max stack size 2018-03-11 13:43:45 +00:00
Dylan K. Taylor
f2f8c235e7 Explosion: add exception throws for bad arguments 2018-03-11 13:06:29 +00:00