Skip to content

Commit a96131d

Browse files
authored
Merge pull request CommandAPI#670 from CommandAPI/release/11.0.0
Release/11.0.0
2 parents 60929d3 + 90deef4 commit a96131d

File tree

405 files changed

+14972
-5670
lines changed

Some content is hidden

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

405 files changed

+14972
-5670
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ indent_style = space
1212

1313
[commandapi-documentation-velocity-code/**{.java,.kt}]
1414
indent_style = space
15+
16+
[commandapi-platforms/commandapi-paper/commandapi-paper-documentation-code/**{.java,.kt}]
17+
indent_style = space
18+
19+
[commandapi-platforms/commandapi-spigot/commandapi-spigot-documentation-code/**{.java,.kt}]
20+
indent_style = space

.github/workflows/build.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
5050
### Compilation ###
5151

52+
- name: Setup Paper NMS for all applicable versions
53+
run: ./setupPaperNMS.sh
54+
5255
- name: Build the CommandAPI (Bukkit+Velocity) using maven
5356
run: mvn clean install --batch-mode -P Platform.Bukkit,Platform.Velocity
5457

@@ -78,6 +81,12 @@ jobs:
7881
- name: Compile NMS_Common for 1.21.5
7982
run: mvn clean package -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -pl :commandapi-bukkit-nms-common -am -P Platform.Bukkit,Spigot_1_21_R4
8083

84+
- name: Compile NMS_Common for 1.21.6 and 1.21.7 and 1.21.8
85+
run: mvn clean package -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -pl :commandapi-bukkit-nms-common -am -P Platform.Bukkit,Spigot_1_21_R5
86+
87+
- name: Compile NMS_Common for 1.21.9
88+
run: mvn clean package -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -pl :commandapi-bukkit-nms-common -am -P Platform.Bukkit,Spigot_1_21_R6
89+
8190
- name: Copy BytecodeAnalyser to nms-common target folder
8291
run: mv BytecodeAnalyser/build/libs/BytecodeAnalyser*.jar commandapi-platforms/commandapi-bukkit/commandapi-bukkit-nms/commandapi-bukkit-nms-common/target
8392

@@ -140,15 +149,25 @@ jobs:
140149

141150
### Upload .jar artifacts ###
142151

143-
- name: Upload CommandAPI (Bukkit) plugin artifact
152+
- name: Upload CommandAPI (Spigot) plugin artifact
144153
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
145154
uses: actions/upload-artifact@v4
146155
with:
147-
name: CommandAPI (Bukkit plugin)
156+
name: CommandAPI (Spigot plugin)
148157
path: |
149-
commandapi-platforms/commandapi-bukkit/commandapi-bukkit-plugin/target/CommandAPI*.jar
150-
!commandapi-platforms/commandapi-bukkit/commandapi-bukkit-plugin/target/*sources.jar
151-
!commandapi-platforms/commandapi-bukkit/commandapi-bukkit-plugin/target/*javadoc.jar
158+
commandapi-platforms/commandapi-spigot/commandapi-spigot-plugin/target/CommandAPI*.jar
159+
!commandapi-platforms/commandapi-spigot/commandapi-spigot-plugin/target/*sources.jar
160+
!commandapi-platforms/commandapi-spigot/commandapi-spigot-plugin/target/*javadoc.jar
161+
162+
- name: Upload CommandAPI (Paper) plugin artifact
163+
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: CommandAPI (Paper plugin)
167+
path: |
168+
commandapi-platforms/commandapi-paper/commandapi-paper-plugin/target/CommandAPI*.jar
169+
!commandapi-platforms/commandapi-paper/commandapi-paper-plugin/target/*sources.jar
170+
!commandapi-platforms/commandapi-paper/commandapi-paper-plugin/target/*javadoc.jar
152171
153172
- name: Upload CommandAPI (Velocity) plugin artifact
154173
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS

.github/workflows/sonar.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ jobs:
8888
restore-keys: ${{ runner.os }}-m2
8989

9090
# Apply SonarCloud
91+
- name: Setup Paper NMS for all applicable versions
92+
run: ./setupPaperNMS.sh
9193
- name: SonarCloud Analyze
9294
run: mvn -B test-compile org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=JorelAli_CommandAPI -P Platform.Bukkit,Platform.Velocity -Dmaven.javadoc.skip=true
9395
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ docssrc/src/.markdownlint-cli2.yaml
1616
.gradle
1717
*.versionsBackup
1818
dependency-reduced-pom.xml
19+
.paper-nms

README.md

Lines changed: 100 additions & 43 deletions
Large diffs are not rendered by default.

commandapi-annotations/pom.xml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
<parent>
1919
<groupId>dev.jorel</groupId>
2020
<artifactId>commandapi</artifactId>
21-
<version>10.1.2</version>
21+
<version>11.0.0</version>
2222
</parent>
2323

2424
<artifactId>commandapi-annotations</artifactId>
25-
<name>CommandAPI - Annotations Library</name>
25+
<name>Annotations Library</name>
2626

2727
<repositories>
2828
<repository>
29-
<id>spigot-repo</id>
30-
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
29+
<id>codemc-repo</id>
30+
<url>https://repo.codemc.io/repository/nms/</url>
3131
</repository>
3232
</repositories>
3333

@@ -36,6 +36,7 @@
3636
<groupId>dev.jorel</groupId>
3737
<artifactId>commandapi-bukkit-core</artifactId>
3838
<version>${project.version}</version>
39+
<scope>provided</scope> <!-- Platform specific annotation modules implement their platform themselves -->
3940
</dependency>
4041
<dependency>
4142
<groupId>com.google.auto.service</groupId>
@@ -46,29 +47,9 @@
4647
<dependency>
4748
<groupId>org.spigotmc</groupId>
4849
<artifactId>spigot-api</artifactId>
49-
<version>${paper.version}</version>
50+
<version>${spigot.api.version.common}</version>
5051
<scope>provided</scope>
5152
</dependency>
5253
</dependencies>
53-
<build>
54-
<plugins>
55-
<plugin>
56-
<groupId>org.apache.maven.plugins</groupId>
57-
<artifactId>maven-compiler-plugin</artifactId>
58-
<executions>
59-
<execution>
60-
<goals>
61-
<goal>testCompile</goal>
62-
</goals>
63-
<configuration>
64-
<annotationProcessors>
65-
<annotationProcessor>dev.jorel.commandapi.annotations.Annotations</annotationProcessor>
66-
</annotationProcessors>
67-
</configuration>
68-
</execution>
69-
</executions>
70-
</plugin>
71-
</plugins>
72-
</build>
7354

7455
</project>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*******************************************************************************
2+
* Copyright 2018, 2020 Jorel Ali (Skepter) - MIT License
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
* this software and associated documentation files (the "Software"), to deal in
6+
* the Software without restriction, including without limitation the rights to
7+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8+
* the Software, and to permit persons to whom the Software is furnished to do so,
9+
* subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
*******************************************************************************/
21+
package dev.jorel.commandapi.annotations.arguments;
22+
23+
import dev.jorel.commandapi.arguments.DoubleRangeArgument;
24+
25+
import java.lang.annotation.ElementType;
26+
import java.lang.annotation.Retention;
27+
import java.lang.annotation.RetentionPolicy;
28+
import java.lang.annotation.Target;
29+
30+
/**
31+
* Annotation equivalent of the {@link DoubleRangeArgument}
32+
*/
33+
@Primitive("dev.jorel.commandapi.wrappers.DoubleRange")
34+
@Retention(RetentionPolicy.SOURCE)
35+
@Target(ElementType.PARAMETER)
36+
public @interface ADoubleRangeArgument {
37+
}

commandapi-codecov/pom.xml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,73 +14,70 @@
1414
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1515
DEALINGS IN THE SOFTWARE. -->
1616
<project xmlns="http://maven.apache.org/POM/4.0.0"
17-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
17+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
1919
<modelVersion>4.0.0</modelVersion>
2020
<parent>
2121
<groupId>dev.jorel</groupId>
2222
<artifactId>commandapi</artifactId>
23-
<version>10.0.0</version>
23+
<version>11.0.0</version>
2424
</parent>
2525

2626
<artifactId>commandapi-codecov</artifactId>
27+
<name>CommandAPI - Code Coverage Utility</name>
2728

2829
<properties>
2930
<maven.deploy.skip>true</maven.deploy.skip>
3031
</properties>
3132

3233
<dependencies>
34+
<!-- Modules to analyze -->
3335
<dependency>
3436
<groupId>dev.jorel</groupId>
3537
<artifactId>commandapi-core</artifactId>
3638
<version>${project.version}</version>
3739
</dependency>
40+
3841
<dependency>
3942
<groupId>dev.jorel</groupId>
4043
<artifactId>commandapi-bukkit-core</artifactId>
4144
<version>${project.version}</version>
4245
</dependency>
4346
<dependency>
4447
<groupId>dev.jorel</groupId>
45-
<artifactId>commandapi-plugin</artifactId>
48+
<artifactId>commandapi-spigot-core</artifactId>
4649
<version>${project.version}</version>
4750
</dependency>
4851
<dependency>
4952
<groupId>dev.jorel</groupId>
50-
<artifactId>commandapi-bukkit-plugin-common</artifactId>
53+
<artifactId>commandapi-paper-core</artifactId>
5154
<version>${project.version}</version>
5255
</dependency>
53-
54-
<!-- Code coverage the tests -->
55-
<dependency>
56+
57+
<!-- Include NMS tests -->
58+
<!-- <dependency>
5659
<groupId>dev.jorel</groupId>
5760
<artifactId>commandapi-bukkit-test-tests</artifactId>
5861
<version>${project.version}</version>
5962
<scope>test</scope>
60-
</dependency>
63+
</dependency> -->
64+
65+
<!-- Include test toolkit tests -->
66+
<!-- These should not have the test scope because they also have classes we want to analyze -->
6167
<dependency>
6268
<groupId>dev.jorel</groupId>
6369
<artifactId>commandapi-bukkit-test-toolkit</artifactId>
6470
<version>${project.version}</version>
65-
<!-- This should not have the test scope because it contains classes whose coverage we want to analyze -->
6671
</dependency>
67-
68-
<!-- From commandapi-bukkit-nms-dependency-mojang-mapped -->
69-
70-
<!-- Common NMS for 1.17+ -->
7172
<dependency>
7273
<groupId>dev.jorel</groupId>
73-
<artifactId>commandapi-bukkit-nms-common</artifactId>
74+
<artifactId>commandapi-spigot-test-toolkit</artifactId>
7475
<version>${project.version}</version>
75-
<classifier>mojang-mapped</classifier>
7676
</dependency>
77-
78-
<!-- NMS-specific implementations -->
7977
<dependency>
8078
<groupId>dev.jorel</groupId>
81-
<artifactId>commandapi-bukkit-1.20</artifactId>
79+
<artifactId>commandapi-paper-test-toolkit</artifactId>
8280
<version>${project.version}</version>
83-
<classifier>mojang-mapped</classifier>
8481
</dependency>
8582
</dependencies>
8683

commandapi-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
<parent>
2020
<artifactId>commandapi</artifactId>
2121
<groupId>dev.jorel</groupId>
22-
<version>10.1.2</version>
22+
<version>11.0.0</version>
2323
</parent>
2424
<modelVersion>4.0.0</modelVersion>
2525

2626
<artifactId>commandapi-core</artifactId>
27-
<name>CommandAPI - Core library</name>
27+
<name>Core library</name>
2828

2929
<repositories>
3030
<repository>

commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPI.java

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ public static void setLogger(CommandAPILogger logger) {
8080
* @return the CommandAPI's logger
8181
*/
8282
public static CommandAPILogger getLogger() {
83-
if (logger == null) {
84-
logger = CommandAPIHandler.getInstance().getPlatform().getLogger();
83+
if (logger != null) {
84+
// A custom logger was defined, use that
85+
return logger;
8586
}
86-
return logger;
87+
return CommandAPIHandler.getInstance().getPlatform().getLogger();
8788
}
8889

8990
// Loading, enabling, and disabling
@@ -109,28 +110,16 @@ public static void onLoad(CommandAPIConfig<?> config) {
109110
CommandAPI.config = new InternalConfig(config);
110111

111112
// Initialize handlers
112-
LoadContext loadContext = CommandAPIVersionHandler.getPlatform();
113+
LoadContext loadContext = CommandAPIVersionHandler.getPlatform(config);
113114
CommandAPIPlatform<?, ?, ?> platform = loadContext.platform();
114115
new CommandAPIHandler<>(platform);
115116
loadContext.context().run();
116117

117-
// Log platform load
118-
final String platformClassHierarchy;
119-
{
120-
List<String> platformClassHierarchyList = new ArrayList<>();
121-
Class<?> platformClass = platform.getClass();
122-
// Goes up through class inheritance only (ending at Object, but we don't want to include that)
123-
// CommandAPIPlatform is an interface, so it is not included
124-
while (platformClass != null && platformClass != Object.class) {
125-
platformClassHierarchyList.add(platformClass.getSimpleName());
126-
platformClass = platformClass.getSuperclass();
127-
}
128-
platformClassHierarchy = String.join(" > ", platformClassHierarchyList);
129-
}
130-
logNormal("Loaded platform " + platformClassHierarchy);
118+
// Load the platform
119+
CommandAPIHandler.getInstance().onLoad();
131120

132-
// Finish loading
133-
CommandAPIHandler.getInstance().onLoad(config);
121+
// Log platform load
122+
logNormal("Loaded platform " + getPlatformMessage(platform));
134123

135124
loaded = true;
136125
} else {
@@ -146,6 +135,18 @@ public static void onLoad(CommandAPIConfig<?> config) {
146135
}
147136
}
148137

138+
static String getPlatformMessage(Object platform) {
139+
List<String> platformClassHierarchyList = new ArrayList<>();
140+
Class<?> platformClass = platform.getClass();
141+
// Goes up through class inheritance only (ending at Object, but we don't want to include that)
142+
// CommandAPIPlatform is an interface, so it is not included
143+
while (platformClass != null && platformClass != Object.class) {
144+
platformClassHierarchyList.add(platformClass.getSimpleName());
145+
platformClass = platformClass.getSuperclass();
146+
}
147+
return String.join(" > ", platformClassHierarchyList);
148+
}
149+
149150
/**
150151
* Enables the CommandAPI. This should be placed at the start of your
151152
* <code>onEnable()</code> method.

0 commit comments

Comments
 (0)