Skip to content

Commit 44874a9

Browse files
committed
chore: merge api-14 for updates
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
2 parents 8f4878d + 7dd5188 commit 44874a9

File tree

79 files changed

+1464
-2456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1464
-2456
lines changed

src/main/java/org/spongepowered/api/advancement/Advancement.java

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,30 @@
2626

2727
import net.kyori.adventure.text.Component;
2828
import net.kyori.adventure.text.ComponentLike;
29+
import org.checkerframework.checker.nullness.qual.Nullable;
2930
import org.spongepowered.api.ResourceKey;
31+
import org.spongepowered.api.Sponge;
3032
import org.spongepowered.api.advancement.criteria.AdvancementCriterion;
31-
import org.spongepowered.api.data.persistence.DataSerializable;
33+
import org.spongepowered.api.datapack.DataPackSerializable;
34+
import org.spongepowered.api.registry.DefaultedRegistryValue;
35+
import org.spongepowered.api.util.CopyableBuilder;
3236

3337
import java.util.List;
3438
import java.util.Optional;
3539

3640
/**
3741
* An advancement.
3842
*/
39-
public interface Advancement extends ComponentLike, DataSerializable {
43+
public interface Advancement extends DefaultedRegistryValue, ComponentLike, DataPackSerializable {
44+
45+
/**
46+
* Creates a new {@link Builder} to create an {@link Advancement}.
47+
*
48+
* @return The new builder
49+
*/
50+
static Advancement.Builder builder() {
51+
return Sponge.game().builderProvider().provide(Advancement.Builder.class);
52+
}
4053

4154
/**
4255
* Gets all the {@link AdvancementCriterion} that should be achieved
@@ -72,4 +85,57 @@ public interface Advancement extends ComponentLike, DataSerializable {
7285
*/
7386
List<Component> toToastText();
7487

88+
/**
89+
* A builder to create {@link Advancement}s.
90+
*/
91+
interface Builder extends org.spongepowered.api.util.Builder<Advancement, Builder>, CopyableBuilder<Advancement, Builder> {
92+
93+
/**
94+
* Sets the parent {@link Advancement} key.
95+
* <p>For the root advancement use {@link #root}</p>
96+
*
97+
* @param parent The parent advancement
98+
* @return This builder, for chaining
99+
*/
100+
Builder parent(ResourceKey parent);
101+
102+
/**
103+
* Sets this advancement as root.
104+
*
105+
* @return This builder, for chaining
106+
*/
107+
Builder.RootStep root();
108+
109+
/**
110+
* Define root advancement only parameters.
111+
*/
112+
interface RootStep extends Builder {
113+
114+
/**
115+
* Sets the background path..
116+
*
117+
* @param backgroundPath The {@link AdvancementTree}s background.
118+
*
119+
* @return This builder, for chaining
120+
*/
121+
Builder background(ResourceKey backgroundPath);
122+
}
123+
124+
/**
125+
* Sets the {@link AdvancementCriterion} that should be used
126+
* for the advancement. Defaults to {@link AdvancementCriterion#empty()}.
127+
*
128+
* @param criterion The criterion
129+
* @return This builder, for chaining
130+
*/
131+
Builder criterion(AdvancementCriterion criterion);
132+
133+
/**
134+
* Sets the {@link DisplayInfo}. Defaults to {code null}.
135+
*
136+
* @param displayInfo The display info
137+
* @return This builder, for chaining
138+
*/
139+
Builder displayInfo(@Nullable DisplayInfo displayInfo);
140+
}
75141
}

src/main/java/org/spongepowered/api/advancement/AdvancementTemplate.java

Lines changed: 0 additions & 128 deletions
This file was deleted.

src/main/java/org/spongepowered/api/advancement/AdvancementTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public interface AdvancementTree extends AdvancementNode {
5959
* @param advancement The advancement
6060
* @return The tree layout element
6161
*/
62-
Optional<TreeLayoutElement> layoutElement(AdvancementTemplate advancement);
62+
Optional<TreeLayoutElement> layoutElement(Advancement advancement);
6363

6464

6565
/**

src/main/java/org/spongepowered/api/adventure/ChatType.java

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,83 @@
2525
package org.spongepowered.api.adventure;
2626

2727
import net.kyori.adventure.text.format.Style;
28+
import org.spongepowered.api.Sponge;
29+
import org.spongepowered.api.datapack.DataPackSerializable;
30+
import org.spongepowered.api.registry.DefaultedRegistryValue;
31+
import org.spongepowered.api.util.CopyableBuilder;
2832
import org.spongepowered.api.util.annotation.CatalogedBy;
2933

3034
/**
3135
* A type of chat
3236
*/
3337
@CatalogedBy(ChatTypes.class)
34-
public interface ChatType extends net.kyori.adventure.chat.ChatType {
38+
public interface ChatType extends DefaultedRegistryValue, net.kyori.adventure.chat.ChatType, DataPackSerializable {
3539

40+
/**
41+
* Creates a new {@link Builder} to create a {@link ChatType}.
42+
*
43+
* @return The new builder
44+
*/
45+
static Builder builder() {
46+
return Sponge.game().builderProvider().provide(Builder.class);
47+
}
48+
49+
/**
50+
* Gets the translation key that would be used
51+
* to display the chat message.
52+
*
53+
* @return The translation key
54+
*/
3655
String translationKey();
3756

57+
/**
58+
* Gets the style that would be used to
59+
* display the chat message.
60+
*
61+
* @return The style
62+
*/
3863
Style style();
3964

65+
/**
66+
* A builder to create {@link ChatType}s.
67+
*/
68+
interface Builder extends org.spongepowered.api.util.Builder<ChatType, Builder>, CopyableBuilder<ChatType, Builder> {
69+
70+
/**
71+
* Sets the translation key or custom format mask.
72+
*
73+
* @param translationKey The translation key or format mask
74+
* @return this builder, for chaining
75+
*/
76+
Builder translationKey(String translationKey);
77+
78+
/**
79+
* Sets the style.
80+
*
81+
* @param style The style
82+
* @return this builder, for chaining
83+
*/
84+
Builder style(Style style);
85+
86+
/**
87+
* Adds a sender parameter.
88+
*
89+
* @return this builder, for chaining
90+
*/
91+
Builder addSender();
92+
93+
/**
94+
* Adds a content parameter.
95+
*
96+
* @return this builder, for chaining
97+
*/
98+
Builder addContent();
99+
100+
/**
101+
* Adds a target parameter.
102+
*
103+
* @return this builder, for chaining
104+
*/
105+
Builder addTarget();
106+
}
40107
}

0 commit comments

Comments
 (0)