Skip to content

Commit 0ac4740

Browse files
committed
Merge branch 'version/1.1.9' into feature/ping-markers
2 parents 23e1210 + 756ea70 commit 0ac4740

File tree

373 files changed

+18483
-1745
lines changed

Some content is hidden

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

373 files changed

+18483
-1745
lines changed

.checkstyle/suppressions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "http://checkstyle.org/dtds/suppressions_1_2.dtd">
33
<suppressions>
44
<!-- don't require javadocs on platform modules -->
5-
<suppress files="bukkit-example[\\/]src[\\/]main[\\/]java[\\/].*" checks="(FilteringWriteTag|MissingJavadoc.*)"/>
5+
<suppress files="bukkit-example-(api|json|proto|common)[\\/]src[\\/]main[\\/]java[\\/].*" checks="(FilteringWriteTag|MissingJavadoc.*)"/>
66

77
<!-- ignore illegal import in loader -->
88
<suppress files="extra[\\/]loader[\\/]src[\\/]main[\\/]java[\\/].*" checks="(IllegalImport)"/>

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body:
1010
- type: markdown
1111
attributes:
1212
value: |
13-
Thanks for taking the time to report this issue, if you want to request a feature join our [Discord](https://discord.gg/3T9Atyb6pf).
13+
Thanks for taking the time to report this issue, if you want to request a feature join our [Discord](https://lunarclient.dev/discord).
1414
1515
# Checklist
1616
- type: checkboxes
@@ -80,7 +80,8 @@ body:
8080
- 1.17
8181
- 1.18
8282
- 1.19
83-
- 1.20+
83+
- 1.20
84+
- 1.21
8485
validations:
8586
required: true
8687

@@ -93,6 +94,7 @@ body:
9394
multiple: true
9495
options:
9596
- Spigot / Bukkit
97+
- Folia
9698
- BungeeCord
9799
- Velocity
98100
- Other
@@ -114,7 +116,8 @@ body:
114116
- 1.17
115117
- 1.18
116118
- 1.19
117-
- 1.20+
119+
- 1.20
120+
- 1.21
118121
- Other/Not Listed
119122
validations:
120123
required: true
@@ -131,6 +134,8 @@ body:
131134
- "Optifine"
132135
- "Forge"
133136
- "Fabric"
137+
- "Vanilla"
138+
- "Other/Not Listed"
134139
validations:
135140
required: false
136141

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: ❓ Questions & Feature Request
4-
url: https://discord.gg/3T9Atyb6pf
4+
url: https://lunarclient.dev/discord
55
about: Join our Discord to ask questions and request features for Apollo.
66
- name: 📄 Documentation
77
url: https://lunarclient.dev/apollo/introduction

.github/workflows/deploy.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
- name: Configure Google Cloud credentials
1818
uses: google-github-actions/auth@v1
1919
with:
20-
workload_identity_provider: 'projects/271010089174/locations/global/workloadIdentityPools/github/providers/github-oidc'
21-
service_account: 'github-actions@moonsworth-299m4oir.iam.gserviceaccount.com'
20+
workload_identity_provider: 'projects/266324743316/locations/global/workloadIdentityPools/github/providers/github-oidc'
21+
service_account: 'github-actions@mw-lunarclient-maven-repo.iam.gserviceaccount.com'
2222

2323
- name: Setup Java
2424
uses: actions/setup-java@v3
@@ -65,3 +65,4 @@ jobs:
6565
bukkit/build/libs/apollo-bukkit-${{ env.VERSION }}.jar
6666
bungee/build/libs/apollo-bungee-${{ env.VERSION }}.jar
6767
velocity/build/libs/apollo-velocity-${{ env.VERSION }}.jar
68+
folia/build/libs/apollo-folia-${{ env.VERSION }}.jar

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Apollo
2-
![Build Status](https://img.shields.io/github/actions/workflow/status/LunarClient/Apollo/.github/workflows/deploy.yml)
3-
[![Discord](https://img.shields.io/discord/1080556677004271666?logo=discord&label=discord)](https://discord.gg/3T9Atyb6pf)
2+
[![Discord](https://img.shields.io/discord/1080556677004271666?logo=discord&label=discord)](https://lunarclient.dev/discord)
43

54
Apollo is a powerful tool that allows developers to create custom integrations with Lunar Client.
65

@@ -28,6 +27,7 @@ Running the following will compile the Apollo source for Java 8.
2827
The output jars can be found in the `build/libs` directory relative to each platform.
2928

3029
- Bukkit: `bukkit/plugin/build/libs`
30+
- Folia: `folia/build/libs`
3131
- BungeeCord: `bungee/build/libs`
3232
- Velocity: `velocity/build/libs`
3333

@@ -42,10 +42,10 @@ The Apollo project is split into several modules.
4242

4343
- **API** - The publicly available interface for developers wishing to create custom integrations with Lunar Client.
4444
- **Common** - The abstraction used by platform modules to reduce duplicate code and implement the protocol for Lunar Client.
45-
- **Bukkit, BungeeCord, Velocity** - Are modules that implement the common module for each respective platform.
45+
- **Bukkit, Folia, BungeeCord, Velocity** - Are modules that implement the common module for each respective platform.
4646

4747
Contributions can be made to Apollo by creating a pull request for improvements or fixes. For new feature ideas please consider making a
48-
suggestion by creating an [issue](https://github.com/LunarClient/Apollo/issues) or joining our [discord](https://discord.gg/3T9Atyb6pf).
48+
suggestion by creating an [issue](https://github.com/LunarClient/Apollo/issues) or joining our [discord](https://lunarclient.dev/discord).
4949

5050
## License
5151

api/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ setupPlatforms()
88
setupPlatformDependency("bukkit", "bukkitJar")
99
setupPlatformDependency("bungee", "bungeeJar")
1010
setupPlatformDependency("velocity", "velocityJar")
11+
setupPlatformDependency("folia", "foliaJar", 21)
1112

1213
val main by sourceSets
1314

@@ -25,6 +26,9 @@ dependencies {
2526

2627
"velocity"(main.output)
2728
"velocity"(libs.velocity)
29+
30+
"folia"(main.output)
31+
"folia"(libs.folia)
2832
}
2933

3034
publishShadowJar()
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/*
2+
* This file is part of Apollo, licensed under the MIT License.
3+
*
4+
* Copyright (c) 2023 Moonsworth
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package com.lunarclient.apollo;
25+
26+
import com.lunarclient.apollo.common.ApolloEntity;
27+
import com.lunarclient.apollo.common.location.ApolloBlockLocation;
28+
import com.lunarclient.apollo.common.location.ApolloLocation;
29+
import com.lunarclient.apollo.common.location.ApolloPlayerLocation;
30+
import com.lunarclient.apollo.player.ApolloPlayer;
31+
import com.lunarclient.apollo.player.ApolloPlayerManager;
32+
import com.lunarclient.apollo.recipients.Recipients;
33+
import java.util.Collection;
34+
import java.util.List;
35+
import java.util.Optional;
36+
import java.util.UUID;
37+
import java.util.function.Consumer;
38+
import java.util.stream.Collectors;
39+
import lombok.NonNull;
40+
import org.bukkit.Bukkit;
41+
import org.bukkit.Location;
42+
import org.bukkit.entity.Entity;
43+
import org.bukkit.entity.Player;
44+
45+
/**
46+
* Utility class for converting objects to and from their corresponding Bukkit
47+
* representations with additional helper methods for easier integration.
48+
*
49+
* @since 1.1.8
50+
*/
51+
public final class FoliaApollo {
52+
53+
/**
54+
* Runs a specified operation for a {@link Player}.
55+
*
56+
* @param player the player
57+
* @param playerConsumer the operation to be performed
58+
* @since 1.1.8
59+
*/
60+
public static void runForPlayer(@NonNull Player player, @NonNull Consumer<ApolloPlayer> playerConsumer) {
61+
runForPlayer(player.getUniqueId(), playerConsumer);
62+
}
63+
64+
/**
65+
* Runs a specified operation for a {@link ApolloPlayer} from the provided {@link UUID}.
66+
*
67+
* @param playerUuid the player
68+
* @param playerConsumer the operation to be performed
69+
* @since 1.1.8
70+
*/
71+
public static void runForPlayer(@NonNull UUID playerUuid, @NonNull Consumer<ApolloPlayer> playerConsumer) {
72+
Apollo.getPlayerManager().getPlayer(playerUuid).ifPresent(playerConsumer);
73+
}
74+
75+
/**
76+
* Converts a {@link Collection} of {@link Player}s to an {@link Recipients}.
77+
*
78+
* @param players the players
79+
* @return the recipients object containing the converted ApolloPlayer objects
80+
* @since 1.1.8
81+
*/
82+
public static Recipients getRecipientsFrom(@NonNull Collection<Player> players) {
83+
ApolloPlayerManager playerManager = Apollo.getPlayerManager();
84+
List<ApolloPlayer> apolloPlayers = players.stream()
85+
.map(player -> playerManager.getPlayer(player.getUniqueId()))
86+
.filter(Optional::isPresent)
87+
.map(Optional::get)
88+
.collect(Collectors.toList());
89+
90+
return Recipients.of(apolloPlayers);
91+
}
92+
93+
/**
94+
* Converts a {@link Location} to an {@link ApolloLocation} object.
95+
*
96+
* @param location the location
97+
* @return the converted apollo location object
98+
* @since 1.1.8
99+
*/
100+
public static ApolloLocation toApolloLocation(@NonNull Location location) {
101+
return ApolloLocation.builder()
102+
.world(location.getWorld().getName())
103+
.x(location.getX())
104+
.y(location.getY())
105+
.z(location.getZ())
106+
.build();
107+
}
108+
109+
/**
110+
* Converts a {@link Location} to an {@link ApolloBlockLocation} object.
111+
*
112+
* @param location the location
113+
* @return the converted apollo block location object
114+
* @since 1.1.8
115+
*/
116+
public static ApolloBlockLocation toApolloBlockLocation(@NonNull Location location) {
117+
return ApolloBlockLocation.builder()
118+
.world(location.getWorld().getName())
119+
.x(location.getBlockX())
120+
.y(location.getBlockY())
121+
.z(location.getBlockZ())
122+
.build();
123+
}
124+
125+
/**
126+
* Converts a {@link Location} to an {@link ApolloPlayerLocation} object.
127+
*
128+
* @param location the location
129+
* @return the converted apollo player location object
130+
* @since 1.1.8
131+
*/
132+
public static ApolloPlayerLocation toApolloPlayerLocation(@NonNull Location location) {
133+
return ApolloPlayerLocation.builder()
134+
.location(FoliaApollo.toApolloLocation(location))
135+
.yaw(location.getYaw())
136+
.pitch(location.getPitch())
137+
.build();
138+
}
139+
140+
/**
141+
* Converts a {@link Entity} to an {@link ApolloEntity} object.
142+
*
143+
* @param entity the entity
144+
* @return the converted apollo entity object
145+
* @since 1.1.8
146+
*/
147+
public static ApolloEntity toApolloEntity(@NonNull Entity entity) {
148+
return new ApolloEntity(entity.getEntityId(), entity.getUniqueId());
149+
}
150+
151+
/**
152+
* Converts a {@link ApolloLocation} to an {@link Location} object.
153+
*
154+
* @param location the apollo location
155+
* @return the converted location object
156+
* @since 1.1.8
157+
*/
158+
public static Location toBukkitLocation(@NonNull ApolloLocation location) {
159+
return new Location(
160+
Bukkit.getWorld(location.getWorld()),
161+
location.getX(),
162+
location.getY(),
163+
location.getZ()
164+
);
165+
}
166+
167+
/**
168+
* Converts a {@link ApolloBlockLocation} to an {@link Location} object.
169+
*
170+
* @param location the apollo block location
171+
* @return the converted location object
172+
* @since 1.1.8
173+
*/
174+
public static Location toBukkitLocation(@NonNull ApolloBlockLocation location) {
175+
return new Location(
176+
Bukkit.getWorld(location.getWorld()),
177+
location.getX(),
178+
location.getY(),
179+
location.getZ()
180+
);
181+
}
182+
183+
/**
184+
* Converts a {@link ApolloPlayerLocation} to an {@link Location} object.
185+
*
186+
* @param location the apollo location
187+
* @return the converted location object
188+
* @since 1.1.8
189+
*/
190+
public static Location toBukkitLocation(@NonNull ApolloPlayerLocation location) {
191+
ApolloLocation apolloLocation = location.getLocation();
192+
193+
return new Location(
194+
Bukkit.getWorld(apolloLocation.getWorld()),
195+
apolloLocation.getX(),
196+
apolloLocation.getY(),
197+
apolloLocation.getZ(),
198+
location.getYaw(),
199+
location.getPitch()
200+
);
201+
}
202+
203+
private FoliaApollo() {
204+
}
205+
206+
}

api/src/main/java/com/lunarclient/apollo/event/player/ApolloPlayerHandshakeEvent.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.lunarclient.apollo.client.version.LunarClientVersion;
2828
import com.lunarclient.apollo.client.version.MinecraftVersion;
2929
import com.lunarclient.apollo.event.Event;
30+
import com.lunarclient.apollo.module.tebex.TebexEmbeddedCheckoutSupport;
3031
import com.lunarclient.apollo.player.ApolloPlayer;
3132
import java.util.List;
3233
import lombok.Value;
@@ -71,4 +72,12 @@ public class ApolloPlayerHandshakeEvent implements Event {
7172
*/
7273
List<LunarClientMod> installedMods;
7374

75+
/**
76+
* The {@link TebexEmbeddedCheckoutSupport} type.
77+
*
78+
* @return the Tebex checkout support type
79+
* @since 1.1.6
80+
*/
81+
TebexEmbeddedCheckoutSupport tebexEmbeddedCheckoutSupport;
82+
7483
}

0 commit comments

Comments
 (0)