2222import org .bukkit .scoreboard .Team ;
2323import org .bukkit .util .RayTraceResult ;
2424import org .bukkit .util .Vector ;
25+ import org .checkerframework .checker .index .qual .NonNegative ;
2526import org .jetbrains .annotations .ApiStatus ;
2627import org .jetbrains .annotations .NotNull ;
2728import org .jetbrains .annotations .Nullable ;
@@ -402,106 +403,120 @@ default RayTraceResult rayTraceBlocks(double maxDistance) {
402403 *
403404 * @return ticks until arrow leaves
404405 */
405- public int getArrowCooldown ();
406+ public @ NonNegative int getArrowCooldown ();
406407
407408 /**
408409 * Sets the time in ticks until the next arrow leaves the entity's body.
410+ * <p>
411+ * A value of 0 will cause the server to re-calculate the time on the next tick.
409412 *
410413 * @param ticks time until arrow leaves
411414 */
412- public void setArrowCooldown (int ticks );
415+ public void setArrowCooldown (@ NonNegative int ticks );
413416
414417 /**
415418 * Gets the amount of arrows in an entity's body.
416419 *
417420 * @return amount of arrows in body
418421 */
419- public int getArrowsInBody ();
422+ public @ NonNegative int getArrowsInBody ();
420423
421- // Paper start
422424 /**
423425 * Set the amount of arrows in the entity's body.
424426 * <p>
425427 * Does not fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent}.
426428 *
427429 * @param count amount of arrows in entity's body
428430 */
429- default void setArrowsInBody (final int count ) {
431+ default void setArrowsInBody (final @ NonNegative int count ) {
430432 this .setArrowsInBody (count , false );
431433 }
432- // Paper end
433434
434435 /**
435436 * Set the amount of arrows in the entity's body.
436437 *
437438 * @param count amount of arrows in entity's body
438439 * @param fireEvent whether to fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} event
439440 */
440- void setArrowsInBody (int count , boolean fireEvent ); // Paper
441+ void setArrowsInBody (@ NonNegative int count , boolean fireEvent ); // Paper
441442
442- // Paper start - Add methods for working with arrows stuck in living entities
443443 /**
444444 * Sets the amount of ticks before the next arrow gets removed from the entities body.
445445 * <p>
446446 * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick.
447447 *
448448 * @param ticks Amount of ticks
449+ * @deprecated use {@link #setArrowCooldown(int)}
449450 */
450- void setNextArrowRemoval (@ org .jetbrains .annotations .Range (from = 0 , to = Integer .MAX_VALUE ) int ticks );
451+ @ Deprecated (since = "1.21.10" )
452+ default void setNextArrowRemoval (@ NonNegative int ticks ) {
453+ this .setArrowCooldown (ticks );
454+ }
451455
452456 /**
453457 * Gets the amount of ticks before the next arrow gets removed from the entities body.
454458 *
455459 * @return ticks Amount of ticks
460+ * @deprecated use {@link #getArrowCooldown()}
456461 */
457- int getNextArrowRemoval ();
458- // Paper end - Add methods for working with arrows stuck in living entities
462+ @ Deprecated (since = "1.21.10" )
463+ default @ NonNegative int getNextArrowRemoval () {
464+ return this .getArrowCooldown ();
465+ }
459466
460- // Paper start - Bee Stinger API
461467 /**
462468 * Gets the time in ticks until the next bee stinger leaves the entity's body.
463469 *
464470 * @return ticks until bee stinger leaves
465471 */
466- public int getBeeStingerCooldown ();
472+ public @ NonNegative int getBeeStingerCooldown ();
467473
468474 /**
469475 * Sets the time in ticks until the next stinger leaves the entity's body.
476+ * <p>
477+ * A value of 0 will cause the server to re-calculate the time on the next tick.
470478 *
471479 * @param ticks time until bee stinger leaves
472480 */
473- public void setBeeStingerCooldown (int ticks );
481+ public void setBeeStingerCooldown (@ NonNegative int ticks );
474482
475483 /**
476484 * Gets the amount of bee stingers in an entity's body.
477485 *
478486 * @return amount of bee stingers in body
479487 */
480- public int getBeeStingersInBody ();
488+ public @ NonNegative int getBeeStingersInBody ();
481489
482490 /**
483491 * Set the amount of bee stingers in the entity's body.
484492 *
485493 * @param count amount of bee stingers in entity's body
486494 */
487- public void setBeeStingersInBody (int count );
495+ public void setBeeStingersInBody (@ NonNegative int count );
488496
489497 /**
490498 * Sets the amount of ticks before the next bee stinger gets removed from the entities body.
491499 * <p>
492500 * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick.
493501 *
494502 * @param ticks Amount of ticks
503+ * @deprecated use {@link #setBeeStingerCooldown(int)}
495504 */
496- void setNextBeeStingerRemoval (@ org .jetbrains .annotations .Range (from = 0 , to = Integer .MAX_VALUE ) int ticks );
505+ @ Deprecated (since = "1.21.10" )
506+ default void setNextBeeStingerRemoval (@ NonNegative int ticks ) {
507+ this .setBeeStingerCooldown (ticks );
508+ }
497509
498510 /**
499511 * Gets the amount of ticks before the next bee stinger gets removed from the entities body.
500512 *
501513 * @return ticks Amount of ticks
514+ * @deprecated use {@link #getBeeStingerCooldown()}
502515 */
503- int getNextBeeStingerRemoval ();
504- // Paper end - Stinger API
516+ @ Deprecated (since = "1.21.10" )
517+ default @ NonNegative int getNextBeeStingerRemoval () {
518+ return this .getBeeStingerCooldown ();
519+ }
505520
506521 /**
507522 * Returns the living entity's current maximum no damage ticks.
@@ -1065,11 +1080,14 @@ default boolean addPotionEffect(@NotNull PotionEffect effect) {
10651080
10661081 /**
10671082 * Get the number of arrows stuck in this entity
1083+ *
10681084 * @return Number of arrows stuck
10691085 * @deprecated use {@link #getArrowsInBody()}
10701086 */
10711087 @ Deprecated
1072- int getArrowsStuck ();
1088+ default @ NonNegative int getArrowsStuck () {
1089+ return this .getArrowsInBody ();
1090+ }
10731091
10741092 /**
10751093 * Set the number of arrows stuck in this entity
@@ -1079,7 +1097,9 @@ default boolean addPotionEffect(@NotNull PotionEffect effect) {
10791097 * you want to retain exact functionality, pass {@code true} for {@code fireEvent}.</b>
10801098 */
10811099 @ Deprecated
1082- void setArrowsStuck (int arrows );
1100+ default void setArrowsStuck (@ NonNegative int arrows ) {
1101+ this .setArrowsInBody (arrows , true );
1102+ }
10831103
10841104 /**
10851105 * Get the delay (in ticks) before blocking is effective for this entity
0 commit comments