Commit Graph

30 Commits

Author SHA1 Message Date
aa9f8781ff Merge branch 'next-minor' into next-major 2022-06-07 19:56:26 +01:00
083a35f970 Modernize property type declarations 2022-06-04 18:16:32 +01:00
38d6284671 Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
179cac45f5 Merge branch 'stable' into next-minor 2022-05-22 16:21:05 +01:00
2ec65ba799 ExplosionPrimeEvent: require a positive explosion radius 2022-05-21 23:22:04 +01:00
3dd7c09351 Improve documentation of ExplosionPrimeEvent and EntityExplodeEvent 2022-05-21 23:00:34 +01:00
afc6e8878d EntityExplodeEvent: clamp yield in range 0-100 2022-05-21 22:44:45 +01:00
331b05c681 Improve documentation of EntitySpawnEvent and EntityDespawnEvent 2022-05-21 22:11:37 +01:00
3abe80184a Update ItemSpawnEvent doc (#5059) 2022-05-21 22:09:21 +01:00
7618b13c6e ItemDespawnEvent: improve documentation 2022-05-21 21:57:14 +01:00
c8a7a53d70 event: modernize property declarations where possible
only private fields are modified; protected ones can't be changed in case someone extended the classes
2022-04-25 00:06:26 +01:00
f97ce6afef Harden APIs which accept Vector3/Position/Location in event namespace 2022-03-09 22:22:37 +00:00
661848c5e7 fix more EOF newlines 2022-01-07 20:39:43 +00:00
5b868e6d5e Merge branch 'stable' into next-minor 2021-12-08 19:40:25 +00:00
3d9e19546f EntityShootBowEvent: fixed incorrect field type 2021-12-07 23:35:45 +00:00
8f2ca92f02 Implement dropped item merging (#4419)
- The following classes have been added:
  - `ItemMergeEvent`
  - `ItemEntityStackSizeChangeAnimation`
- The following API methods have been added:
  - `ItemEntity->isMergeable()`
  - `ItemEntity->tryMergeInto()`
  - `ItemEntity->setStackSize()`
2021-12-06 22:23:18 +00:00
e34364412b Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
710345d4b0 Implemented Farmland turns to dirt when jumped on. (#4434) 2021-09-06 12:55:52 +01:00
eb9188c309 Replace InventoryPickup*Event with EntityItemPickupEvent (#4384)
The rationale here is that inventories don't actually pick items up - their holders do.
It's especially misleading to say that an inventory is picking up an item in creative mode when the picked-up item can't actually be added to the target inventory in the first place.

This change allows a range of new functionality, such as:
- Allowing survival players to pick items up even when their inventories are full, similarly to creative players
- Changing the destination inventory of collected items (e.g. items could be redirected to the offhand or ender chest inventory, while still allowing other plugins to understand what's happening)

As an added bonus, this obsoletes one more use case for Inventory->getHolder(), bringing us one step closer to removing the cyclic reference nightmare from inventories.

The choice of naming (EntityItemPickup, instead of EntityPickupItem) is to be consistent with other events, where the word order is SubjectObjectActionEvent.
2021-08-20 22:59:35 +01:00
7b02cc3efd Implemented #3836: Replace setCancelled() in events with cancel() and uncancel()
The motivation for this is to prevent passing a dynamic argument to cancellation, which in almost all cases is a bug in user code. This same mistake also appears in a few places in the PM core (as seen in this commit), but in those cases the mistakes were mostly harmless since they were taking place before the event was actually called.
closes #3836
2020-09-26 14:31:56 +01:00
d840e8c4d4 Merge commit 'a34f3261c'
# Conflicts:
#	resources/vanilla
#	src/event/entity/EntityExplodeEvent.php
#	src/pocketmine/event/block/SignChangeEvent.php
#	src/utils/Utils.php
2020-07-04 22:39:40 +01:00
7e331c590d Use static-analysis-friendly method for getting effects from EffectManager
fixes 5 phpstan level 8 errors
2020-06-27 13:09:05 +01:00
1f90aa07aa Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/command/defaults/TeleportCommand.php
#	src/pocketmine/event/entity/EntityDespawnEvent.php
#	src/pocketmine/event/entity/EntityInventoryChangeEvent.php
#	src/pocketmine/event/entity/EntityLevelChangeEvent.php
#	src/pocketmine/event/entity/EntitySpawnEvent.php
#	tests/phpstan/configs/actual-problems.neon
2020-06-21 00:30:45 +01:00
b58c425189 Merge branch 'next-minor'
# Conflicts:
#	changelogs/3.12.md
#	resources/vanilla
#	src/VersionInfo.php
2020-06-03 13:11:30 +01:00
c72937a4af Merge commit '5dadf1237'
# Conflicts:
#	resources/vanilla
2020-06-03 12:46:06 +01:00
cd55cdf5c6 Merge commit '9cd6b3e1c7cd81d0a4b0da68d9b3ff026c9f6495' 2020-01-22 15:04:06 +00:00
1b33143f4f pass 2, manual removal of incorrect non-nullable phpdoc types 2020-01-22 12:06:47 +00:00
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
cda1143a79 Merge branch 'stable' 2020-01-09 17:17:42 +00:00
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00