forked from KyoriPowered/adventure-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Facet.java
799 lines (740 loc) · 21.9 KB
/
Facet.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
/*
* This file is part of adventure-platform, licensed under the MIT License.
*
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.kyori.adventure.platform.facet;
import java.io.Closeable;
import java.time.Duration;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.sound.SoundStop;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static net.kyori.adventure.platform.facet.Knob.logError;
import static net.kyori.adventure.platform.facet.Knob.logMessage;
import static net.kyori.adventure.platform.facet.Knob.logUnsupported;
/**
* A unit of functionality for a viewer.
*
* <p>This is not supported API. Subject to change at any time.</p>
*
* @param <V> a viewer type
* @since 4.0.0
*/
@ApiStatus.Internal
public interface Facet<V> {
/**
* Creates a collection of supported facets.
*
* @param suppliers an array of facet suppliers
* @param <V> a viewer type
* @param <F> a facet type
* @return a collection of facets
* @since 4.0.0
*/
@SafeVarargs
static <V, F extends Facet<? extends V>> @NotNull Collection<F> of(final @NotNull Supplier<F>... suppliers) {
final List<F> facets = new LinkedList<>();
for (final Supplier<F> supplier : suppliers) {
final F facet;
try {
facet = supplier.get();
} catch (final NoClassDefFoundError error) {
logMessage("Skipped facet: %s", supplier.getClass().getName());
continue;
} catch (final Throwable error) {
logError(error, "Failed facet: %s", supplier);
continue;
}
if (!facet.isSupported()) {
logMessage("Skipped facet: %s", facet);
continue;
}
facets.add(facet);
logMessage("Added facet: %s", facet);
}
return facets;
}
/**
* Gets the first applicable facet for a viewer.
*
* @param facets a collection of supported facets
* @param viewer a viewer
* @param <V> a viewer type
* @param <F> a facet type
* @return a facet or {@code null} if none are applicable
* @since 4.0.0
*/
static <V, F extends Facet<V>> @Nullable F of(final @Nullable Collection<F> facets, final @Nullable V viewer) {
if (facets == null || viewer == null) return null;
for (final F facet : facets) {
try {
if (facet.isApplicable(viewer)) {
logMessage("Selected facet: %s for %s", facet, viewer);
return facet;
} else if (Knob.DEBUG) {
logMessage("Not selecting %s for %s", facet, viewer);
}
} catch (final ClassCastException error) {
if (Knob.DEBUG) {
logMessage("Exception while getting facet %s for %s: %s", facet, viewer, error.getMessage());
}
}
}
return null;
}
/**
* Gets whether this handler is supported by the current runtime.
*
* <p>If not, this can be discarded since it will fail for all viewers.</p>
*
* @return if this handler is supported
* @since 4.0.0
*/
default boolean isSupported() {
return true;
}
/**
* Gets whether this handler is applicable to a particular viewer.
*
* <p>This should only be invoked if {@link #isSupported()} is {@code true}.</p>
*
* @param viewer a viewer
* @return if this handler is applicable to a viewer
* @since 4.0.0
*/
default boolean isApplicable(final @NotNull V viewer) {
return true;
}
/**
* A facet that converts components between formats.
*
* @param <V> a viewer type
* @param <M> a message type
* @since 4.0.0
*/
interface Message<V, M> extends Facet<V> {
int PROTOCOL_HEX_COLOR = 713; // Added 20w17a
int PROTOCOL_JSON = 5; // Added 14w02a
/**
* Creates a message.
*
* <p>Messages should not be translated to a viewer's locale, this is done elsewhere.</p>
*
* @param viewer a viewer
* @param message a message
* @return a message or {@code null}
* @since 4.0.0
*/
@Nullable M createMessage(final @NotNull V viewer, final @NotNull Component message);
}
/**
* A facet that sends chat messages.
*
* @param <V> a viewer type
* @param <M> a message type
* @since 4.0.0
*/
interface Chat<V, M> extends Message<V, M> {
/**
* Sends a chat message.
*
* @param viewer a viewer
* @param source the sender's identity
* @param message a message
* @param type a message type
* @since 4.0.0
*/
void sendMessage(final @NotNull V viewer, final @NotNull Identity source, final @NotNull M message, final @NotNull Object type);
}
/**
* A facet that sends chat messages, using packets.
*
* @param <V> a viewer type
* @param <M> a message type
* @since 4.0.0
*/
interface ChatPacket<V, M> extends Chat<V, M> {
byte TYPE_CHAT = 0;
byte TYPE_SYSTEM = 1;
byte TYPE_ACTION_BAR = 2;
/**
* Creates a message type.
*
* @param type a message type
* @return an ordinal
* @since 4.0.0
*/
default byte createMessageType(final @NotNull MessageType type) {
if (type == MessageType.CHAT) {
return TYPE_CHAT;
} else if (type == MessageType.SYSTEM) {
return TYPE_SYSTEM;
}
logUnsupported(this, type);
return TYPE_CHAT;
}
}
/**
* A facet that sends action bars.
*
* @param <V> a viewer type
* @param <M> a message type
* @since 4.0.0
*/
interface ActionBar<V, M> extends Message<V, M> {
/**
* Sends an action bar.
*
* @param viewer a viewer
* @param message a message
* @since 4.0.0
*/
void sendMessage(final @NotNull V viewer, final @NotNull M message);
}
/**
* A facet that shows, clears, and resets titles.
*
* @param <V> a viewer type
* @param <M> a message type
* @param <C> a collection type
* @param <T> a completed title type
* @since 4.0.0
*/
interface Title<V, M, C, T> extends Message<V, M> {
int PROTOCOL_ACTION_BAR = 310; // Added 16w40a
long MAX_SECONDS = Long.MAX_VALUE / 20;
/**
* Creates a collection that will receive title parts.
*
* @return the collection
* @since 4.0.0
*/
@NotNull C createTitleCollection();
/**
* Contribute a title part to the title builder.
*
* <p>This will only be called if a title is present</p>
*
* @param coll collection
* @param title title text
* @since 4.0.0
*/
void contributeTitle(final @NotNull C coll, final @NotNull M title);
/**
* Contribute a subtitle part to the title builder.
*
* <p>This will only be called if a subtitle is present</p>
*
* @param coll collection
* @param subtitle subtitle text
* @since 4.0.0
*/
void contributeSubtitle(final @NotNull C coll, final @NotNull M subtitle);
/**
* Contribute a times part to the title builder.
*
* <p>This will only be called if times are present</p>
*
* @param coll collection
* @param inTicks number of fade in ticks
* @param stayTicks number of stay ticks
* @param outTicks number of fade out ticks
* @since 4.0.0
*/
void contributeTimes(final @NotNull C coll, final int inTicks, final int stayTicks, final int outTicks);
/**
* Complete a title.
*
* @param coll The in-progress collection of parts
* @return a title or {@code null}
* @since 4.0.0
*/
@Nullable T completeTitle(final @NotNull C coll);
/**
* Shows a title.
*
* @param viewer a viewer
* @param title a title
* @since 4.0.0
*/
void showTitle(final @NotNull V viewer, final @NotNull T title);
/**
* Clears a title.
*
* @param viewer a viewer
* @since 4.0.0
*/
void clearTitle(final @NotNull V viewer);
/**
* Resets a title.
*
* @param viewer a viewer
* @since 4.0.0
*/
void resetTitle(final @NotNull V viewer);
/**
* Gets the ticks for a duration.
*
* @param duration a duration
* @return the ticks
* @since 4.0.0
*/
default int toTicks(final @Nullable Duration duration) {
if (duration == null || duration.isNegative()) {
return -1;
}
if (duration.getSeconds() > MAX_SECONDS) {
// TODO: throw an exception here?
return Integer.MAX_VALUE;
}
return (int) (duration.getSeconds() * 20 // 20ticks/sec
+ duration.getNano() / 50_000_000); // 50ms * 1ms/1000000ns
}
}
/**
* A facet that sends titles, using packets.
*
* @param <V> a viewer type
* @param <M> a message type
* @param <C> a collection type
* @param <T> a title type
* @since 4.0.0
*/
interface TitlePacket<V, M, C, T> extends Title<V, M, C, T> {
int ACTION_TITLE = 0;
int ACTION_SUBTITLE = 1;
int ACTION_ACTIONBAR = 2;
int ACTION_TIMES = 3;
int ACTION_CLEAR = 4;
int ACTION_RESET = 5;
}
/**
* A facet that requires a 3D vector.
*
* @param <V> a viewer type
* @param <P> a position type
* @since 4.0.0
*/
interface Position<V, P> extends Facet<V> {
/**
* Finds a viewer's position.
*
* @param viewer a viewer
* @return a position or {@code null} if cannot be found
* @since 4.0.0
*/
@Nullable P createPosition(final @NotNull V viewer);
/**
* Creates a position.
*
* @param x a x coordinate
* @param y a y coordinate
* @param z a z coordinate
* @return a position
* @since 4.0.0
*/
@NotNull P createPosition(final double x, final double y, final double z);
}
/**
* A facet that plays and stops sounds.
*
* @param <V> a viewer type
* @param <P> a position type
* @since 4.0.0
*/
interface Sound<V, P> extends Position<V, P> {
/**
* Plays a sound.
*
* @param viewer a viewer
* @param sound a sound
* @param position a position
* @since 4.0.0
*/
void playSound(final @NotNull V viewer, final net.kyori.adventure.sound.@NotNull Sound sound, final @NotNull P position);
/**
* Stops a sound.
*
* @param viewer a viewer
* @param sound a sound stop
* @since 4.0.0
*/
void stopSound(final @NotNull V viewer, final @NotNull SoundStop sound);
}
/**
* Create a sound that follows a certain entity.
*
* @param <V> viewer type
* @param <M> sound packet type
* @since 4.0.0
*/
interface EntitySound<V, M> extends Facet<V> {
/**
* Create a sound packet following the viewer themself.
*
* @param viewer the receiver of the sound
* @param sound the sound to play
* @return a new packet
* @since 4.0.0
*/
M createForSelf(final V viewer, final net.kyori.adventure.sound.@NotNull Sound sound);
/**
* Create a sound packet following a specific emitter.
*
* @param sound the sound to play
* @param emitter the emitter to track
* @return a new packet
* @since 4.0.0
*/
M createForEmitter(final net.kyori.adventure.sound.@NotNull Sound sound, final net.kyori.adventure.sound.Sound.@NotNull Emitter emitter);
/**
* Play a created sound message to a viewer.
*
* @param viewer the viewer to receive the sound
* @param message the sound message to send
* @since 4.0.0
*/
void playSound(final @NotNull V viewer, final M message);
}
/**
* A facet that opens a book.
*
* @param <V> a viewer type
* @param <M> a message type
* @param <B> a book type
* @since 4.0.0
*/
interface Book<V, M, B> extends Message<V, M> {
/**
* Creates a book.
*
* @param title a title
* @param author an author
* @param pages a collection of pages
* @return a book or {@code null}
* @since 4.0.0
*/
@Nullable B createBook(final @NotNull String title, final @NotNull String author, final @NotNull Iterable<M> pages);
/**
* Opens a book.
*
* @param viewer a viewer
* @param book a book
* @since 4.0.0
*/
void openBook(final @NotNull V viewer, final @NotNull B book);
}
/**
* A facet that listens to boss bar changes.
*
* @param <V> a viewer type
* @since 4.0.0
*/
interface BossBar<V> extends net.kyori.adventure.bossbar.BossBar.Listener, Closeable {
int PROTOCOL_BOSS_BAR = 356; // Added 18w05a
/**
* A builder for boss bar facets.
*
* @param <V> a viewer type
* @param <B> a boss bar type
* @since 4.0.0
*/
@FunctionalInterface
interface Builder<V, B extends BossBar<V>> extends Facet<V> {
/**
* Creates a boss bar.
*
* @param viewer a viewer
* @return a boss bar
* @since 4.0.0
*/
@NotNull B createBossBar(final @NotNull Collection<V> viewer);
}
/**
* Initializes the boss bar.
*
* @param bar a boss bar
* @since 4.0.0
*/
default void bossBarInitialized(final net.kyori.adventure.bossbar.@NotNull BossBar bar) {
this.bossBarNameChanged(bar, bar.name(), bar.name());
this.bossBarColorChanged(bar, bar.color(), bar.color());
this.bossBarProgressChanged(bar, bar.progress(), bar.progress());
this.bossBarFlagsChanged(bar, bar.flags(), Collections.emptySet());
this.bossBarOverlayChanged(bar, bar.overlay(), bar.overlay());
}
/**
* Adds a viewer to the boss bar.
*
* @param viewer a viewer
* @since 4.0.0
*/
void addViewer(final @NotNull V viewer);
/**
* Removes a viewer from the boss bar.
*
* @param viewer a viewer
* @since 4.0.0
*/
void removeViewer(final @NotNull V viewer);
/**
* Gets whether the boss bar has no viewers.
*
* @return if the boss bar is empty
* @since 4.0.0
*/
boolean isEmpty();
/**
* Removes all viewers.
*
* @since 4.0.0
*/
@Override
void close();
}
/**
* A facet that listens to boss bar changes, using packets.
*
* @param <V> a viewer type
* @since 4.0.0
*/
interface BossBarPacket<V> extends BossBar<V> {
int ACTION_ADD = 0;
int ACTION_REMOVE = 1;
int ACTION_HEALTH = 2;
int ACTION_TITLE = 3;
int ACTION_STYLE = 4;
int ACTION_FLAG = 5;
/**
* Creates a color.
*
* @param color a color
* @return an ordinal
* @since 4.0.0
*/
default int createColor(final net.kyori.adventure.bossbar.BossBar.@NotNull Color color) {
if (color == net.kyori.adventure.bossbar.BossBar.Color.PURPLE) {
return 5;
} else if (color == net.kyori.adventure.bossbar.BossBar.Color.PINK) {
return 0;
} else if (color == net.kyori.adventure.bossbar.BossBar.Color.BLUE) {
return 1;
} else if (color == net.kyori.adventure.bossbar.BossBar.Color.RED) {
return 2;
} else if (color == net.kyori.adventure.bossbar.BossBar.Color.GREEN) {
return 3;
} else if (color == net.kyori.adventure.bossbar.BossBar.Color.YELLOW) {
return 4;
} else if (color == net.kyori.adventure.bossbar.BossBar.Color.WHITE) {
return 6;
}
logUnsupported(this, color);
return 5;
}
/**
* Creates an overlay.
*
* @param overlay an overlay
* @return an ordinal
* @since 4.0.0
*/
default int createOverlay(final net.kyori.adventure.bossbar.BossBar.@NotNull Overlay overlay) {
if (overlay == net.kyori.adventure.bossbar.BossBar.Overlay.PROGRESS) {
return 0;
} else if (overlay == net.kyori.adventure.bossbar.BossBar.Overlay.NOTCHED_6) {
return 1;
} else if (overlay == net.kyori.adventure.bossbar.BossBar.Overlay.NOTCHED_10) {
return 2;
} else if (overlay == net.kyori.adventure.bossbar.BossBar.Overlay.NOTCHED_12) {
return 3;
} else if (overlay == net.kyori.adventure.bossbar.BossBar.Overlay.NOTCHED_20) {
return 4;
}
logUnsupported(this, overlay);
return 0;
}
/**
* Creates a bit flag.
*
* @param flagBit a flag bit
* @param flagsAdded a set of added flags
* @param flagsRemoved a set of removed flags
* @return an ordinal
* @since 4.0.0
*/
default byte createFlag(final byte flagBit, final @NotNull Set<net.kyori.adventure.bossbar.BossBar.Flag> flagsAdded, final @NotNull Set<net.kyori.adventure.bossbar.BossBar.Flag> flagsRemoved) {
byte bit = flagBit;
for (final net.kyori.adventure.bossbar.BossBar.@NotNull Flag flag : flagsAdded) {
if (flag == net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN) {
bit |= 1;
} else if (flag == net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC) {
bit |= 1 << 1;
} else if (flag == net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG) {
bit |= 1 << 2;
} else {
logUnsupported(this, flag);
}
}
for (final net.kyori.adventure.bossbar.BossBar.@NotNull Flag flag : flagsRemoved) {
if (flag == net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN) {
bit &= ~1;
} else if (flag == net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC) {
bit &= ~(1 << 1);
} else if (flag == net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG) {
bit &= ~(1 << 2);
} else {
logUnsupported(this, flag);
}
}
return bit;
}
}
/**
* A facet that listens to boss bar changes, using fake entities.
*
* @param <V> a viewer type
* @param <P> a position type
* @since 4.0.0
*/
interface BossBarEntity<V, P> extends BossBar<V>, FakeEntity<V, P> {
int OFFSET_PITCH = 30;
int OFFSET_YAW = 0;
int OFFSET_MAGNITUDE = 40;
int INVULNERABLE_KEY = 20;
int INVULNERABLE_TICKS = 890;
@Override
default void bossBarProgressChanged(final net.kyori.adventure.bossbar.@NotNull BossBar bar, final float oldProgress, final float newProgress) {
this.health(newProgress);
}
@Override
default void bossBarNameChanged(final net.kyori.adventure.bossbar.@NotNull BossBar bar, final @NotNull Component oldName, final @NotNull Component newName) {
this.name(newName);
}
@Override
default void addViewer(final @NotNull V viewer) {
this.teleport(viewer, this.createPosition(viewer));
}
@Override
default void removeViewer(final @NotNull V viewer) {
this.teleport(viewer, null);
}
}
/**
* A facet for spawning client-side entities.
*
* @param <V> a viewer type
* @param <P> a position type
* @since 4.0.0
*/
interface FakeEntity<V, P> extends Position<V, P>, Closeable {
/**
* Teleports the entity for a viewer.
*
* @param viewer a viewer
* @param position an entity position or {@code null} to remove
* @since 4.0.0
*/
void teleport(final @NotNull V viewer, final @Nullable P position);
/**
* Sets the entity metadata.
*
* @param position a metadata position
* @param data a value
* @since 4.0.0
*/
void metadata(final int position, final @NotNull Object data);
/**
* Sets the entity visibility.
*
* @param invisible if invisible
* @since 4.0.0
*/
void invisible(final boolean invisible);
/**
* Sets the entity health.
*
* @param health health level, between 0 and 1
* @since 4.0.0
*/
void health(final float health);
/**
* Sets the entity name.
*
* @param name a name
* @since 4.0.0
*/
void name(final @NotNull Component name);
/**
* Remove the entity for all viewers.
*
* @since 4.0.0
*/
@Override
void close();
}
/**
* Methods for working with the player tab list.
*
* @param <V> viewer
* @param <M> message type
* @since 4.0.0
*/
interface TabList<V, M> extends Message<V, M> {
/**
* Update the tab list header and footer.
*
* @param viewer receiving the tab list update
* @param header header, null if should be left unchanged
* @param footer footer, null if should be left unchanged
* @since 4.0.0
*/
void send(final V viewer, final @Nullable M header, final @Nullable M footer);
}
/**
* Methods for building pointers.
*
* <p>Unlike other {@code Facet}s, pointer facets will stack, so <em>all</em> facets
* applicable to a particular viewer will be applied.</p>
*
* @param <V> the viewer type
* @since 4.0.0
*/
interface Pointers<V> extends Facet<V> {
/**
* Contribute pointers to the builder for a certain viewer.
*
* @param viewer the viewer
* @param builder the builder
* @since 4.0.0
*/
void contributePointers(final V viewer, final net.kyori.adventure.pointer.Pointers.Builder builder);
}
}