Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
806543f
feat: Add first draft of Waypoint API
Privatech38 Feb 19, 2026
9966ab7
docs: add sinceMinecraft to class description
Privatech38 Feb 19, 2026
f5813eb
feat: add non null checks to setters
Privatech38 Feb 19, 2026
204dfea
feat: add methods for tracking, updating and untracking to the Audien…
Privatech38 Feb 20, 2026
cdfca6e
fix: Waypint arguments missing final attribute
Privatech38 Feb 20, 2026
aa69b8c
refactor: use polymorphism instead of generics
Privatech38 Feb 20, 2026
c01e0fb
refactor: remove generic
Privatech38 Feb 20, 2026
c557997
chore: apply spotless
Privatech38 Feb 20, 2026
53a5b07
fix: format and removed empty waypoint
Privatech38 Feb 20, 2026
4895f20
feat: Add empty waypoint
Privatech38 Feb 27, 2026
3d23c05
feat: add creation methods for empty waypoint
Privatech38 Mar 1, 2026
b9260fc
fix: style
Privatech38 Mar 1, 2026
2b6f040
feat: Add listeners
Privatech38 Feb 27, 2026
ceafbc1
feat: Add platform implementation
Privatech38 Mar 1, 2026
63d0065
docs: remove comment on listener about platform
Privatech38 Mar 1, 2026
22e581e
refactor: remove UUID and String options from waypoint methods and re…
Privatech38 Mar 1, 2026
7a564a0
feat: add methods to add and remove viewers to Waypoint
Privatech38 Mar 1, 2026
8a7c1e6
feat: change field value(s) and notify listeners only if the new and …
Privatech38 Apr 5, 2026
fc678ba
test: add tests for all waypoint variants
Privatech38 Apr 5, 2026
063f782
fix: spotless checks
Privatech38 Apr 5, 2026
c55dd37
feat(api): Fix SPI when using modules for Waypoint API. Related to Pa…
Privatech38 May 16, 2026
ecc12f3
fix(api): Import order fix
Privatech38 May 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
exports net.kyori.adventure.title;
exports net.kyori.adventure.translation;
exports net.kyori.adventure.util;
exports net.kyori.adventure.waypoint;

uses net.kyori.adventure.bossbar.BossBarImplementation.Provider;
uses net.kyori.adventure.internal.properties.AdventureProperties.DefaultOverrideProvider;
uses net.kyori.adventure.text.event.ClickCallback.Provider;
uses net.kyori.adventure.text.event.DataComponentValueConverterRegistry.Provider;
uses net.kyori.adventure.waypoint.WaypointImplementation.Provider;
}
36 changes: 36 additions & 0 deletions api/src/main/java/net/kyori/adventure/audience/Audience.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.title.Title;
import net.kyori.adventure.title.TitlePart;
import net.kyori.adventure.waypoint.Waypoint;

/**
* A receiver of Minecraft media.
Expand Down Expand Up @@ -720,4 +721,39 @@ default void showDialog(final DialogLike dialog) {
*/
default void closeDialog() {
}

// -------------------
// ---- Waypoints ----
// -------------------

/**
* Tracks a waypoint.
*
* @param waypoint a waypoint
* @since 5.1.0
* @sinceMinecraft 1.21.6
*/
default void trackWaypoint(final Waypoint waypoint) {
}

/**
* Updates a tracked waypoint.
*
* @param waypoint a waypoint
* @since 5.1.0
* @sinceMinecraft 1.21.6
*/
default void updateWaypoint(final Waypoint waypoint) {
}

