├── .gitignore ├── .poggit.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── phpstan.neon.dist ├── src └── ColinHDev │ └── libAsyncEvent │ ├── AsyncEvent.php │ ├── CallbackHolderTrait.php │ ├── ConsecutiveEventHandlerExecutionTrait.php │ └── PrioritizedEventHandlerExecutionTrait.php └── virion.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor 3 | composer.phar -------------------------------------------------------------------------------- /.poggit.yml: -------------------------------------------------------------------------------- 1 | --- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/ColinHDev/libAsyncEvent 2 | build-by-default: true 3 | branches: 4 | - main 5 | projects: 6 | libAsyncEvent: 7 | path: "" 8 | model: virion 9 | type: library 10 | ... 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 2022 colin_mwjmjjb 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 2022 colin_mwjmjjb 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libAsyncEvent 2 | 3 | libAsyncEvent provides you with multiple implementations for creating asynchronous event execution for PocketMine-MP 4 | plugins. 5 | 6 | ## Why should I use this library? 7 | I came to the idea for this library while implementing [libasynql](https://github.com/poggit/libasynql) and 8 | [await-generator](https://github.com/SOF3/await-generator) to my plugin [CPlot](https://github.com/ColinHDev/CPlot). I 9 | then realised how annoying it is, to deal with [PocketMine-MP's](https://github.com/pmmp/PocketMine-MP) events in this 10 | case, since it is not possible e.g. to check if a player is allowed to build in a certain area with an asynchronous-run 11 | query. 12 | 13 | So when deciding to implement custom events into the plugin, I wanted to make it as developer-friendly as possible. So 14 | when someone decides to work with the events, they are not forced to directly decide, how to react (e.g. cancelling the 15 | event) and be allowed e.g. to run asynchronous queries to validate their decision. 16 | 17 | ## How to use this library in my plugin? 18 | ### How should my event class look like? 19 | Normally your event class looks like this: It extends PocketMine-MP's `Event` class or one of its subclasses and maybe 20 | also implements an interface like the `Cancellable` one. 21 | ```php 22 | use pocketmine\event\Event; 23 | use pocketmine\event\Cancellable; 24 | 25 | class MyEvent extends Event implements Cancellable {} 26 | ``` 27 | First, implement the `AsyncEvent` interface, which this library provides, to your event class. 28 | And second, use one of the `EventHandlerExecutionTrait`s in your event class: 29 | ```php 30 | use ColinHDev\libAsyncEvent\AsyncEvent; 31 | use ColinHDev\libAsyncEvent\SomeEventHandlerExecutionTrait; 32 | use pocketmine\event\Event; 33 | use pocketmine\event\Cancellable; 34 | 35 | class MyEvent extends Event implements AsyncEvent, Cancellable { 36 | use SomeEventHandlerExecutionTrait; 37 | } 38 | ``` 39 | There are multiple `EventHandlerExecutionTrait`s, which you can use and each of them has a different behaviour: 40 | - `ConsecutiveEventHandlerExecutionTrait`: This trait will execute all event listeners one after another. If one 41 | `block()`s the execution, the next listener will only be executed after the current one calls `release()`. 42 | - `PriorityEventHandlerExecutionTrait`: This trait will execute all event listeners of the same priority at the same 43 | time. If one or more listeners `block()` the execution, the listeners of the higher priority will only be executed after 44 | all of the `block()`ing ones called `release()`. 45 | 46 | ### How can I call my event? 47 | You can simply call your event by creating a new event instance and using its `call()` method. 48 | ```php 49 | $event = new MyEvent(); 50 | $event->call(); 51 | ``` 52 | But to get the result of the event, you need to provide a callback function which will be run when all listeners are finished. 53 | ```php 54 | $event = new MyEvent(); 55 | $event->setCallback( 56 | function (MyEvent $event) : void { 57 | if ($event->isCancelled()) { 58 | // do something 59 | } else { 60 | // do something else 61 | } 62 | } 63 | ); 64 | $event->call(); 65 | ``` 66 | 67 | ### How to improve my event class? 68 | Unless both you and the person trying to register a listener for your async event use composer, they will not be able to 69 | correctly see libAsyncEvent's declared methods like `block()` or `release()` in their IDE. 70 | 71 | Although ideally composer should be used to develop plugins and to declare their dependencies, we can not force anyone 72 | to do so. So to make it easier for them, you can add following PHPDoc comments to your event class: 73 | ```php 74 | /** 75 | * @link https://github.com/ColinHDev/libAsyncEvent/ 76 | * @method void block() 77 | * @method void release() 78 | */ 79 | class MyEvent extends Event implements AsyncEvent, Cancellable {} 80 | ``` 81 | This way, the IDE will know that these methods exist and will not show any errors. 82 | 83 | ## How to handle an event made with this library? 84 | To register an event listener for an async event, you can do it the same way, you would normally do it for every other event listener: 85 | ```php 86 | Server::getInstance()->getPluginManager()->registerEvents(new MyListener(), $this); 87 | ``` 88 | In this class, you as well create a method which accepts the event, you want to listen to, as a parameter: 89 | ```php 90 | public function onMyEvent(MyEvent $event) : void { 91 | // do something 92 | } 93 | ``` 94 | So basically there is no difference between a normal event listener and our async event listener. 95 | But if you want to keep the event instance from continuing with its execution, you need to call the `block()` method. 96 | This way the event won't finish its execution until you call the `release()` method. 97 | ```php 98 | public function onMyEvent(MyEvent $event) : void { 99 | // some synchronous logic here 100 | $event->block(); 101 | // some asynchronous logic here 102 | $event->release(); 103 | } 104 | ``` 105 | If you accidentally forget to call the `release()` method, an exception will be thrown once the event instance is 106 | destroyed by the garbage collector. 107 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "colinhdev/libasyncevent", 3 | "description": "Simple implementation for creating asynchronous event execution for PocketMine-MP plugins.", 4 | "type": "library", 5 | "license": "GPL-3.0-or-later", 6 | "require": { 7 | "php": "^8.1", 8 | "pocketmine/pocketmine-mp": "^5.5.0" 9 | }, 10 | "require-dev": { 11 | "phpstan/phpstan": "^1.10.0", 12 | "phpstan/phpstan-strict-rules": "^1.5.0", 13 | "phpstan/extension-installer": "^1.3.0" 14 | }, 15 | "autoload": { 16 | "classmap": ["src"] 17 | }, 18 | "extra": { 19 | "virion": { 20 | "spec": "3.0", 21 | "namespace-root": "ColinHDev\\libAsyncEvent" 22 | } 23 | }, 24 | "config": { 25 | "allow-plugins": { 26 | "phpstan/extension-installer": true 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "21a86b2306d3358cd8da40587081264e", 8 | "packages": [ 9 | { 10 | "name": "adhocore/json-comment", 11 | "version": "1.2.1", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/adhocore/php-json-comment.git", 15 | "reference": "651023f9fe52e9efa2198cbaf6e481d1968e2377" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/adhocore/php-json-comment/zipball/651023f9fe52e9efa2198cbaf6e481d1968e2377", 20 | "reference": "651023f9fe52e9efa2198cbaf6e481d1968e2377", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "ext-ctype": "*", 25 | "php": ">=7.0" 26 | }, 27 | "require-dev": { 28 | "phpunit/phpunit": "^6.5 || ^7.5 || ^8.5" 29 | }, 30 | "type": "library", 31 | "autoload": { 32 | "psr-4": { 33 | "Ahc\\Json\\": "src/" 34 | } 35 | }, 36 | "notification-url": "https://packagist.org/downloads/", 37 | "license": [ 38 | "MIT" 39 | ], 40 | "authors": [ 41 | { 42 | "name": "Jitendra Adhikari", 43 | "email": "jiten.adhikary@gmail.com" 44 | } 45 | ], 46 | "description": "Lightweight JSON comment stripper library for PHP", 47 | "keywords": [ 48 | "comment", 49 | "json", 50 | "strip-comment" 51 | ], 52 | "support": { 53 | "issues": "https://github.com/adhocore/php-json-comment/issues", 54 | "source": "https://github.com/adhocore/php-json-comment/tree/1.2.1" 55 | }, 56 | "funding": [ 57 | { 58 | "url": "https://paypal.me/ji10", 59 | "type": "custom" 60 | }, 61 | { 62 | "url": "https://github.com/adhocore", 63 | "type": "github" 64 | } 65 | ], 66 | "time": "2022-10-02T11:22:07+00:00" 67 | }, 68 | { 69 | "name": "brick/math", 70 | "version": "0.12.1", 71 | "source": { 72 | "type": "git", 73 | "url": "https://github.com/brick/math.git", 74 | "reference": "f510c0a40911935b77b86859eb5223d58d660df1" 75 | }, 76 | "dist": { 77 | "type": "zip", 78 | "url": "https://api.github.com/repos/brick/math/zipball/f510c0a40911935b77b86859eb5223d58d660df1", 79 | "reference": "f510c0a40911935b77b86859eb5223d58d660df1", 80 | "shasum": "" 81 | }, 82 | "require": { 83 | "php": "^8.1" 84 | }, 85 | "require-dev": { 86 | "php-coveralls/php-coveralls": "^2.2", 87 | "phpunit/phpunit": "^10.1", 88 | "vimeo/psalm": "5.16.0" 89 | }, 90 | "type": "library", 91 | "autoload": { 92 | "psr-4": { 93 | "Brick\\Math\\": "src/" 94 | } 95 | }, 96 | "notification-url": "https://packagist.org/downloads/", 97 | "license": [ 98 | "MIT" 99 | ], 100 | "description": "Arbitrary-precision arithmetic library", 101 | "keywords": [ 102 | "Arbitrary-precision", 103 | "BigInteger", 104 | "BigRational", 105 | "arithmetic", 106 | "bigdecimal", 107 | "bignum", 108 | "bignumber", 109 | "brick", 110 | "decimal", 111 | "integer", 112 | "math", 113 | "mathematics", 114 | "rational" 115 | ], 116 | "support": { 117 | "issues": "https://github.com/brick/math/issues", 118 | "source": "https://github.com/brick/math/tree/0.12.1" 119 | }, 120 | "funding": [ 121 | { 122 | "url": "https://github.com/BenMorel", 123 | "type": "github" 124 | } 125 | ], 126 | "time": "2023-11-29T23:19:16+00:00" 127 | }, 128 | { 129 | "name": "pocketmine/bedrock-block-upgrade-schema", 130 | "version": "4.3.0", 131 | "source": { 132 | "type": "git", 133 | "url": "https://github.com/pmmp/BedrockBlockUpgradeSchema.git", 134 | "reference": "53d3a41c37ce90d58b33130cdadad08e442d7c47" 135 | }, 136 | "dist": { 137 | "type": "zip", 138 | "url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/53d3a41c37ce90d58b33130cdadad08e442d7c47", 139 | "reference": "53d3a41c37ce90d58b33130cdadad08e442d7c47", 140 | "shasum": "" 141 | }, 142 | "type": "library", 143 | "notification-url": "https://packagist.org/downloads/", 144 | "license": [ 145 | "CC0-1.0" 146 | ], 147 | "description": "Schemas describing how to upgrade saved block data in older Minecraft: Bedrock Edition world saves", 148 | "support": { 149 | "issues": "https://github.com/pmmp/BedrockBlockUpgradeSchema/issues", 150 | "source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/4.3.0" 151 | }, 152 | "time": "2024-08-13T18:04:27+00:00" 153 | }, 154 | { 155 | "name": "pocketmine/bedrock-data", 156 | "version": "2.12.0+bedrock-1.21.20", 157 | "source": { 158 | "type": "git", 159 | "url": "https://github.com/pmmp/BedrockData.git", 160 | "reference": "d4ee3d08964fa16fbbdd04af1fb52bbde540b665" 161 | }, 162 | "dist": { 163 | "type": "zip", 164 | "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/d4ee3d08964fa16fbbdd04af1fb52bbde540b665", 165 | "reference": "d4ee3d08964fa16fbbdd04af1fb52bbde540b665", 166 | "shasum": "" 167 | }, 168 | "type": "library", 169 | "notification-url": "https://packagist.org/downloads/", 170 | "license": [ 171 | "CC0-1.0" 172 | ], 173 | "description": "Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP", 174 | "support": { 175 | "issues": "https://github.com/pmmp/BedrockData/issues", 176 | "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.21.20" 177 | }, 178 | "time": "2024-08-15T12:50:26+00:00" 179 | }, 180 | { 181 | "name": "pocketmine/bedrock-item-upgrade-schema", 182 | "version": "1.11.0", 183 | "source": { 184 | "type": "git", 185 | "url": "https://github.com/pmmp/BedrockItemUpgradeSchema.git", 186 | "reference": "35c18d093fc2b12da8737b2edb2c3ad6a14a53dd" 187 | }, 188 | "dist": { 189 | "type": "zip", 190 | "url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/35c18d093fc2b12da8737b2edb2c3ad6a14a53dd", 191 | "reference": "35c18d093fc2b12da8737b2edb2c3ad6a14a53dd", 192 | "shasum": "" 193 | }, 194 | "type": "library", 195 | "notification-url": "https://packagist.org/downloads/", 196 | "license": [ 197 | "CC0-1.0" 198 | ], 199 | "description": "JSON schemas for upgrading items found in older Minecraft: Bedrock world saves", 200 | "support": { 201 | "issues": "https://github.com/pmmp/BedrockItemUpgradeSchema/issues", 202 | "source": "https://github.com/pmmp/BedrockItemUpgradeSchema/tree/1.11.0" 203 | }, 204 | "time": "2024-08-13T18:06:25+00:00" 205 | }, 206 | { 207 | "name": "pocketmine/bedrock-protocol", 208 | "version": "33.0.0+bedrock-1.21.20", 209 | "source": { 210 | "type": "git", 211 | "url": "https://github.com/pmmp/BedrockProtocol.git", 212 | "reference": "e2264137c5cd0522de2c6ee4921a3a803818ea32" 213 | }, 214 | "dist": { 215 | "type": "zip", 216 | "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/e2264137c5cd0522de2c6ee4921a3a803818ea32", 217 | "reference": "e2264137c5cd0522de2c6ee4921a3a803818ea32", 218 | "shasum": "" 219 | }, 220 | "require": { 221 | "ext-json": "*", 222 | "php": "^8.1", 223 | "pocketmine/binaryutils": "^0.2.0", 224 | "pocketmine/color": "^0.2.0 || ^0.3.0", 225 | "pocketmine/math": "^0.3.0 || ^0.4.0 || ^1.0.0", 226 | "pocketmine/nbt": "^1.0.0", 227 | "ramsey/uuid": "^4.1" 228 | }, 229 | "require-dev": { 230 | "phpstan/phpstan": "1.11.9", 231 | "phpstan/phpstan-phpunit": "^1.0.0", 232 | "phpstan/phpstan-strict-rules": "^1.0.0", 233 | "phpunit/phpunit": "^9.5 || ^10.0" 234 | }, 235 | "type": "library", 236 | "autoload": { 237 | "psr-4": { 238 | "pocketmine\\network\\mcpe\\protocol\\": "src/" 239 | } 240 | }, 241 | "notification-url": "https://packagist.org/downloads/", 242 | "license": [ 243 | "LGPL-3.0" 244 | ], 245 | "description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP", 246 | "support": { 247 | "issues": "https://github.com/pmmp/BedrockProtocol/issues", 248 | "source": "https://github.com/pmmp/BedrockProtocol/tree/33.0.0+bedrock-1.21.20" 249 | }, 250 | "time": "2024-08-15T23:07:53+00:00" 251 | }, 252 | { 253 | "name": "pocketmine/binaryutils", 254 | "version": "0.2.6", 255 | "source": { 256 | "type": "git", 257 | "url": "https://github.com/pmmp/BinaryUtils.git", 258 | "reference": "ccfc1899b859d45814ea3592e20ebec4cb731c84" 259 | }, 260 | "dist": { 261 | "type": "zip", 262 | "url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/ccfc1899b859d45814ea3592e20ebec4cb731c84", 263 | "reference": "ccfc1899b859d45814ea3592e20ebec4cb731c84", 264 | "shasum": "" 265 | }, 266 | "require": { 267 | "php": "^7.4 || ^8.0", 268 | "php-64bit": "*" 269 | }, 270 | "require-dev": { 271 | "phpstan/extension-installer": "^1.0", 272 | "phpstan/phpstan": "~1.10.3", 273 | "phpstan/phpstan-phpunit": "^1.0", 274 | "phpstan/phpstan-strict-rules": "^1.0.0", 275 | "phpunit/phpunit": "^9.5 || ^10.0 || ^11.0" 276 | }, 277 | "type": "library", 278 | "autoload": { 279 | "psr-4": { 280 | "pocketmine\\utils\\": "src/" 281 | } 282 | }, 283 | "notification-url": "https://packagist.org/downloads/", 284 | "license": [ 285 | "LGPL-3.0" 286 | ], 287 | "description": "Classes and methods for conveniently handling binary data", 288 | "support": { 289 | "issues": "https://github.com/pmmp/BinaryUtils/issues", 290 | "source": "https://github.com/pmmp/BinaryUtils/tree/0.2.6" 291 | }, 292 | "time": "2024-03-04T15:04:17+00:00" 293 | }, 294 | { 295 | "name": "pocketmine/callback-validator", 296 | "version": "1.0.3", 297 | "source": { 298 | "type": "git", 299 | "url": "https://github.com/pmmp/CallbackValidator.git", 300 | "reference": "64787469766bcaa7e5885242e85c23c25e8c55a2" 301 | }, 302 | "dist": { 303 | "type": "zip", 304 | "url": "https://api.github.com/repos/pmmp/CallbackValidator/zipball/64787469766bcaa7e5885242e85c23c25e8c55a2", 305 | "reference": "64787469766bcaa7e5885242e85c23c25e8c55a2", 306 | "shasum": "" 307 | }, 308 | "require": { 309 | "ext-reflection": "*", 310 | "php": "^7.1 || ^8.0" 311 | }, 312 | "replace": { 313 | "daverandom/callback-validator": "*" 314 | }, 315 | "require-dev": { 316 | "phpstan/extension-installer": "^1.0", 317 | "phpstan/phpstan": "0.12.59", 318 | "phpstan/phpstan-strict-rules": "^0.12.4", 319 | "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" 320 | }, 321 | "type": "library", 322 | "autoload": { 323 | "psr-4": { 324 | "DaveRandom\\CallbackValidator\\": "src/" 325 | } 326 | }, 327 | "notification-url": "https://packagist.org/downloads/", 328 | "license": [ 329 | "MIT" 330 | ], 331 | "authors": [ 332 | { 333 | "name": "Chris Wright", 334 | "email": "cw@daverandom.com" 335 | } 336 | ], 337 | "description": "Fork of daverandom/callback-validator - Tools for validating callback signatures", 338 | "support": { 339 | "issues": "https://github.com/pmmp/CallbackValidator/issues", 340 | "source": "https://github.com/pmmp/CallbackValidator/tree/1.0.3" 341 | }, 342 | "time": "2020-12-11T01:45:37+00:00" 343 | }, 344 | { 345 | "name": "pocketmine/color", 346 | "version": "0.3.1", 347 | "source": { 348 | "type": "git", 349 | "url": "https://github.com/pmmp/Color.git", 350 | "reference": "a0421f1e9e0b0c619300fb92d593283378f6a5e1" 351 | }, 352 | "dist": { 353 | "type": "zip", 354 | "url": "https://api.github.com/repos/pmmp/Color/zipball/a0421f1e9e0b0c619300fb92d593283378f6a5e1", 355 | "reference": "a0421f1e9e0b0c619300fb92d593283378f6a5e1", 356 | "shasum": "" 357 | }, 358 | "require": { 359 | "php": "^8.0" 360 | }, 361 | "require-dev": { 362 | "phpstan/phpstan": "1.10.3", 363 | "phpstan/phpstan-strict-rules": "^1.2.0" 364 | }, 365 | "type": "library", 366 | "autoload": { 367 | "psr-4": { 368 | "pocketmine\\color\\": "src/" 369 | } 370 | }, 371 | "notification-url": "https://packagist.org/downloads/", 372 | "license": [ 373 | "LGPL-3.0" 374 | ], 375 | "description": "Color handling library used by PocketMine-MP and related projects", 376 | "support": { 377 | "issues": "https://github.com/pmmp/Color/issues", 378 | "source": "https://github.com/pmmp/Color/tree/0.3.1" 379 | }, 380 | "time": "2023-04-10T11:38:05+00:00" 381 | }, 382 | { 383 | "name": "pocketmine/errorhandler", 384 | "version": "0.7.0", 385 | "source": { 386 | "type": "git", 387 | "url": "https://github.com/pmmp/ErrorHandler.git", 388 | "reference": "cae94884368a74ece5294b9ff7fef18732dcd921" 389 | }, 390 | "dist": { 391 | "type": "zip", 392 | "url": "https://api.github.com/repos/pmmp/ErrorHandler/zipball/cae94884368a74ece5294b9ff7fef18732dcd921", 393 | "reference": "cae94884368a74ece5294b9ff7fef18732dcd921", 394 | "shasum": "" 395 | }, 396 | "require": { 397 | "php": "^8.0" 398 | }, 399 | "require-dev": { 400 | "phpstan/phpstan": "~1.10.3", 401 | "phpstan/phpstan-strict-rules": "^1.0", 402 | "phpunit/phpunit": "^9.5 || ^10.0 || ^11.0" 403 | }, 404 | "type": "library", 405 | "autoload": { 406 | "psr-4": { 407 | "pocketmine\\errorhandler\\": "src/" 408 | } 409 | }, 410 | "notification-url": "https://packagist.org/downloads/", 411 | "license": [ 412 | "LGPL-3.0" 413 | ], 414 | "description": "Utilities to handle nasty PHP E_* errors in a usable way", 415 | "support": { 416 | "issues": "https://github.com/pmmp/ErrorHandler/issues", 417 | "source": "https://github.com/pmmp/ErrorHandler/tree/0.7.0" 418 | }, 419 | "time": "2024-04-02T18:29:54+00:00" 420 | }, 421 | { 422 | "name": "pocketmine/locale-data", 423 | "version": "2.19.6", 424 | "source": { 425 | "type": "git", 426 | "url": "https://github.com/pmmp/Language.git", 427 | "reference": "93e473e20e7f4515ecf45c5ef0f9155b9247a86e" 428 | }, 429 | "dist": { 430 | "type": "zip", 431 | "url": "https://api.github.com/repos/pmmp/Language/zipball/93e473e20e7f4515ecf45c5ef0f9155b9247a86e", 432 | "reference": "93e473e20e7f4515ecf45c5ef0f9155b9247a86e", 433 | "shasum": "" 434 | }, 435 | "type": "library", 436 | "notification-url": "https://packagist.org/downloads/", 437 | "description": "Language resources used by PocketMine-MP", 438 | "support": { 439 | "issues": "https://github.com/pmmp/Language/issues", 440 | "source": "https://github.com/pmmp/Language/tree/2.19.6" 441 | }, 442 | "time": "2023-08-08T16:53:23+00:00" 443 | }, 444 | { 445 | "name": "pocketmine/log", 446 | "version": "0.4.0", 447 | "source": { 448 | "type": "git", 449 | "url": "https://github.com/pmmp/Log.git", 450 | "reference": "e6c912c0f9055c81d23108ec2d179b96f404c043" 451 | }, 452 | "dist": { 453 | "type": "zip", 454 | "url": "https://api.github.com/repos/pmmp/Log/zipball/e6c912c0f9055c81d23108ec2d179b96f404c043", 455 | "reference": "e6c912c0f9055c81d23108ec2d179b96f404c043", 456 | "shasum": "" 457 | }, 458 | "require": { 459 | "php": "^7.4 || ^8.0" 460 | }, 461 | "conflict": { 462 | "pocketmine/spl": "<0.4" 463 | }, 464 | "require-dev": { 465 | "phpstan/phpstan": "0.12.88", 466 | "phpstan/phpstan-strict-rules": "^0.12.2" 467 | }, 468 | "type": "library", 469 | "autoload": { 470 | "classmap": [ 471 | "./src" 472 | ] 473 | }, 474 | "notification-url": "https://packagist.org/downloads/", 475 | "license": [ 476 | "LGPL-3.0" 477 | ], 478 | "description": "Logging components used by PocketMine-MP and related projects", 479 | "support": { 480 | "issues": "https://github.com/pmmp/Log/issues", 481 | "source": "https://github.com/pmmp/Log/tree/0.4.0" 482 | }, 483 | "time": "2021-06-18T19:08:09+00:00" 484 | }, 485 | { 486 | "name": "pocketmine/math", 487 | "version": "1.0.0", 488 | "source": { 489 | "type": "git", 490 | "url": "https://github.com/pmmp/Math.git", 491 | "reference": "dc132d93595b32e9f210d78b3c8d43c662a5edbf" 492 | }, 493 | "dist": { 494 | "type": "zip", 495 | "url": "https://api.github.com/repos/pmmp/Math/zipball/dc132d93595b32e9f210d78b3c8d43c662a5edbf", 496 | "reference": "dc132d93595b32e9f210d78b3c8d43c662a5edbf", 497 | "shasum": "" 498 | }, 499 | "require": { 500 | "php": "^8.0", 501 | "php-64bit": "*" 502 | }, 503 | "require-dev": { 504 | "phpstan/extension-installer": "^1.0", 505 | "phpstan/phpstan": "~1.10.3", 506 | "phpstan/phpstan-strict-rules": "^1.0", 507 | "phpunit/phpunit": "^8.5 || ^9.5" 508 | }, 509 | "type": "library", 510 | "autoload": { 511 | "psr-4": { 512 | "pocketmine\\math\\": "src/" 513 | } 514 | }, 515 | "notification-url": "https://packagist.org/downloads/", 516 | "license": [ 517 | "LGPL-3.0" 518 | ], 519 | "description": "PHP library containing math related code used in PocketMine-MP", 520 | "support": { 521 | "issues": "https://github.com/pmmp/Math/issues", 522 | "source": "https://github.com/pmmp/Math/tree/1.0.0" 523 | }, 524 | "time": "2023-08-03T12:56:33+00:00" 525 | }, 526 | { 527 | "name": "pocketmine/nbt", 528 | "version": "1.0.0", 529 | "source": { 530 | "type": "git", 531 | "url": "https://github.com/pmmp/NBT.git", 532 | "reference": "20540271cb59e04672cb163dca73366f207974f1" 533 | }, 534 | "dist": { 535 | "type": "zip", 536 | "url": "https://api.github.com/repos/pmmp/NBT/zipball/20540271cb59e04672cb163dca73366f207974f1", 537 | "reference": "20540271cb59e04672cb163dca73366f207974f1", 538 | "shasum": "" 539 | }, 540 | "require": { 541 | "php": "^7.4 || ^8.0", 542 | "php-64bit": "*", 543 | "pocketmine/binaryutils": "^0.2.0" 544 | }, 545 | "require-dev": { 546 | "phpstan/extension-installer": "^1.0", 547 | "phpstan/phpstan": "1.10.25", 548 | "phpstan/phpstan-strict-rules": "^1.0", 549 | "phpunit/phpunit": "^9.5" 550 | }, 551 | "type": "library", 552 | "autoload": { 553 | "psr-4": { 554 | "pocketmine\\nbt\\": "src/" 555 | } 556 | }, 557 | "notification-url": "https://packagist.org/downloads/", 558 | "license": [ 559 | "LGPL-3.0" 560 | ], 561 | "description": "PHP library for working with Named Binary Tags", 562 | "support": { 563 | "issues": "https://github.com/pmmp/NBT/issues", 564 | "source": "https://github.com/pmmp/NBT/tree/1.0.0" 565 | }, 566 | "time": "2023-07-14T13:01:49+00:00" 567 | }, 568 | { 569 | "name": "pocketmine/netresearch-jsonmapper", 570 | "version": "v4.4.999", 571 | "source": { 572 | "type": "git", 573 | "url": "https://github.com/pmmp/netresearch-jsonmapper.git", 574 | "reference": "9a6610033d56e358e86a3e4fd5f87063c7318833" 575 | }, 576 | "dist": { 577 | "type": "zip", 578 | "url": "https://api.github.com/repos/pmmp/netresearch-jsonmapper/zipball/9a6610033d56e358e86a3e4fd5f87063c7318833", 579 | "reference": "9a6610033d56e358e86a3e4fd5f87063c7318833", 580 | "shasum": "" 581 | }, 582 | "require": { 583 | "ext-json": "*", 584 | "ext-pcre": "*", 585 | "ext-reflection": "*", 586 | "ext-spl": "*", 587 | "php": ">=7.1" 588 | }, 589 | "replace": { 590 | "netresearch/jsonmapper": "~4.2.0" 591 | }, 592 | "require-dev": { 593 | "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0 || ~10.0", 594 | "squizlabs/php_codesniffer": "~3.5" 595 | }, 596 | "type": "library", 597 | "autoload": { 598 | "psr-0": { 599 | "JsonMapper": "src/" 600 | } 601 | }, 602 | "notification-url": "https://packagist.org/downloads/", 603 | "license": [ 604 | "OSL-3.0" 605 | ], 606 | "authors": [ 607 | { 608 | "name": "Christian Weiske", 609 | "email": "cweiske@cweiske.de", 610 | "homepage": "http://github.com/cweiske/jsonmapper/", 611 | "role": "Developer" 612 | } 613 | ], 614 | "description": "Fork of netresearch/jsonmapper with security fixes needed by pocketmine/pocketmine-mp", 615 | "support": { 616 | "email": "cweiske@cweiske.de", 617 | "issues": "https://github.com/cweiske/jsonmapper/issues", 618 | "source": "https://github.com/pmmp/netresearch-jsonmapper/tree/v4.4.999" 619 | }, 620 | "time": "2024-02-23T13:17:01+00:00" 621 | }, 622 | { 623 | "name": "pocketmine/pocketmine-mp", 624 | "version": "5.18.0", 625 | "source": { 626 | "type": "git", 627 | "url": "https://github.com/pmmp/PocketMine-MP.git", 628 | "reference": "9176b2494a4a84729f9cc4dd1f75dd3ec2c8618d" 629 | }, 630 | "dist": { 631 | "type": "zip", 632 | "url": "https://api.github.com/repos/pmmp/PocketMine-MP/zipball/9176b2494a4a84729f9cc4dd1f75dd3ec2c8618d", 633 | "reference": "9176b2494a4a84729f9cc4dd1f75dd3ec2c8618d", 634 | "shasum": "" 635 | }, 636 | "require": { 637 | "adhocore/json-comment": "~1.2.0", 638 | "composer-runtime-api": "^2.0", 639 | "ext-chunkutils2": "^0.3.1", 640 | "ext-crypto": "^0.3.1", 641 | "ext-ctype": "*", 642 | "ext-curl": "*", 643 | "ext-date": "*", 644 | "ext-gmp": "*", 645 | "ext-hash": "*", 646 | "ext-igbinary": "^3.0.1", 647 | "ext-json": "*", 648 | "ext-leveldb": "^0.2.1 || ^0.3.0", 649 | "ext-mbstring": "*", 650 | "ext-morton": "^0.1.0", 651 | "ext-openssl": "*", 652 | "ext-pcre": "*", 653 | "ext-phar": "*", 654 | "ext-pmmpthread": "^6.1.0", 655 | "ext-reflection": "*", 656 | "ext-simplexml": "*", 657 | "ext-sockets": "*", 658 | "ext-spl": "*", 659 | "ext-yaml": ">=2.0.0", 660 | "ext-zip": "*", 661 | "ext-zlib": ">=1.2.11", 662 | "php": "^8.1", 663 | "php-64bit": "*", 664 | "pocketmine/bedrock-block-upgrade-schema": "~4.3.0+bedrock-1.21.20", 665 | "pocketmine/bedrock-data": "~2.12.0+bedrock-1.21.20", 666 | "pocketmine/bedrock-item-upgrade-schema": "~1.11.0+bedrock-1.21.20", 667 | "pocketmine/bedrock-protocol": "~33.0.0+bedrock-1.21.20", 668 | "pocketmine/binaryutils": "^0.2.1", 669 | "pocketmine/callback-validator": "^1.0.2", 670 | "pocketmine/color": "^0.3.0", 671 | "pocketmine/errorhandler": "^0.7.0", 672 | "pocketmine/locale-data": "~2.19.0", 673 | "pocketmine/log": "^0.4.0", 674 | "pocketmine/math": "~1.0.0", 675 | "pocketmine/nbt": "~1.0.0", 676 | "pocketmine/netresearch-jsonmapper": "~v4.4.999", 677 | "pocketmine/raklib": "~1.1.0", 678 | "pocketmine/raklib-ipc": "~1.0.0", 679 | "pocketmine/snooze": "^0.5.0", 680 | "ramsey/uuid": "~4.7.0", 681 | "symfony/filesystem": "~6.4.0" 682 | }, 683 | "require-dev": { 684 | "phpstan/phpstan": "1.11.10", 685 | "phpstan/phpstan-phpunit": "^1.1.0", 686 | "phpstan/phpstan-strict-rules": "^1.2.0", 687 | "phpunit/phpunit": "^10.5.24" 688 | }, 689 | "type": "project", 690 | "autoload": { 691 | "files": [ 692 | "src/CoreConstants.php" 693 | ], 694 | "psr-4": { 695 | "pocketmine\\": "src/" 696 | } 697 | }, 698 | "notification-url": "https://packagist.org/downloads/", 699 | "license": [ 700 | "LGPL-3.0" 701 | ], 702 | "description": "A server software for Minecraft: Bedrock Edition written in PHP", 703 | "homepage": "https://pmmp.io", 704 | "support": { 705 | "issues": "https://github.com/pmmp/PocketMine-MP/issues", 706 | "source": "https://github.com/pmmp/PocketMine-MP/tree/5.18.0" 707 | }, 708 | "funding": [ 709 | { 710 | "url": "https://github.com/pmmp/PocketMine-MP#donate", 711 | "type": "custom" 712 | }, 713 | { 714 | "url": "https://www.patreon.com/pocketminemp", 715 | "type": "patreon" 716 | } 717 | ], 718 | "time": "2024-08-16T12:54:59+00:00" 719 | }, 720 | { 721 | "name": "pocketmine/raklib", 722 | "version": "1.1.1", 723 | "source": { 724 | "type": "git", 725 | "url": "https://github.com/pmmp/RakLib.git", 726 | "reference": "be2783be516bf6e2872ff5c81fb9048596617b97" 727 | }, 728 | "dist": { 729 | "type": "zip", 730 | "url": "https://api.github.com/repos/pmmp/RakLib/zipball/be2783be516bf6e2872ff5c81fb9048596617b97", 731 | "reference": "be2783be516bf6e2872ff5c81fb9048596617b97", 732 | "shasum": "" 733 | }, 734 | "require": { 735 | "ext-sockets": "*", 736 | "php": "^8.1", 737 | "php-64bit": "*", 738 | "php-ipv6": "*", 739 | "pocketmine/binaryutils": "^0.2.0", 740 | "pocketmine/log": "^0.3.0 || ^0.4.0" 741 | }, 742 | "require-dev": { 743 | "phpstan/phpstan": "1.10.1", 744 | "phpstan/phpstan-strict-rules": "^1.0" 745 | }, 746 | "type": "library", 747 | "autoload": { 748 | "psr-4": { 749 | "raklib\\": "src/" 750 | } 751 | }, 752 | "notification-url": "https://packagist.org/downloads/", 753 | "license": [ 754 | "GPL-3.0" 755 | ], 756 | "description": "A RakNet server implementation written in PHP", 757 | "support": { 758 | "issues": "https://github.com/pmmp/RakLib/issues", 759 | "source": "https://github.com/pmmp/RakLib/tree/1.1.1" 760 | }, 761 | "time": "2024-03-04T14:02:14+00:00" 762 | }, 763 | { 764 | "name": "pocketmine/raklib-ipc", 765 | "version": "1.0.1", 766 | "source": { 767 | "type": "git", 768 | "url": "https://github.com/pmmp/RakLibIpc.git", 769 | "reference": "ce632ef2c6743e71eddb5dc329c49af6555f90bc" 770 | }, 771 | "dist": { 772 | "type": "zip", 773 | "url": "https://api.github.com/repos/pmmp/RakLibIpc/zipball/ce632ef2c6743e71eddb5dc329c49af6555f90bc", 774 | "reference": "ce632ef2c6743e71eddb5dc329c49af6555f90bc", 775 | "shasum": "" 776 | }, 777 | "require": { 778 | "php": "^8.0", 779 | "php-64bit": "*", 780 | "pocketmine/binaryutils": "^0.2.0", 781 | "pocketmine/raklib": "^0.15.0 || ^1.0.0" 782 | }, 783 | "require-dev": { 784 | "phpstan/phpstan": "1.10.1", 785 | "phpstan/phpstan-strict-rules": "^1.0.0" 786 | }, 787 | "type": "library", 788 | "autoload": { 789 | "psr-4": { 790 | "raklib\\server\\ipc\\": "src/" 791 | } 792 | }, 793 | "notification-url": "https://packagist.org/downloads/", 794 | "license": [ 795 | "GPL-3.0" 796 | ], 797 | "description": "Channel-based protocols for inter-thread/inter-process communication with RakLib", 798 | "support": { 799 | "issues": "https://github.com/pmmp/RakLibIpc/issues", 800 | "source": "https://github.com/pmmp/RakLibIpc/tree/1.0.1" 801 | }, 802 | "time": "2024-03-01T15:55:05+00:00" 803 | }, 804 | { 805 | "name": "pocketmine/snooze", 806 | "version": "0.5.0", 807 | "source": { 808 | "type": "git", 809 | "url": "https://github.com/pmmp/Snooze.git", 810 | "reference": "a86d9ee60ce44755d166d3c7ba4b8b8be8360915" 811 | }, 812 | "dist": { 813 | "type": "zip", 814 | "url": "https://api.github.com/repos/pmmp/Snooze/zipball/a86d9ee60ce44755d166d3c7ba4b8b8be8360915", 815 | "reference": "a86d9ee60ce44755d166d3c7ba4b8b8be8360915", 816 | "shasum": "" 817 | }, 818 | "require": { 819 | "ext-pmmpthread": "^6.0", 820 | "php-64bit": "^8.1" 821 | }, 822 | "require-dev": { 823 | "phpstan/extension-installer": "^1.0", 824 | "phpstan/phpstan": "1.10.3", 825 | "phpstan/phpstan-strict-rules": "^1.0" 826 | }, 827 | "type": "library", 828 | "autoload": { 829 | "psr-4": { 830 | "pocketmine\\snooze\\": "src/" 831 | } 832 | }, 833 | "notification-url": "https://packagist.org/downloads/", 834 | "license": [ 835 | "LGPL-3.0" 836 | ], 837 | "description": "Thread notification management library for code using the pthreads extension", 838 | "support": { 839 | "issues": "https://github.com/pmmp/Snooze/issues", 840 | "source": "https://github.com/pmmp/Snooze/tree/0.5.0" 841 | }, 842 | "time": "2023-05-22T23:43:01+00:00" 843 | }, 844 | { 845 | "name": "ramsey/collection", 846 | "version": "2.0.0", 847 | "source": { 848 | "type": "git", 849 | "url": "https://github.com/ramsey/collection.git", 850 | "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" 851 | }, 852 | "dist": { 853 | "type": "zip", 854 | "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", 855 | "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", 856 | "shasum": "" 857 | }, 858 | "require": { 859 | "php": "^8.1" 860 | }, 861 | "require-dev": { 862 | "captainhook/plugin-composer": "^5.3", 863 | "ergebnis/composer-normalize": "^2.28.3", 864 | "fakerphp/faker": "^1.21", 865 | "hamcrest/hamcrest-php": "^2.0", 866 | "jangregor/phpstan-prophecy": "^1.0", 867 | "mockery/mockery": "^1.5", 868 | "php-parallel-lint/php-console-highlighter": "^1.0", 869 | "php-parallel-lint/php-parallel-lint": "^1.3", 870 | "phpcsstandards/phpcsutils": "^1.0.0-rc1", 871 | "phpspec/prophecy-phpunit": "^2.0", 872 | "phpstan/extension-installer": "^1.2", 873 | "phpstan/phpstan": "^1.9", 874 | "phpstan/phpstan-mockery": "^1.1", 875 | "phpstan/phpstan-phpunit": "^1.3", 876 | "phpunit/phpunit": "^9.5", 877 | "psalm/plugin-mockery": "^1.1", 878 | "psalm/plugin-phpunit": "^0.18.4", 879 | "ramsey/coding-standard": "^2.0.3", 880 | "ramsey/conventional-commits": "^1.3", 881 | "vimeo/psalm": "^5.4" 882 | }, 883 | "type": "library", 884 | "extra": { 885 | "captainhook": { 886 | "force-install": true 887 | }, 888 | "ramsey/conventional-commits": { 889 | "configFile": "conventional-commits.json" 890 | } 891 | }, 892 | "autoload": { 893 | "psr-4": { 894 | "Ramsey\\Collection\\": "src/" 895 | } 896 | }, 897 | "notification-url": "https://packagist.org/downloads/", 898 | "license": [ 899 | "MIT" 900 | ], 901 | "authors": [ 902 | { 903 | "name": "Ben Ramsey", 904 | "email": "ben@benramsey.com", 905 | "homepage": "https://benramsey.com" 906 | } 907 | ], 908 | "description": "A PHP library for representing and manipulating collections.", 909 | "keywords": [ 910 | "array", 911 | "collection", 912 | "hash", 913 | "map", 914 | "queue", 915 | "set" 916 | ], 917 | "support": { 918 | "issues": "https://github.com/ramsey/collection/issues", 919 | "source": "https://github.com/ramsey/collection/tree/2.0.0" 920 | }, 921 | "funding": [ 922 | { 923 | "url": "https://github.com/ramsey", 924 | "type": "github" 925 | }, 926 | { 927 | "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", 928 | "type": "tidelift" 929 | } 930 | ], 931 | "time": "2022-12-31T21:50:55+00:00" 932 | }, 933 | { 934 | "name": "ramsey/uuid", 935 | "version": "4.7.6", 936 | "source": { 937 | "type": "git", 938 | "url": "https://github.com/ramsey/uuid.git", 939 | "reference": "91039bc1faa45ba123c4328958e620d382ec7088" 940 | }, 941 | "dist": { 942 | "type": "zip", 943 | "url": "https://api.github.com/repos/ramsey/uuid/zipball/91039bc1faa45ba123c4328958e620d382ec7088", 944 | "reference": "91039bc1faa45ba123c4328958e620d382ec7088", 945 | "shasum": "" 946 | }, 947 | "require": { 948 | "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12", 949 | "ext-json": "*", 950 | "php": "^8.0", 951 | "ramsey/collection": "^1.2 || ^2.0" 952 | }, 953 | "replace": { 954 | "rhumsaa/uuid": "self.version" 955 | }, 956 | "require-dev": { 957 | "captainhook/captainhook": "^5.10", 958 | "captainhook/plugin-composer": "^5.3", 959 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", 960 | "doctrine/annotations": "^1.8", 961 | "ergebnis/composer-normalize": "^2.15", 962 | "mockery/mockery": "^1.3", 963 | "paragonie/random-lib": "^2", 964 | "php-mock/php-mock": "^2.2", 965 | "php-mock/php-mock-mockery": "^1.3", 966 | "php-parallel-lint/php-parallel-lint": "^1.1", 967 | "phpbench/phpbench": "^1.0", 968 | "phpstan/extension-installer": "^1.1", 969 | "phpstan/phpstan": "^1.8", 970 | "phpstan/phpstan-mockery": "^1.1", 971 | "phpstan/phpstan-phpunit": "^1.1", 972 | "phpunit/phpunit": "^8.5 || ^9", 973 | "ramsey/composer-repl": "^1.4", 974 | "slevomat/coding-standard": "^8.4", 975 | "squizlabs/php_codesniffer": "^3.5", 976 | "vimeo/psalm": "^4.9" 977 | }, 978 | "suggest": { 979 | "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", 980 | "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", 981 | "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", 982 | "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", 983 | "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." 984 | }, 985 | "type": "library", 986 | "extra": { 987 | "captainhook": { 988 | "force-install": true 989 | } 990 | }, 991 | "autoload": { 992 | "files": [ 993 | "src/functions.php" 994 | ], 995 | "psr-4": { 996 | "Ramsey\\Uuid\\": "src/" 997 | } 998 | }, 999 | "notification-url": "https://packagist.org/downloads/", 1000 | "license": [ 1001 | "MIT" 1002 | ], 1003 | "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", 1004 | "keywords": [ 1005 | "guid", 1006 | "identifier", 1007 | "uuid" 1008 | ], 1009 | "support": { 1010 | "issues": "https://github.com/ramsey/uuid/issues", 1011 | "source": "https://github.com/ramsey/uuid/tree/4.7.6" 1012 | }, 1013 | "funding": [ 1014 | { 1015 | "url": "https://github.com/ramsey", 1016 | "type": "github" 1017 | }, 1018 | { 1019 | "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", 1020 | "type": "tidelift" 1021 | } 1022 | ], 1023 | "time": "2024-04-27T21:32:50+00:00" 1024 | }, 1025 | { 1026 | "name": "symfony/filesystem", 1027 | "version": "v6.4.9", 1028 | "source": { 1029 | "type": "git", 1030 | "url": "https://github.com/symfony/filesystem.git", 1031 | "reference": "b51ef8059159330b74a4d52f68e671033c0fe463" 1032 | }, 1033 | "dist": { 1034 | "type": "zip", 1035 | "url": "https://api.github.com/repos/symfony/filesystem/zipball/b51ef8059159330b74a4d52f68e671033c0fe463", 1036 | "reference": "b51ef8059159330b74a4d52f68e671033c0fe463", 1037 | "shasum": "" 1038 | }, 1039 | "require": { 1040 | "php": ">=8.1", 1041 | "symfony/polyfill-ctype": "~1.8", 1042 | "symfony/polyfill-mbstring": "~1.8" 1043 | }, 1044 | "require-dev": { 1045 | "symfony/process": "^5.4|^6.4|^7.0" 1046 | }, 1047 | "type": "library", 1048 | "autoload": { 1049 | "psr-4": { 1050 | "Symfony\\Component\\Filesystem\\": "" 1051 | }, 1052 | "exclude-from-classmap": [ 1053 | "/Tests/" 1054 | ] 1055 | }, 1056 | "notification-url": "https://packagist.org/downloads/", 1057 | "license": [ 1058 | "MIT" 1059 | ], 1060 | "authors": [ 1061 | { 1062 | "name": "Fabien Potencier", 1063 | "email": "fabien@symfony.com" 1064 | }, 1065 | { 1066 | "name": "Symfony Community", 1067 | "homepage": "https://symfony.com/contributors" 1068 | } 1069 | ], 1070 | "description": "Provides basic utilities for the filesystem", 1071 | "homepage": "https://symfony.com", 1072 | "support": { 1073 | "source": "https://github.com/symfony/filesystem/tree/v6.4.9" 1074 | }, 1075 | "funding": [ 1076 | { 1077 | "url": "https://symfony.com/sponsor", 1078 | "type": "custom" 1079 | }, 1080 | { 1081 | "url": "https://github.com/fabpot", 1082 | "type": "github" 1083 | }, 1084 | { 1085 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 1086 | "type": "tidelift" 1087 | } 1088 | ], 1089 | "time": "2024-06-28T09:49:33+00:00" 1090 | }, 1091 | { 1092 | "name": "symfony/polyfill-ctype", 1093 | "version": "v1.30.0", 1094 | "source": { 1095 | "type": "git", 1096 | "url": "https://github.com/symfony/polyfill-ctype.git", 1097 | "reference": "0424dff1c58f028c451efff2045f5d92410bd540" 1098 | }, 1099 | "dist": { 1100 | "type": "zip", 1101 | "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", 1102 | "reference": "0424dff1c58f028c451efff2045f5d92410bd540", 1103 | "shasum": "" 1104 | }, 1105 | "require": { 1106 | "php": ">=7.1" 1107 | }, 1108 | "provide": { 1109 | "ext-ctype": "*" 1110 | }, 1111 | "suggest": { 1112 | "ext-ctype": "For best performance" 1113 | }, 1114 | "type": "library", 1115 | "extra": { 1116 | "thanks": { 1117 | "name": "symfony/polyfill", 1118 | "url": "https://github.com/symfony/polyfill" 1119 | } 1120 | }, 1121 | "autoload": { 1122 | "files": [ 1123 | "bootstrap.php" 1124 | ], 1125 | "psr-4": { 1126 | "Symfony\\Polyfill\\Ctype\\": "" 1127 | } 1128 | }, 1129 | "notification-url": "https://packagist.org/downloads/", 1130 | "license": [ 1131 | "MIT" 1132 | ], 1133 | "authors": [ 1134 | { 1135 | "name": "Gert de Pagter", 1136 | "email": "BackEndTea@gmail.com" 1137 | }, 1138 | { 1139 | "name": "Symfony Community", 1140 | "homepage": "https://symfony.com/contributors" 1141 | } 1142 | ], 1143 | "description": "Symfony polyfill for ctype functions", 1144 | "homepage": "https://symfony.com", 1145 | "keywords": [ 1146 | "compatibility", 1147 | "ctype", 1148 | "polyfill", 1149 | "portable" 1150 | ], 1151 | "support": { 1152 | "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" 1153 | }, 1154 | "funding": [ 1155 | { 1156 | "url": "https://symfony.com/sponsor", 1157 | "type": "custom" 1158 | }, 1159 | { 1160 | "url": "https://github.com/fabpot", 1161 | "type": "github" 1162 | }, 1163 | { 1164 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 1165 | "type": "tidelift" 1166 | } 1167 | ], 1168 | "time": "2024-05-31T15:07:36+00:00" 1169 | }, 1170 | { 1171 | "name": "symfony/polyfill-mbstring", 1172 | "version": "v1.30.0", 1173 | "source": { 1174 | "type": "git", 1175 | "url": "https://github.com/symfony/polyfill-mbstring.git", 1176 | "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" 1177 | }, 1178 | "dist": { 1179 | "type": "zip", 1180 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", 1181 | "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", 1182 | "shasum": "" 1183 | }, 1184 | "require": { 1185 | "php": ">=7.1" 1186 | }, 1187 | "provide": { 1188 | "ext-mbstring": "*" 1189 | }, 1190 | "suggest": { 1191 | "ext-mbstring": "For best performance" 1192 | }, 1193 | "type": "library", 1194 | "extra": { 1195 | "thanks": { 1196 | "name": "symfony/polyfill", 1197 | "url": "https://github.com/symfony/polyfill" 1198 | } 1199 | }, 1200 | "autoload": { 1201 | "files": [ 1202 | "bootstrap.php" 1203 | ], 1204 | "psr-4": { 1205 | "Symfony\\Polyfill\\Mbstring\\": "" 1206 | } 1207 | }, 1208 | "notification-url": "https://packagist.org/downloads/", 1209 | "license": [ 1210 | "MIT" 1211 | ], 1212 | "authors": [ 1213 | { 1214 | "name": "Nicolas Grekas", 1215 | "email": "p@tchwork.com" 1216 | }, 1217 | { 1218 | "name": "Symfony Community", 1219 | "homepage": "https://symfony.com/contributors" 1220 | } 1221 | ], 1222 | "description": "Symfony polyfill for the Mbstring extension", 1223 | "homepage": "https://symfony.com", 1224 | "keywords": [ 1225 | "compatibility", 1226 | "mbstring", 1227 | "polyfill", 1228 | "portable", 1229 | "shim" 1230 | ], 1231 | "support": { 1232 | "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" 1233 | }, 1234 | "funding": [ 1235 | { 1236 | "url": "https://symfony.com/sponsor", 1237 | "type": "custom" 1238 | }, 1239 | { 1240 | "url": "https://github.com/fabpot", 1241 | "type": "github" 1242 | }, 1243 | { 1244 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 1245 | "type": "tidelift" 1246 | } 1247 | ], 1248 | "time": "2024-06-19T12:30:46+00:00" 1249 | } 1250 | ], 1251 | "packages-dev": [ 1252 | { 1253 | "name": "phpstan/extension-installer", 1254 | "version": "1.4.1", 1255 | "source": { 1256 | "type": "git", 1257 | "url": "https://github.com/phpstan/extension-installer.git", 1258 | "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203" 1259 | }, 1260 | "dist": { 1261 | "type": "zip", 1262 | "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f6b87faf9fc7978eab2f7919a8760bc9f58f9203", 1263 | "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203", 1264 | "shasum": "" 1265 | }, 1266 | "require": { 1267 | "composer-plugin-api": "^2.0", 1268 | "php": "^7.2 || ^8.0", 1269 | "phpstan/phpstan": "^1.9.0" 1270 | }, 1271 | "require-dev": { 1272 | "composer/composer": "^2.0", 1273 | "php-parallel-lint/php-parallel-lint": "^1.2.0", 1274 | "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" 1275 | }, 1276 | "type": "composer-plugin", 1277 | "extra": { 1278 | "class": "PHPStan\\ExtensionInstaller\\Plugin" 1279 | }, 1280 | "autoload": { 1281 | "psr-4": { 1282 | "PHPStan\\ExtensionInstaller\\": "src/" 1283 | } 1284 | }, 1285 | "notification-url": "https://packagist.org/downloads/", 1286 | "license": [ 1287 | "MIT" 1288 | ], 1289 | "description": "Composer plugin for automatic installation of PHPStan extensions", 1290 | "support": { 1291 | "issues": "https://github.com/phpstan/extension-installer/issues", 1292 | "source": "https://github.com/phpstan/extension-installer/tree/1.4.1" 1293 | }, 1294 | "time": "2024-06-10T08:20:49+00:00" 1295 | }, 1296 | { 1297 | "name": "phpstan/phpstan", 1298 | "version": "1.11.11", 1299 | "source": { 1300 | "type": "git", 1301 | "url": "https://github.com/phpstan/phpstan.git", 1302 | "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3" 1303 | }, 1304 | "dist": { 1305 | "type": "zip", 1306 | "url": "https://api.github.com/repos/phpstan/phpstan/zipball/707c2aed5d8d0075666e673a5e71440c1d01a5a3", 1307 | "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3", 1308 | "shasum": "" 1309 | }, 1310 | "require": { 1311 | "php": "^7.2|^8.0" 1312 | }, 1313 | "conflict": { 1314 | "phpstan/phpstan-shim": "*" 1315 | }, 1316 | "bin": [ 1317 | "phpstan", 1318 | "phpstan.phar" 1319 | ], 1320 | "type": "library", 1321 | "autoload": { 1322 | "files": [ 1323 | "bootstrap.php" 1324 | ] 1325 | }, 1326 | "notification-url": "https://packagist.org/downloads/", 1327 | "license": [ 1328 | "MIT" 1329 | ], 1330 | "description": "PHPStan - PHP Static Analysis Tool", 1331 | "keywords": [ 1332 | "dev", 1333 | "static analysis" 1334 | ], 1335 | "support": { 1336 | "docs": "https://phpstan.org/user-guide/getting-started", 1337 | "forum": "https://github.com/phpstan/phpstan/discussions", 1338 | "issues": "https://github.com/phpstan/phpstan/issues", 1339 | "security": "https://github.com/phpstan/phpstan/security/policy", 1340 | "source": "https://github.com/phpstan/phpstan-src" 1341 | }, 1342 | "funding": [ 1343 | { 1344 | "url": "https://github.com/ondrejmirtes", 1345 | "type": "github" 1346 | }, 1347 | { 1348 | "url": "https://github.com/phpstan", 1349 | "type": "github" 1350 | } 1351 | ], 1352 | "time": "2024-08-19T14:37:29+00:00" 1353 | }, 1354 | { 1355 | "name": "phpstan/phpstan-strict-rules", 1356 | "version": "1.6.0", 1357 | "source": { 1358 | "type": "git", 1359 | "url": "https://github.com/phpstan/phpstan-strict-rules.git", 1360 | "reference": "363f921dd8441777d4fc137deb99beb486c77df1" 1361 | }, 1362 | "dist": { 1363 | "type": "zip", 1364 | "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/363f921dd8441777d4fc137deb99beb486c77df1", 1365 | "reference": "363f921dd8441777d4fc137deb99beb486c77df1", 1366 | "shasum": "" 1367 | }, 1368 | "require": { 1369 | "php": "^7.2 || ^8.0", 1370 | "phpstan/phpstan": "^1.11" 1371 | }, 1372 | "require-dev": { 1373 | "nikic/php-parser": "^4.13.0", 1374 | "php-parallel-lint/php-parallel-lint": "^1.2", 1375 | "phpstan/phpstan-deprecation-rules": "^1.1", 1376 | "phpstan/phpstan-phpunit": "^1.0", 1377 | "phpunit/phpunit": "^9.5" 1378 | }, 1379 | "type": "phpstan-extension", 1380 | "extra": { 1381 | "phpstan": { 1382 | "includes": [ 1383 | "rules.neon" 1384 | ] 1385 | } 1386 | }, 1387 | "autoload": { 1388 | "psr-4": { 1389 | "PHPStan\\": "src/" 1390 | } 1391 | }, 1392 | "notification-url": "https://packagist.org/downloads/", 1393 | "license": [ 1394 | "MIT" 1395 | ], 1396 | "description": "Extra strict and opinionated rules for PHPStan", 1397 | "support": { 1398 | "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", 1399 | "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.0" 1400 | }, 1401 | "time": "2024-04-20T06:37:51+00:00" 1402 | } 1403 | ], 1404 | "aliases": [], 1405 | "minimum-stability": "stable", 1406 | "stability-flags": [], 1407 | "prefer-stable": false, 1408 | "prefer-lowest": false, 1409 | "platform": { 1410 | "php": "^8.1" 1411 | }, 1412 | "platform-dev": [], 1413 | "plugin-api-version": "2.6.0" 1414 | } 1415 | -------------------------------------------------------------------------------- /phpstan.neon.dist: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: 9 3 | paths: 4 | - src -------------------------------------------------------------------------------- /src/ColinHDev/libAsyncEvent/AsyncEvent.php: -------------------------------------------------------------------------------- 1 | callback = $callback; 19 | } 20 | 21 | public function callCallback() : void { 22 | if ($this->callback !== null) { 23 | ($this->callback)($this); 24 | $this->callback = null; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/ColinHDev/libAsyncEvent/ConsecutiveEventHandlerExecutionTrait.php: -------------------------------------------------------------------------------- 1 | */ 18 | private Generator $generator; 19 | private bool $blocked = false; 20 | 21 | public function call() : void { 22 | $this->generator = $this->getEventHandlers(); 23 | $this->tryToResume(); 24 | } 25 | 26 | public function block() : void { 27 | $this->blocked = true; 28 | } 29 | 30 | public function release() : void { 31 | $this->blocked = false; 32 | $this->generator->next(); 33 | $this->tryToResume(); 34 | } 35 | 36 | private function tryToResume() : void { 37 | if (!$this->generator->valid()) { 38 | $this->callCallback(); 39 | return; 40 | } 41 | /** @var RegisteredListener $registration */ 42 | $registration = $this->generator->current(); 43 | assert($this instanceof Event); 44 | $registration->callEvent($this); 45 | if (!$this->blocked) { 46 | $this->generator->next(); 47 | $this->tryToResume(); 48 | } 49 | } 50 | 51 | /** 52 | * The following code used in this method was taken from 53 | * * https://github.com/pmmp/PocketMine-MP/blob/26086372107283aad399fb0613d1c284561398be/src/event/Event.php#L58-L68 54 | * * and only slightly modified to a generator function. 55 | * @return Generator 56 | */ 57 | private function getEventHandlers() : Generator { 58 | $handlers = HandlerListManager::global()->getHandlersFor(static::class); 59 | foreach ($handlers as $registration) { 60 | yield $registration; 61 | } 62 | } 63 | 64 | public function __destruct() { 65 | if ($this->generator->valid()) { 66 | throw new RuntimeException( 67 | static::class . " never finished handling all listeners. " . 68 | "Got stuck at a listener of plugin " . $this->generator->current()->getPlugin()->getName() . ". " . 69 | "(Probably a forgotten call of the event's release() method.) " . 70 | "Please contact the plugin author, if this is not your plugin." 71 | ); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /src/ColinHDev/libAsyncEvent/PrioritizedEventHandlerExecutionTrait.php: -------------------------------------------------------------------------------- 1 | , null, void> */ 23 | private Generator $generator; 24 | private int $blocks = 0; 25 | 26 | public function call() : void { 27 | $this->generator = $this->getEventHandlers(); 28 | $this->tryToResume(); 29 | } 30 | 31 | public function block() : void { 32 | $this->blocks++; 33 | } 34 | 35 | public function release() : void { 36 | $this->blocks--; 37 | if ($this->blocks === 0) { 38 | $this->generator->next(); 39 | $this->tryToResume(); 40 | } 41 | } 42 | 43 | private function tryToResume() : void { 44 | $this->generator->next(); 45 | if (!$this->generator->valid()) { 46 | $this->callCallback(); 47 | return; 48 | } 49 | /** @var array $registrations */ 50 | $registrations = $this->generator->current(); 51 | foreach ($registrations as $registration) { 52 | assert($this instanceof Event); 53 | $registration->callEvent($this); 54 | } 55 | if ($this->blocks === 0) { 56 | $this->generator->next(); 57 | $this->tryToResume(); 58 | } 59 | } 60 | 61 | /** 62 | * The following code used in this method was taken from 63 | * https://github.com/pmmp/PocketMine-MP/blob/26086372107283aad399fb0613d1c284561398be/src/event/Event.php#L58-L68 64 | * and only slightly modified to a generator function. 65 | * @return Generator, null, void> 66 | */ 67 | private function getEventHandlers() : Generator { 68 | $handlerList = HandlerListManager::global()->getListFor(static::class); 69 | foreach(EventPriority::ALL as $priority) { 70 | yield $handlerList->getListenersByPriority($priority); 71 | } 72 | } 73 | 74 | public function __destruct() { 75 | if ($this->generator->valid()) { 76 | $plugins = array_map( 77 | static function(RegisteredListener $registration) : string { 78 | return $registration->getPlugin()->getName(); 79 | }, 80 | $this->generator->current() 81 | ); 82 | throw new RuntimeException( 83 | static::class . " never finished handling all listeners. " . 84 | "Got stuck at a listener of one of the following plugins: " . implode(", ", $plugins) . ". " . 85 | "(Probably a forgotten call of the event's release() method.) " . 86 | "Please contact the author of the faulty plugin, if this is not your plugin." 87 | ); 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /virion.yml: -------------------------------------------------------------------------------- 1 | name: libAsyncEvent 2 | antigen: ColinHDev\libAsyncEvent 3 | version: 3.0.0 4 | 5 | description: Simple implementation for creating asynchronous event execution for PocketMine-MP plugins. 6 | 7 | api: [5.5.0] 8 | 9 | authors: [ColinHDev] --------------------------------------------------------------------------------