Skip to content

Commit 9dc9aec

Browse files
ItsNatureGolfing7
andauthored
Version - 1.2.0 (#230)
* Deploy as 1.2.0-SNAPSHOT * Update adventure version (#232) * Minestom Support (#231) * apollo minestom implementation * minestom markdown docs * publish minestom jar * update javadoc version tags to 1.2.0 * Implement Minestom user metadata * implement minestom properties & finish docs * send the apollo version in the start server request * add minestom to the download page * remove unused imports * fix update required version logic * Remove gradle publish for the minestom branch * Add command properties * Convert client brands & mods metadata to be a count-based system (#233) * Bump to 1.2.0 (#235) --------- Co-authored-by: Golfing7 <[email protected]>
1 parent d6302a7 commit 9dc9aec

File tree

76 files changed

+2454
-607
lines changed

Some content is hidden

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

76 files changed

+2454
-607
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="example[\\/]bukkit[\\/](api|json|proto|common)[\\/]src[\\/]main[\\/]java[\\/].*" checks="(FilteringWriteTag|MissingJavadoc.*)"/>
5+
<suppress files="example[\\/](bukkit|minestom)[\\/](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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ body:
9595
options:
9696
- Spigot / Bukkit
9797
- Folia
98+
- Minestom
9899
- BungeeCord
99100
- Velocity
100101
- Other

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,4 @@ jobs:
6666
bungee/build/libs/apollo-bungee-${{ env.VERSION }}.jar
6767
velocity/build/libs/apollo-velocity-${{ env.VERSION }}.jar
6868
folia/build/libs/apollo-folia-${{ env.VERSION }}.jar
69+
minestom/build/libs/apollo-minestom-${{ env.VERSION }}.jar

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The output jars can be found in the `build/libs` directory relative to each plat
2828

2929
- Bukkit: `bukkit/plugin/build/libs`
3030
- Folia: `folia/build/libs`
31+
- Minestom: `minestom/build/libs`
3132
- BungeeCord: `bungee/build/libs`
3233
- Velocity: `velocity/build/libs`
3334

@@ -42,7 +43,7 @@ The Apollo project is split into several modules.
4243

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

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

api/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ setupPlatformDependency("bukkit", "bukkitJar")
99
setupPlatformDependency("bungee", "bungeeJar")
1010
setupPlatformDependency("velocity", "velocityJar", 17)
1111
setupPlatformDependency("folia", "foliaJar", 21)
12+
setupPlatformDependency("minestom", "minestomJar", 21)
1213

1314
val main by sourceSets
1415

@@ -29,6 +30,9 @@ dependencies {
2930

3031
"folia"(main.output)
3132
"folia"(libs.folia)
33+
34+
"minestom"(main.output)
35+
"minestom"(libs.minestom)
3236
}
3337

3438
publishShadowJar()

api/src/main/java/com/lunarclient/apollo/ApolloPlatform.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ public interface ApolloPlatform {
4444
*/
4545
Kind getKind();
4646

47+
/**
48+
* Returns the platform type.
49+
*
50+
* @return the platform type
51+
* @since 1.2.0
52+
*/
53+
Platform getPlatform();
54+
4755
/**
4856
* Returns the platform options that don't belong to a specific module.
4957
*
@@ -93,4 +101,18 @@ enum Kind {
93101
SERVER,
94102
PROXY
95103
}
104+
105+
/**
106+
* Represents the platform type.
107+
*
108+
* @since 1.2.0
109+
*/
110+
enum Platform {
111+
BUKKIT,
112+
FOLIA,
113+
MINESTOM,
114+
BUNGEE,
115+
VELOCITY
116+
}
117+
96118
}

api/src/main/java/com/lunarclient/apollo/stats/ApolloStats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public interface ApolloStats {
6868
List<ApolloPluginDescription> getPlugins();
6969

7070
/**
71-
* Gets the servers platform subtype (Bukkit, BungeeCord, Velocity...).
71+
* Gets the servers platform subtype (Bukkit, Folia, Minestom, BungeeCord, Velocity...).
7272
*
7373
* @return the servers platform subtype
7474
* @since 1.0.0
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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.player.ApolloPlayer;
28+
import com.lunarclient.apollo.player.ApolloPlayerManager;
29+
import com.lunarclient.apollo.recipients.Recipients;
30+
import java.util.Collection;
31+
import java.util.List;
32+
import java.util.Optional;
33+
import java.util.UUID;
34+
import java.util.function.Consumer;
35+
import java.util.stream.Collectors;
36+
import lombok.NonNull;
37+
import net.minestom.server.entity.Entity;
38+
import net.minestom.server.entity.Player;
39+
40+
/**
41+
* Utility class for converting objects to and from their corresponding Minestom
42+
* representations with additional helper methods for easier integration.
43+
*
44+
* @since 1.2.0
45+
*/
46+
public final class MinestomApollo {
47+
48+
/**
49+
* Runs a specified operation for a {@link Player}.
50+
*
51+
* @param player the player
52+
* @param playerConsumer the operation to be performed
53+
* @since 1.2.0
54+
*/
55+
public static void runForPlayer(@NonNull Player player, @NonNull Consumer<ApolloPlayer> playerConsumer) {
56+
runForPlayer(player.getUuid(), playerConsumer);
57+
}
58+
59+
/**
60+
* Runs a specified operation for a {@link ApolloPlayer} from the provided {@link UUID}.
61+
*
62+
* @param playerUuid the player
63+
* @param playerConsumer the operation to be performed
64+
* @since 1.2.0
65+
*/
66+
public static void runForPlayer(@NonNull UUID playerUuid, @NonNull Consumer<ApolloPlayer> playerConsumer) {
67+
Apollo.getPlayerManager().getPlayer(playerUuid).ifPresent(playerConsumer);
68+
}
69+
70+
/**
71+
* Converts a {@link Collection} of {@link Player}s to an {@link Recipients}.
72+
*
73+
* @param players the players
74+
* @return the recipients object containing the converted ApolloPlayer objects
75+
* @since 1.2.0
76+
*/
77+
public static Recipients getRecipientsFrom(@NonNull Collection<Player> players) {
78+
ApolloPlayerManager playerManager = Apollo.getPlayerManager();
79+
List<ApolloPlayer> apolloPlayers = players.stream()
80+
.map(player -> playerManager.getPlayer(player.getUuid()))
81+
.filter(Optional::isPresent)
82+
.map(Optional::get)
83+
.collect(Collectors.toList());
84+
85+
return Recipients.of(apolloPlayers);
86+
}
87+
88+
/**
89+
* Converts a {@link Entity} to an {@link ApolloEntity} object.
90+
*
91+
* @param entity the entity
92+
* @return the converted apollo entity object
93+
* @since 1.2.0
94+
*/
95+
public static ApolloEntity toApolloEntity(@NonNull Entity entity) {
96+
return new ApolloEntity(entity.getEntityId(), entity.getUuid());
97+
}
98+
99+
private MinestomApollo() {
100+
}
101+
102+
}

build-logic/src/main/kotlin/extensions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ fun Project.setupPlatforms() {
4343
tasks.named("javadoc", Javadoc::class) {
4444
source(sourceSets.map { it.allJava })
4545
classpath += sourceSets.map { it.compileClasspath }.reduce { first, second -> first + second }
46+
47+
val javaToolchains = project.extensions.getByType(JavaToolchainService::class.java)
48+
javadocTool.set(javaToolchains.javadocToolFor {
49+
languageVersion.set(JavaLanguageVersion.of(21))
50+
})
4651
}
4752
}
4853
}

bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
*/
2424
package com.lunarclient.apollo;
2525

26-
import com.lunarclient.apollo.command.impl.ApolloCommand;
27-
import com.lunarclient.apollo.command.impl.LunarClientCommand;
26+
import com.lunarclient.apollo.command.BukkitApolloCommand;
27+
import com.lunarclient.apollo.command.BukkitLunarClientCommand;
2828
import com.lunarclient.apollo.listener.ApolloMetadataListener;
2929
import com.lunarclient.apollo.listener.ApolloPlayerListener;
3030
import com.lunarclient.apollo.listener.ApolloWorldListener;
@@ -174,8 +174,8 @@ public void onEnable() {
174174
(channel, player, bytes) -> ApolloManager.getNetworkManager().receivePacket(player.getUniqueId(), bytes)
175175
);
176176

177-
this.plugin.getCommand("apollo").setExecutor(new ApolloCommand());
178-
this.plugin.getCommand("lunarclient").setExecutor(new LunarClientCommand());
177+
this.plugin.getCommand("apollo").setExecutor(new BukkitApolloCommand());
178+
this.plugin.getCommand("lunarclient").setExecutor(new BukkitLunarClientCommand());
179179

180180
ApolloManager.getStatsManager().enable();
181181
ApolloManager.getVersionManager().checkForUpdates();
@@ -195,6 +195,11 @@ public Kind getKind() {
195195
return Kind.SERVER;
196196
}
197197

198+
@Override
199+
public Platform getPlatform() {
200+
return Platform.BUKKIT;
201+
}
202+
198203
@Override
199204
public String getApolloVersion() {
200205
return this.plugin.getDescription().getVersion();

0 commit comments

Comments
 (0)