Skip to content

Commit e84000a

Browse files
committed
Maven Aggregate Project
# Maven Aggregate Project This project has been converted into an aggregator Maven project with submodules. This change was necessary to implement the new API classes mentioned below. # XInventoryView & XArt Introducing **XInventoryView.of(InventoryView)** & **XArt.of(Art)** which allows you to use Bukkit's **InventoryView** and **Art** classes respectively in a cross-version compatible way. Bukkit changed their API from abstract/enum classes to interfaces for these classes. Although this might not appear to cause any issues at first, plugins compiled for non-interface vs interface have a different underlying bytecode which can cause runtime errors depending on which version the plugin was compiled against. These two classes add a minimal zero-overhead wrapper that handles this issue.
1 parent d26cb6b commit e84000a

File tree

190 files changed

+1498
-376
lines changed

Some content is hidden

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

190 files changed

+1498
-376
lines changed

.github/workflows/maven-publish.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Maven Package
55

66
on:
77
release:
8-
types: [created]
8+
types: [ created ]
99

1010
jobs:
1111
build:
@@ -16,19 +16,19 @@ jobs:
1616
packages: write
1717

1818
steps:
19-
- uses: actions/checkout@v4
20-
- name: Set up JDK 21
21-
uses: actions/setup-java@v4
22-
with:
23-
java-version: '21'
24-
distribution: 'temurin'
25-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26-
settings-path: ${{ github.workspace }} # location for the settings.xml file
19+
- uses: actions/checkout@v4
20+
- name: Set up JDK 21
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '21'
24+
distribution: 'temurin'
25+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26+
settings-path: ${{ github.workspace }} # location for the settings.xml file
2727

28-
- name: Build with Maven
29-
run: mvn -B package --file pom.xml
28+
- name: Build with Maven
29+
run: mvn -B package --file pom.xml
3030

31-
- name: Publish to GitHub Packages Apache Maven
32-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
33-
env:
34-
GITHUB_TOKEN: ${{ github.token }}
31+
- name: Publish to GitHub Packages Apache Maven
32+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}

CONTRIBUTING.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,28 @@ if it's unrelated to adding support for that version since your changes are like
1616

1717
### Usage
1818

19-
This project uses Maven. So you'll have to use `mvn` commands.
19+
This project uses a Maven aggregator project. So you'll have to use **mvn** commands.
2020
In IntelliJ, you can press `Ctrl` twice for the command window to popup.
2121
To compile the library into `target` folder, you can use this Maven command:
2222

2323
```maven
24-
mvn package
24+
mvn clean package -pl core -am
2525
```
2626