/**
* Untracks a tracked waypoint.
*
* @param waypoint a waypoint
* @since 5.1.0
* @sinceMinecraft 1.21.6
*/
default void untrackWaypoint(final Waypoint waypoint) {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import net.kyori.adventure.sound.SoundStop;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.TitlePart;
import net.kyori.adventure.waypoint.Waypoint;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.UnknownNullability;
Expand Down Expand Up @@ -217,6 +218,21 @@ default void closeDialog() {
for (final Audience audience : this.audiences()) audience.closeDialog();
}

@Override
default void trackWaypoint(final Waypoint waypoint) {
for (final Audience audience : this.audiences()) audience.trackWaypoint(waypoint);
}

@Override
default void updateWaypoint(final Waypoint waypoint) {
for (final Audience audience : this.audiences()) audience.updateWaypoint(waypoint);
}

@Override
default void untrackWaypoint(final Waypoint waypoint) {
for (final Audience audience : this.audiences()) audience.untrackWaypoint(waypoint);
}

/**
* An audience that forwards everything to a single other audience.
*
Expand Down Expand Up @@ -389,5 +405,20 @@ default void showDialog(final DialogLike dialog) {
default void closeDialog() {
this.audience().closeDialog();
}

@Override
default void trackWaypoint(final Waypoint waypoint) {
this.audience().trackWaypoint(waypoint);
}

@Override
default void updateWaypoint(final Waypoint waypoint) {
this.audience().updateWaypoint(waypoint);
}

@Override
default void untrackWaypoint(final Waypoint waypoint) {
this.audience().untrackWaypoint(waypoint);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* This file is part of adventure, licensed under the MIT License.
*
* Copyright (c) 2017-2025 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.waypoint;

import org.jetbrains.annotations.Contract;

/**
* Represents an azimuth waypoint.
*
* @since 5.1.0
* @sinceMinecraft 1.21.6
*/
public sealed interface AzimuthWaypoint extends Waypoint permits AzimuthWaypointImpl {

/**
* Gets the angle.
*
* @return the angle
* @since 5.1.0
*/
float angle();

/**
* Sets the angle.
*
* @param angle the angle
* @return the waypoint
* @since 5.1.0
*/
@Contract("_ -> this")
AzimuthWaypoint angle(final float angle);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* This file is part of adventure, licensed under the MIT License.
*
* Copyright (c) 2017-2025 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.waypoint;

import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.format.TextColor;

final class AzimuthWaypointImpl extends WaypointImpl implements AzimuthWaypoint {

private float angle;

AzimuthWaypointImpl(final Key style, final TextColor color, final float angle) {
super(style, color);
this.angle = angle;
}

AzimuthWaypointImpl(final TextColor color, final float angle) {
super(color);
this.angle = angle;
}

@Override
public float angle() {
return this.angle;
}

@Override
public AzimuthWaypoint angle(final float angle) {
final float oldAngle = this.angle;
if (angle != oldAngle) {
this.angle = angle;
this.forEachListener(listener -> listener.waypointAngleChanged(this, oldAngle, angle));
}
return this;
}
}
63 changes: 63 additions & 0 deletions api/src/main/java/net/kyori/adventure/waypoint/ChunkWaypoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* This file is part of adventure, licensed under the MIT License.
*
* Copyright (c) 2017-2025 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.waypoint;

import org.jetbrains.annotations.Contract;

/**
* Represents a chunk waypoint.
*
* @since 5.1.0
* @sinceMinecraft 1.21.6
*/
public sealed interface ChunkWaypoint extends Waypoint permits ChunkWaypointImpl {

/**
* Gets the X coordinate.
*
* @return the X coordinate
* @since 5.1.0
*/
int x();

/**
* Gets the Z coordinate.
*
* @return the Z coordinate
* @since 5.1.0
*/
int z();

/**
* Sets the X and Z coordinate.
*
* @param x the X coordinate
* @param z the Z coordinate
* @return the waypoint
* @since 5.1.0
*/
@Contract("_, _ -> this")
ChunkWaypoint pos(final int x, final int z);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* This file is part of adventure, licensed under the MIT License.
*
* Copyright (c) 2017-2025 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.waypoint;

import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.format.TextColor;

final class ChunkWaypointImpl extends WaypointImpl implements ChunkWaypoint {

private int x;
private int z;

ChunkWaypointImpl(final Key style, final TextColor color, final int x, final int z) {
super(style, color);
this.x = x;
this.z = z;
}

ChunkWaypointImpl(final TextColor color, final int x, final int z) {
super(color);
this.x = x;
this.z = z;
}

@Override
public int x() {
return this.x;
}

@Override
public int z() {
return this.z;
}

@Override
public ChunkWaypoint pos(final int x, final int z) {
final int oldX = this.x;
final int oldZ = this.z;
if (x != oldX || z != oldZ) {
this.x = x;
this.z = z;
this.forEachListener(listener -> listener.waypointChunkPositionChanged(this, oldX, oldZ, x, z));
}
return this;
}

}
33 changes: 33 additions & 0 deletions api/src/main/java/net/kyori/adventure/waypoint/EmptyWaypoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of adventure, licensed under the MIT License.
*
* Copyright (c) 2017-2025 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.waypoint;

/**
* Represents an empty waypoint.
*
* @since 5.1.0
* @sinceMinecraft 1.21.6
*/
public sealed interface EmptyWaypoint extends Waypoint permits EmptyWaypointImpl {
}
Loading
Loading