mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Refactor Project to Gradle (#3720)
Gradle is better than Maven, don't @ me. okay but actually it's [faster](https://www.youtube.com/watch?v=atuFSv2bLa8&feature=youtu.be&t=77), compiles and tests in parallel more efficiently, and more epic stuff).
This commit is contained in:
parent
82b466db0b
commit
9a23f806fe
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
|
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
|
||||||
<module name="SuppressionFilter">
|
<module name="SuppressionFilter">
|
||||||
<property name="file" value="${checkstyle.suppressions.file}"/>
|
<property name="file" value="${configDirectory}/suppressions.xml"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<!-- https://checkstyle.org/config_filters.html#SuppressWithPlainTextCommentFilter -->
|
<!-- https://checkstyle.org/config_filters.html#SuppressWithPlainTextCommentFilter -->
|
||||||
|
38
.github/workflows/build.yml
vendored
38
.github/workflows/build.yml
vendored
@ -11,28 +11,38 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Build and upload
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Git repo
|
- name: Checkout Git repo
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
- name: Restore Maven cache
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
fetch-depth: 0
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
- name: Restore Gradle cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-maven-
|
${{ runner.os }}-gradle-
|
||||||
- name: Set up JDK 1.8
|
- name: Set up JDK 1.8
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
- name: Build with Maven
|
- name: Build with Gradle
|
||||||
run: mvn package verify --file pom.xml
|
run: |
|
||||||
- name: Copy artifacts
|
chmod +x gradlew
|
||||||
run: mkdir -p ./out/ && cp -t ./out/ **/target/Essentials*.jar
|
./gradlew build --stacktrace
|
||||||
- uses: actions/upload-artifact@master
|
- name: Deploy with Gradle
|
||||||
|
if: ${{ success() && github.event_name == 'push' && github.repository == 'EssentialsX/Essentials' && github.ref == 'refs/head/2.x' }}
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_essxUsername: ${{ secrets.ESSENTIALSX_DEPLOY_USERNAME }}
|
||||||
|
ORG_GRADLE_PROJECT_essxPassword: ${{ secrets.ESSENTIALSX_DEPLOY_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
./gradlew publish
|
||||||
|
- name: Upload Artifacts
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
name: Plugin jars
|
name: EssentialsX plugin jars
|
||||||
path: out/
|
path: jars/
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -17,6 +17,9 @@
|
|||||||
/Essentials/usermap.csv
|
/Essentials/usermap.csv
|
||||||
|
|
||||||
# Build files
|
# Build files
|
||||||
target/
|
.gradle/
|
||||||
jars/
|
jars/
|
||||||
out/
|
out/
|
||||||
|
build/
|
||||||
|
target/
|
||||||
|
*.class
|
||||||
|
29
Essentials/build.gradle
Normal file
29
Essentials/build.gradle
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
dependencies {
|
||||||
|
compileOnly('com.github.milkbowl:VaultAPI:1.7') {
|
||||||
|
exclude group: "org.bukkit", module: "bukkit"
|
||||||
|
}
|
||||||
|
compileOnly 'net.luckperms:api:5.0'
|
||||||
|
|
||||||
|
api 'io.papermc:paperlib:1.0.6-SNAPSHOT'
|
||||||
|
|
||||||
|
// Providers
|
||||||
|
api project(':providers:BaseProviders')
|
||||||
|
api project(':providers:PaperProvider')
|
||||||
|
api(project(':providers:NMSReflectionProvider')) {
|
||||||
|
exclude group: "org.bukkit", module: "bukkit"
|
||||||
|
}
|
||||||
|
api(project(':providers:1_8Provider')) {
|
||||||
|
exclude group: "org.bukkit", module: "bukkit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
dependencies {
|
||||||
|
include (dependency('io.papermc:paperlib'))
|
||||||
|
include (project(':providers:BaseProviders'))
|
||||||
|
include (project(':providers:PaperProvider'))
|
||||||
|
include (project(':providers:NMSReflectionProvider'))
|
||||||
|
include (project(':providers:1_8Provider'))
|
||||||
|
}
|
||||||
|
relocate 'io.papermc.lib', 'com.earth2me.essentials.paperlib'
|
||||||
|
}
|
@ -1,118 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.ess3</groupId>
|
|
||||||
<artifactId>EssentialsXParent</artifactId>
|
|
||||||
<version>2.18.2</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>EssentialsX</artifactId>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>EssentialsX-${full.version}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.0</version>
|
|
||||||
<configuration>
|
|
||||||
<showDeprecation>false</showDeprecation>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.2.1</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
|
||||||
<relocations>
|
|
||||||
<relocation>
|
|
||||||
<pattern>io.papermc.lib</pattern>
|
|
||||||
<shadedPattern>com.earth2me.essentials.paperlib</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
</relocations>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.milkbowl</groupId>
|
|
||||||
<artifactId>VaultAPI</artifactId>
|
|
||||||
<version>1.7</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>bukkit</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.luckperms</groupId>
|
|
||||||
<artifactId>api</artifactId>
|
|
||||||
<version>5.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.papermc</groupId>
|
|
||||||
<artifactId>paperlib</artifactId>
|
|
||||||
<version>1.0.6-SNAPSHOT</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.ess3</groupId>
|
|
||||||
<artifactId>BaseProviders</artifactId>
|
|
||||||
<version>2.18.2</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.ess3</groupId>
|
|
||||||
<artifactId>NMSReflectionProvider</artifactId>
|
|
||||||
<version>2.18.2</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>bukkit</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.ess3</groupId>
|
|
||||||
<artifactId>PaperProvider</artifactId>
|
|
||||||
<version>2.18.2</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.destroystokyo.paper</groupId>
|
|
||||||
<artifactId>paper-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.ess3</groupId>
|
|
||||||
<artifactId>1_8Provider</artifactId>
|
|
||||||
<version>2.18.2</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>bukkit</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,6 +1,5 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import net.ess3.api.IEssentials;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.command.PluginCommandYamlParser;
|
import org.bukkit.command.PluginCommandYamlParser;
|
@ -134,6 +134,13 @@ public class AsyncTeleport implements IAsyncTeleport {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nowUnsafe(Location loc, TeleportCause cause, CompletableFuture<Boolean> future) {
|
||||||
|
final CompletableFuture<Boolean> paperFuture = PaperLib.teleportAsync(teleportOwner.getBase(), loc, cause);
|
||||||
|
paperFuture.thenAccept(future::complete);
|
||||||
|
paperFuture.exceptionally(future::completeExceptionally);
|
||||||
|
}
|
||||||
|
|
||||||
private void runOnMain(final Runnable runnable) throws ExecutionException, InterruptedException {
|
private void runOnMain(final Runnable runnable) throws ExecutionException, InterruptedException {
|
||||||
if (Bukkit.isPrimaryThread()) {
|
if (Bukkit.isPrimaryThread()) {
|
||||||
runnable.run();
|
runnable.run();
|
@ -40,7 +40,7 @@ public final class PlayerList {
|
|||||||
if (ess.getSettings().realNamesOnList() && !ChatColor.stripColor(user.getDisplayName()).equals(user.getName())) {
|
if (ess.getSettings().realNamesOnList() && !ChatColor.stripColor(user.getDisplayName()).equals(user.getName())) {
|
||||||
groupString.append(" (").append(user.getName()).append(")");
|
groupString.append(" (").append(user.getName()).append(")");
|
||||||
}
|
}
|
||||||
groupString.append("\u00a7f");
|
groupString.append(ChatColor.WHITE.toString());
|
||||||
}
|
}
|
||||||
return groupString.toString();
|
return groupString.toString();
|
||||||
}
|
}
|
@ -34,6 +34,15 @@ public interface IAsyncTeleport {
|
|||||||
*/
|
*/
|
||||||
void now(Player entity, boolean cooldown, PlayerTeleportEvent.TeleportCause cause, CompletableFuture<Boolean> future);
|
void now(Player entity, boolean cooldown, PlayerTeleportEvent.TeleportCause cause, CompletableFuture<Boolean> future);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to skip all safety checks while teleporting a player asynchronously.
|
||||||
|
*
|
||||||
|
* @param loc - Where should the player end up
|
||||||
|
* @param cause - The reported teleportPlayer cause
|
||||||
|
* @param future - Future which is completed with the success status of the execution
|
||||||
|
*/
|
||||||
|
void nowUnsafe(Location loc, PlayerTeleportEvent.TeleportCause cause, CompletableFuture<Boolean> future);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Teleport a player to a specific location
|
* Teleport a player to a specific location
|
||||||
*
|
*
|
@ -44,7 +44,7 @@ public interface IWarps extends IConf {
|
|||||||
* Delete a warp from the warp DB
|
* Delete a warp from the warp DB
|
||||||
*
|
*
|
||||||
* @param name - Name of warp
|
* @param name - Name of warp
|
||||||
* @throws Exception
|
* @throws Exception If the warp could not be removed
|
||||||
*/
|
*/
|
||||||
void removeWarp(String name) throws Exception;
|
void removeWarp(String name) throws Exception;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public interface IWarps extends IConf {
|
|||||||
*
|
*
|
||||||
* @param name - Name of warp
|
* @param name - Name of warp
|
||||||
* @param loc - Location of warp
|
* @param loc - Location of warp
|
||||||
* @throws Exception
|
* @throws Exception If the warp could not be set
|
||||||
*/
|
*/
|
||||||
void setWarp(String name, Location loc) throws Exception;
|
void setWarp(String name, Location loc) throws Exception;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public interface IWarps extends IConf {
|
|||||||
* @param user - User of warp
|
* @param user - User of warp
|
||||||
* @param name - Name of warp
|
* @param name - Name of warp
|
||||||
* @param loc - Location of warp
|
* @param loc - Location of warp
|
||||||
* @throws Exception
|
* @throws Exception If the warp could not be set
|
||||||
*/
|
*/
|
||||||
void setWarp(IUser user, String name, Location loc) throws Exception;
|
void setWarp(IUser user, String name, Location loc) throws Exception;
|
||||||
|
|
||||||
@ -71,14 +71,14 @@ public interface IWarps extends IConf {
|
|||||||
* Gets Lastowner UUID
|
* Gets Lastowner UUID
|
||||||
*
|
*
|
||||||
* @param warp - Name of warp
|
* @param warp - Name of warp
|
||||||
* @throws WarpNotFoundException
|
* @throws WarpNotFoundException If the warp is not found
|
||||||
*/
|
*/
|
||||||
UUID getLastOwner(String warp) throws WarpNotFoundException;
|
UUID getLastOwner(String warp) throws WarpNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if the file is empty
|
* Check to see if the file is empty
|
||||||
*
|
*
|
||||||
* @return
|
* @return Whether or not the file is empty
|
||||||
*/
|
*/
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user