27+
> [!NOTE]
28+
> Since this is a Maven aggregator project, there are a few more command arguments:
29+
> - **-pl core** also can be used as **--projects core**, means that we only want to `clean package` the `core`
30+
subproject, not all subproject.
31+
> - **-am** (also named **--also-make**) Builds all other subprojects, and any of their dependencies which are required
32+
for the `core` subproject.
33+
>
34+
> For more information about Maven aggregator projects,
35+
> visit [Apache Maven's Guide](https://maven.apache.org/guides/mini/guide-multiple-subprojects-4.html).
36+
2737
To test the library using the latest Spigot server, you can use:
2838

2939
```maven
30-
mvn clean package -Ptester,latest
40+
mvn clean test -Ptester,latest -pl core -am
3141
```
3242

3343
> [!NOTE]
@@ -70,6 +80,7 @@ I'd like to express my profound gratitude to the following people for really hel
7080
* @DeadSilenceIV: [XItemStack issues](https://github.com/CryptoMorin/XSeries/commits?author=DeadSilenceIV)
7181
* @AV3RG: [XTag](https://github.com/CryptoMorin/XSeries/commit/988fee3a0fc80697f99804ca7c13108976f26acd)
7282
* @SirLeezus: [XItemStack issues](https://github.com/CryptoMorin/XSeries/commits?author=SirLeezus)
73-
* @datatags: [ParticleDisplay revamp](https://github.com/CryptoMorin/XSeries/pull/265) and for responding to various issues and reporting them.
83+
* @datatags: [ParticleDisplay revamp](https://github.com/CryptoMorin/XSeries/pull/265) and for responding to various
84+
issues and reporting them.
7485

7586
I hope that I didn't forget anyone ;)

TODO.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,8 @@ developers can see and perhaps give suggestions about. Anyone is welcome to comp
8181

8282
* **[Documentation]** While the javadocs are pretty comprehensive for most classes, they're mostly flooded with small
8383
and technical details that most developers don't have to be concerned about. We should make a guide on the wiki with
84-
screenshots and a general overview of all the features which makes it much easier for developers to get started.
84+
screenshots and a general overview of all the features which makes it much easier for developers to get started.
85+
86+
* **[Mavne]** `[ERROR] MavenInvocationException: Error when invoking Maven, consult the invoker log file ...` when
87+
building the project. The log file simply says the dependencies couldn't be resolved? Seems to be related to Javadoc goal.
88+
Also `[ERROR] Error fetching link: XSeries/<project>/target/apidocs. Ignored it.` might be related to the previous error.

commons/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ The MIT License (MIT)
4+
~
5+
~ Copyright (c) 2025 Crypto Morin
6+
~
7+
~ Permission is hereby granted, free of charge, to any person obtaining a copy
8+
~ of this software and associated documentation files (the "Software"), to deal
9+
~ in the Software without restriction, including without limitation the rights
10+
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
~ copies of the Software, and to permit persons to whom the Software is
12+
~ furnished to do so, subject to the following conditions:
13+
~
14+
~ The above copyright notice and this permission notice shall be included in
15+
~ all copies or substantial portions of the Software.
16+
~
17+
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18+
~ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19+
~ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
20+
~ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
~ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
-->
23+
24+
<project xmlns="http://maven.apache.org/POM/4.0.0"
25+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
27+
<modelVersion>4.0.0</modelVersion>
28+
<parent>
29+
<groupId>com.github.cryptomorin</groupId>
30+
<artifactId>parent</artifactId>
31+
<version>${revision}</version>
32+
</parent>
33+
34+
<artifactId>commons</artifactId>
35+
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.spigotmc</groupId>
39+
<artifactId>spigot-api</artifactId>
40+
<version>1.21.4-R0.1-SNAPSHOT</version>
41+
<scope>provided</scope>
42+
</dependency>
43+
</dependencies>
44+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.cryptomorin.xseries.art;
2+
3+
import org.bukkit.Art;
4+
5+
public abstract class BukkitArt {
6+
public abstract int getBlockWidth();
7+
8+
public abstract int getBlockHeight();
9+
10+
public abstract String getKey();
11+
12+
public abstract int getId();
13+
14+
public abstract Art object();
15+
16+
@Override
17+
public int hashCode() {
18+
return object().hashCode();
19+
}
20+
21+
@Override
22+
public boolean equals(Object obj) {
23+
if (this == obj) return true;
24+
if (obj == null) return false;
25+
if (obj instanceof BukkitArt) return object().equals(((BukkitArt) obj).object());
26+
else return object().equals(obj);
27+
}
28+
29+
@Override
30+
public String toString() {
31+
return this.getClass().getSimpleName() + '(' + object().toString() + ')';
32+
}
33+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.cryptomorin.xseries.inventory;
2+
3+
import org.bukkit.entity.HumanEntity;
4+
import org.bukkit.event.inventory.InventoryType;
5+
import org.bukkit.inventory.Inventory;
6+
import org.bukkit.inventory.InventoryView;
7+
import org.bukkit.inventory.ItemStack;
8+
9+
public abstract class BukkitInventoryView {
10+
public abstract Inventory getTopInventory();
11+
12+
public abstract Inventory getBottomInventory();
13+
14+
public abstract HumanEntity getPlayer();
15+
16+
public abstract InventoryType getType();
17+
18+
public abstract void setItem(int slot, ItemStack item);
19+
20+
public abstract ItemStack getItem(int slot);
21+
22+
public abstract void setCursor(ItemStack item);
23+
24+
public abstract ItemStack getCursor();
25+
26+
public abstract int convertSlot(int slot);
27+
28+
public abstract void close();
29+
30+
public abstract int countSlots();
31+
32+
public abstract String getTitle();
33+
34+
public abstract InventoryView object();
35+
36+
@Override
37+
public int hashCode() {
38+
return object().hashCode();
39+
}
40+
41+
@Override
42+
public boolean equals(Object obj) {
43+
if (this == obj) return true;
44+
if (obj == null) return false;
45+
if (obj instanceof BukkitInventoryView) return object().equals(((BukkitInventoryView) obj).object());
46+
else return object().equals(obj);
47+
}
48+
49+
@Override
50+
public String toString() {
51+
return this.getClass().getSimpleName() + '(' + object().toString() + ')';
52+
}
53+
}

core/.flattened-pom.xml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ The MIT License (MIT)
4+
~
5+
~ Copyright (c) 2025 Crypto Morin
6+
~
7+
~ Permission is hereby granted, free of charge, to any person obtaining a copy
8+
~ of this software and associated documentation files (the "Software"), to deal
9+
~ in the Software without restriction, including without limitation the rights
10+
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
~ copies of the Software, and to permit persons to whom the Software is
12+
~ furnished to do so, subject to the following conditions:
13+
~
14+
~ The above copyright notice and this permission notice shall be included in
15+
~ all copies or substantial portions of the Software.
16+
~
17+
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18+
~ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19+
~ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
20+
~ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
~ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
-->
23+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
24+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
25+
<modelVersion>4.0.0</modelVersion>
26+
<groupId>com.github.cryptomorin</groupId>
27+
<artifactId>XSeries</artifactId>
28+
<version>13.0.0</version>
29+
<description>A set of utilities for Minecraft plugins</description>
30+
<url>https://www.spigotmc.org/threads/378136/XSeries/</url>
31+
<inceptionYear>2019</inceptionYear>
32+
<licenses>
33+
<license>
34+
<name>MIT License</name>
35+
<url>https://opensource.org/licenses/MIT</url>
36+
<distribution>repo</distribution>
37+
</license>
38+
</licenses>
39+
<developers>
40+
<developer>
41+
<id>CryptoMorin</id>
42+
<name>Crypto Morin</name>
43+
<roles>
44+
<role>Owner</role>
45+
</roles>
46+
</developer>
47+
</developers>
48+
<scm>
49+
<connection>scm:svn:http://svn.sonatype.org/spice/trunk/oss/oss-parenti-9/parent/XSeries</connection>
50+
<developerConnection>scm:svn:https://svn.sonatype.org/spice/trunk/oss/oss-parent-9/parent/XSeries</developerConnection>
51+
<url>http://svn.sonatype.org/spice/trunk/oss/oss-parent-9/parent/XSeries</url>
52+
</scm>
53+
<issueManagement>
54+
<system>GitHub Issues</system>
55+
<url>https://github.com/CryptoMorin/XSeries/issues</url>
56+
</issueManagement>
57+
<distributionManagement>
58+
<repository>
59+
<id>ossrh</id>
60+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
61+
</repository>
62+
<snapshotRepository>
63+
<id>ossrh</id>
64+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
65+
</snapshotRepository>
66+
</distributionManagement>
67+
<dependencies>
68+
<dependency>
69+
<groupId>com.github.cryptomorin</groupId>
70+
<artifactId>commons</artifactId>
71+
<version>13.0.0</version>
72+
<scope>compile</scope>
73+
</dependency>
74+
<dependency>
75+
<groupId>com.github.cryptomorin</groupId>
76+
<artifactId>new-bukkit</artifactId>
77+
<version>13.0.0</version>
78+
<scope>compile</scope>
79+
</dependency>
80+
<dependency>
81+
<groupId>com.github.cryptomorin</groupId>
82+
<artifactId>old-bukkit</artifactId>
83+
<version>13.0.0</version>
84+
<scope>compile</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>org.spigotmc</groupId>
88+
<artifactId>spigot</artifactId>
89+
<version>1.21.4-R0.1-SNAPSHOT</version>
90+
<scope>provided</scope>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.jetbrains</groupId>
94+
<artifactId>annotations</artifactId>
95+
<version>26.0.1</version>
96+
<scope>provided</scope>
97+
</dependency>
98+
<dependency>
99+
<groupId>org.ow2.asm</groupId>
100+
<artifactId>asm</artifactId>
101+
<version>9.7.1</version>
102+
<scope>provided</scope>
103+
</dependency>
104+
<dependency>
105+
<groupId>org.ow2.asm</groupId>
106+
<artifactId>asm-commons</artifactId>
107+
<version>9.7.1</version>
108+
<scope>provided</scope>
109+
</dependency>
110+
<dependency>
111+
<groupId>org.ow2.asm</groupId>
112+
<artifactId>asm-util</artifactId>
113+
<version>9.7.1</version>
114+
<scope>provided</scope>
115+
</dependency>
116+
</dependencies>
117+
<repositories>
118+
<repository>
119+
<id>nms-repo</id>
120+
<url>https://repo.codemc.org/repository/nms/</url>
121+
</repository>
122+
<repository>
123+
<id>minecraft-libraries</id>
124+
<name>Minecraft Libraries</name>
125+
<url>https://libraries.minecraft.net/</url>
126+
</repository>
127+
<repository>
128+
<releases>
129+
<enabled>false</enabled>
130+
</releases>
131+
<snapshots>
132+
<enabled>true</enabled>
133+
</snapshots>
134+
<id>sonatype-nexus-snapshots</id>
135+
<name>Sonatype Nexus Snapshots</name>
136+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
137+
</repository>
138+
</repositories>
139+
<build>
140+
<plugins>
141+
<plugin>
142+
<groupId>org.sonatype.plugins</groupId>
143+
<artifactId>nexus-staging-maven-plugin</artifactId>
144+
<version>1.7.0</version>
145+
<extensions>true</extensions>
146+
</plugin>
147+
</plugins>
148+
</build>
149+
</project>

0 commit comments

Comments
 (0)