|
1 | 1 | package xyz.srnyx.lazylibrary.emoji; |
2 | 2 |
|
3 | | -import net.dv8tion.jda.api.JDA; |
4 | | -import net.dv8tion.jda.api.entities.User; |
5 | | -import net.dv8tion.jda.api.entities.emoji.ApplicationEmoji; |
6 | | -import net.dv8tion.jda.api.managers.ApplicationEmojiManager; |
7 | | -import net.dv8tion.jda.api.requests.RestAction; |
8 | | -import net.dv8tion.jda.api.utils.data.DataObject; |
| 3 | +import net.dv8tion.jda.api.entities.emoji.*; |
| 4 | +import net.dv8tion.jda.internal.JDAImpl; |
| 5 | +import net.dv8tion.jda.internal.entities.emoji.ApplicationEmojiImpl; |
9 | 6 |
|
10 | 7 | import org.jetbrains.annotations.NotNull; |
11 | | -import org.jetbrains.annotations.Nullable; |
12 | 8 |
|
13 | 9 |
|
14 | 10 | /** |
15 | | - * A wrapper for {@link ApplicationEmoji} that adds a custom {@link #toString()} method |
| 11 | + * A wrapper for {@link ApplicationEmojiImpl} that adds a custom {@link #toString()} method |
16 | 12 | * |
17 | | - * @param emoji the emoji to wrap |
18 | 13 | */ |
19 | | -public record ApplicationEmojiWrapper(@NotNull ApplicationEmoji emoji) implements ApplicationEmoji { |
| 14 | +public final class ApplicationEmojiWrapper extends ApplicationEmojiImpl { |
| 15 | + @NotNull private final ApplicationEmoji emoji; |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructs a new ApplicationEmojiWrapper with the provided ApplicationEmoji |
| 19 | + * |
| 20 | + * @param emoji the ApplicationEmoji to wrap |
| 21 | + */ |
| 22 | + public ApplicationEmojiWrapper(@NotNull ApplicationEmoji emoji) { |
| 23 | + super(emoji.getIdLong(), (JDAImpl) emoji.getJDA(), emoji.getOwner()); |
| 24 | + this.emoji = emoji; |
| 25 | + } |
| 26 | + |
20 | 27 | /** |
21 | 28 | * Returns the mention of the emoji (e.g. {@code <:emoji_name:emoji_id>}) |
22 | 29 | * |
23 | | - * @return the mention of the emoji |
| 30 | + * @return the mention of the emoji |
24 | 31 | */ |
25 | 32 | @Override @NotNull |
26 | 33 | public String toString() { |
27 | 34 | return emoji.getAsMention(); |
28 | 35 | } |
29 | | - |
30 | | - @Override @NotNull |
31 | | - public JDA getJDA() { |
32 | | - return emoji.getJDA(); |
33 | | - } |
34 | | - @Override @Nullable |
35 | | - public User getOwner() { |
36 | | - return emoji.getOwner(); |
37 | | - } |
38 | | - @Override @NotNull |
39 | | - public RestAction<Void> delete() { |
40 | | - return emoji.delete(); |
41 | | - } |
42 | | - @Override @NotNull |
43 | | - public ApplicationEmojiManager getManager() { |
44 | | - return emoji.getManager(); |
45 | | - } |
46 | | - @Override |
47 | | - public boolean isAnimated() { |
48 | | - return emoji.isAnimated(); |
49 | | - } |
50 | | - @Override |
51 | | - public long getIdLong() { |
52 | | - return emoji.getIdLong(); |
53 | | - } |
54 | | - @Override @NotNull |
55 | | - public String getName() { |
56 | | - return emoji.getName(); |
57 | | - } |
58 | | - @Override @NotNull |
59 | | - public String getAsReactionCode() { |
60 | | - return emoji.getAsReactionCode(); |
61 | | - } |
62 | | - @Override @NotNull |
63 | | - public DataObject toData() { |
64 | | - return emoji.toData(); |
65 | | - } |
66 | 36 | } |
0 commit comments