Skip to content

Commit bdab299

Browse files
committed
implement new level events
1 parent 6266ef0 commit bdab299

35 files changed

Lines changed: 155 additions & 144 deletions

‎paper-api/.checkstyle/checkstyle.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<module name="SuppressWarningsFilter" />
1313
<module name="TreeWalker">
1414
<module name="SuppressWarningsHolder" />
15-
<!--Skip generate content by typewriter-->
15+
<!--Skip generated content by typewriter-->
1616
<module name="SuppressionCommentFilter">
1717
<property name="offCommentFormat" value="Start generate - [\w\|]+"/>
1818
<property name="onCommentFormat" value="End generate - [\w\|]+"/>

‎paper-api/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridge.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
import org.bukkit.inventory.ItemType;
1919
import org.bukkit.inventory.meta.trim.ArmorTrim;
2020
import org.bukkit.map.MapCursor;
21-
import org.jetbrains.annotations.ApiStatus;
2221
import org.jspecify.annotations.Nullable;
2322

24-
@ApiStatus.Internal
2523
interface ItemComponentTypesBridge {
2624

2725
Optional<ItemComponentTypesBridge> BRIDGE = ServiceLoader.load(ItemComponentTypesBridge.class, ItemComponentTypesBridge.class.getClassLoader()).findFirst();

‎paper-api/src/main/java/io/papermc/paper/datacomponent/item/SignText.java‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.jetbrains.annotations.Contract;
1111

1212
/**
13-
* Represents the text on a sign side.
13+
* Represents the lines of text on a sign side.
1414
*
1515
* @see io.papermc.paper.datacomponent.DataComponentTypes#SIGN_TEXT_FRONT
1616
* @see io.papermc.paper.datacomponent.DataComponentTypes#SIGN_TEXT_BACK
@@ -29,20 +29,20 @@ static SignText.Builder signText() {
2929
}
3030

3131
/**
32-
* Gets the list of messages on this sign side.
32+
* Gets the lines on this sign side.
3333
*
3434
* @return the list of messages
3535
*/
3636
@Contract(pure = true)
37-
List<Component> messages();
37+
List<Component> lines();
3838

3939
/**
40-
* Gets the list of messages on this sign side, filtered for the player.
40+
* Gets the lines on this sign side, filtered for the player.
4141
*
4242
* @return the list of messages
4343
*/
4444
@Contract(pure = true)
45-
List<Component> filteredMessages();
45+
List<Component> filteredLines();
4646

4747
/**
4848
* Gets the color of the text on this sign side.
@@ -67,22 +67,32 @@ static SignText.Builder signText() {
6767
interface Builder extends DataComponentBuilder<SignText> {
6868

6969
/**
70-
* Sets the list of messages on this sign side.
70+
* Sets the lines on this sign side.
7171
*
7272
* @param messages the list of messages
7373
* @return the builder for chaining
7474
*/
7575
@Contract(value = "_ -> this", mutates = "this")
76-
Builder messages(List<? extends ComponentLike> messages);
76+
Builder lines(List<? extends ComponentLike> messages);
7777

7878
/**
79-
* Adds a message to the list of messages on this sign side.
79+
* Sets a line at the specified index on this sign side.
8080
*
81-
* @param message the message to add
81+
* @param index the line index
82+
* @param message the message
83+
* @return the builder for chaining
84+
*/
85+
@Contract(value = "_, _ -> this", mutates = "this")
86+
Builder line(int index, ComponentLike message);
87+
88+
/**
89+
* Adds a line on this sign side.
90+
*
91+
* @param message the message
8292
* @return the builder for chaining
8393
*/
8494
@Contract(value = "_ -> this", mutates = "this")
85-
Builder addMessage(ComponentLike message);
95+
Builder addLine(ComponentLike message);
8696

8797
/**
8898
* Sets the color of the text on this sign side.
@@ -96,7 +106,7 @@ interface Builder extends DataComponentBuilder<SignText> {
96106
/**
97107
* Sets whether the text on this sign side has a glowing effect.
98108
*
99-
* @param hasGlowingText true if the text has a glowing effect, false otherwise
109+
* @param hasGlowingText {@code true} if the text has a glowing effect
100110
* @return the builder for chaining
101111
*/
102112
@Contract(value = "_ -> this", mutates = "this")

‎paper-api/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,5 @@ static ConsumableTypesBridge bridge() {
2424

2525
ConsumeEffect.PlaySound playSoundEffect(Key sound);
2626

27-
ConsumeEffect.TeleportRandomly teleportRandomlyEffect(float diameter);
28-
2927
ConsumeEffect.TeleportRandomly teleportRandomlyEffect(float diameter, boolean directionalParticles);
3028
}

‎paper-api/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,23 @@ public interface ConsumeEffect {
1919
*
2020
* @param diameter diameter of random teleportation
2121
* @return the effect instance
22+
* @see #teleportRandomlyEffect(float, boolean)
2223
*/
2324
@Contract(value = "_ -> new", pure = true)
2425
static TeleportRandomly teleportRandomlyEffect(final float diameter) {
25-
return ConsumableTypesBridge.bridge().teleportRandomlyEffect(diameter);
26+
return teleportRandomlyEffect(diameter, true);
27+
}
28+
29+
/**
30+
* Creates a consume effect that randomly teleports the entity on consumption.
31+
*
32+
* @param diameter diameter of random teleportation
33+
* @param directionalParticles show a particle trail in the direction of the teleportation
34+
* @return the effect instance
35+
*/
36+
@Contract(value = "_, _ -> new", pure = true)
37+
static TeleportRandomly teleportRandomlyEffect(final float diameter, final boolean directionalParticles) {
38+
return ConsumableTypesBridge.bridge().teleportRandomlyEffect(diameter, directionalParticles);
2639
}
2740

2841
/**
@@ -83,9 +96,9 @@ interface TeleportRandomly extends ConsumeEffect {
8396
float diameter();
8497

8598
/**
86-
* If the teleport need to show a particle trail into the direction of the teleportation.
99+
* Checks whether to show a particle trail in the direction of the teleportation.
87100
*
88-
* @return true if the particle trail should be shown
101+
* @return {@code true} if the particle trail should be shown
89102
*/
90103
boolean directionalParticles();
91104
}

‎paper-api/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,16 @@ public ItemStack getItem() {
4040
* Gets whether the composter will rise a level.
4141
*
4242
* @return {@code true} if successful
43-
* @deprecated items can now control how many layers they add on click. Use {@link #getLevelsToRaise()}.
4443
*/
45-
@Deprecated(since = "26.3", forRemoval = true)
4644
public boolean willRaiseLevel() {
4745
return this.raisedLevels > 0;
4846
}
4947

5048
/**
5149
* Sets whether the composter will rise a level.
5250
*
53-
* @param willRaiseLevel {@code true} if the composter should rise a level. Use {@link #setLevelsToRaise(int)}.
51+
* @param willRaiseLevel {@code true} if the composter should rise a level
52+
* @deprecated items can now control how many layers they add on click. Use {@link #setLevelsToRaise(int)}.
5453
*/
5554
@Deprecated(since = "26.3", forRemoval = true)
5655
public void setWillRaiseLevel(final boolean willRaiseLevel) {
@@ -67,7 +66,7 @@ public int getLevelsToRaise() {
6766
/**
6867
* Configures the levels the composter will be raised by.
6968
*
70-
* @param raisedLevels the levels to raise the composter by.
69+
* @param raisedLevels the levels to raise the composter by
7170
*/
7271
public void setLevelsToRaise(final int raisedLevels) {
7372
this.raisedLevels = raisedLevels;

‎paper-api/src/main/java/io/papermc/paper/event/entity/EntityBreakByEntityEvent.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ public class EntityBreakByEntityEvent extends EntityBreakEvent {
1212
private final DamageSource damageSource;
1313

1414
@ApiStatus.Internal
15-
public EntityBreakByEntityEvent(final Entity entity, final Entity remover, final DamageSource damageSource) {
16-
this(entity, remover, damageSource, RemoveCause.ENTITY);
17-
}
18-
1915
public EntityBreakByEntityEvent(final Entity entity, final Entity remover, final DamageSource damageSource, final RemoveCause cause) {
2016
super(entity, cause);
2117
this.remover = remover;

‎paper-api/src/main/java/io/papermc/paper/event/entity/EntityBreakEvent.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public EntityBreakEvent(final Entity entity, final RemoveCause cause) {
2222
}
2323

2424
/**
25-
* Gets the cause for the entity's removal
25+
* Gets the cause for the entity's removal.
2626
*
2727
* @return the RemoveCause for the entity's removal
2828
*/
@@ -50,27 +50,27 @@ public static HandlerList getHandlerList() {
5050
}
5151

5252
/**
53-
* An enum to specify the cause of the removal
53+
* An enum to specify the cause of the removal.
5454
*/
5555
public enum RemoveCause {
5656
/**
57-
* Removed by an entity
57+
* Removed by an entity.
5858
*/
5959
ENTITY,
6060
/**
61-
* Removed by an explosion
61+
* Removed by an explosion.
6262
*/
6363
EXPLOSION,
6464
/**
65-
* Removed by placing a block on it
65+
* Removed by placing a block on it.
6666
*/
6767
OBSTRUCTION,
6868
/**
69-
* Removed by destroying the block behind it, etc
69+
* Removed by destroying the block behind it, etc.
7070
*/
7171
PHYSICS,
7272
/**
73-
* Removed by an uncategorised cause
73+
* Removed by an uncategorised cause.
7474
*/
7575
DEFAULT,
7676
}

‎paper-api/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class EntityCompostItemEvent extends CompostItemEvent implements Cancella
1818
private boolean cancelled;
1919

2020
@ApiStatus.Internal
21-
public EntityCompostItemEvent(final Entity entity, final Block composter, final ItemStack item, final int willRaiseLevel) {
22-
super(composter, item, willRaiseLevel);
21+
public EntityCompostItemEvent(final Entity entity, final Block composter, final ItemStack item, final int raisedLevels) {
22+
super(composter, item, raisedLevels);
2323
this.entity = entity;
2424
}
2525

‎paper-api/src/main/java/io/papermc/paper/potion/PotionMix.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Represents a potion mix made in a Brewing Stand.
1515
*
16-
* @deprecated Fully replaced by {@link org.bukkit.inventory.BrewingRecipe}.
16+
* @deprecated fully replaced by {@link org.bukkit.inventory.BrewingRecipe}
1717
*/
1818
@NullMarked
1919
@Deprecated(since = "26.3", forRemoval = true)

0 commit comments

Comments
 (0)