Change the project structure to allow a dedicated API module to exist

This commit is contained in:
Christian Koop 2023-06-29 10:07:26 +02:00
parent 6e6bfe469d
commit 4d3c4fca17
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
63 changed files with 261 additions and 149 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@
## Maven
/**/target/
/dependency-reduced-pom.xml
/**/dependency-reduced-pom.xml
## Misc.
.DS_Store

68
EpicHoppers-API/pom.xml Normal file
View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>EpicHoppers-API</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<links>
<link>https://hub.spigotmc.org/javadocs/spigot/</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId>
<version>${craftaro.coreVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

159
EpicHoppers-Plugin/pom.xml Normal file
View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>EpicHoppers-Plugin</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${project.parent.name}-${project.version}</finalName>
<shadedArtifactAttached>false</shadedArtifactAttached>
<useDependencyReducedPomInJar>true</useDependencyReducedPomInJar>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>com.craftaro.core</pattern>
<shadedPattern>com.songoda.epichoppers.core</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
<exclude>LICENSE</exclude>
<exclude>LICENSE.**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.craftaro:CraftaroCore</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
</includes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>public</id>
<url>https://repo.songoda.com/repository/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-API</artifactId>
<version>3.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId>
<version>3.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.3.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>EpicFarming</artifactId>
<version>3.0.24</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.brcdev-minecraft</groupId>
<artifactId>shopgui-api</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Gypopo</groupId>
<artifactId>EconomyShopGUI-API</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>UltimateStacker</artifactId>
<version>2.1.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>wildstacker</artifactId>
<version>3.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.DeadSilenceIV</groupId>
<artifactId>AdvancedChestsAPI</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,6 +1,5 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;

View File

@ -30,6 +30,17 @@ public class TeleportHandler {
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, this::teleportRunner, 0, Settings.TELEPORT_TICKS.getLong());
}
public void tpEntity(Entity entity, Hopper hopper) {
if (hopper == null || !this.plugin.getHopperManager().isHopper(hopper.getLocation())) {
return;
}
Hopper lastHopper = this.getChain(hopper, 1);
if (!hopper.equals(lastHopper)) {
this.doTeleport(entity, lastHopper.getLocation());
}
}
private void teleportRunner() {
if (!this.plugin.getHopperManager().isReady()) {
return;
@ -71,17 +82,6 @@ public class TeleportHandler {
}
}
public void tpEntity(Entity entity, Hopper hopper) {
if (hopper == null || !this.plugin.getHopperManager().isHopper(hopper.getLocation())) {
return;
}
Hopper lastHopper = this.getChain(hopper, 1);
if (!hopper.equals(lastHopper)) {
this.doTeleport(entity, lastHopper.getLocation());
}
}
/**
* Recursively gets the next hopper in the linked hopper chain
*

View File

@ -1,5 +1,5 @@
name: ${project.name}
description: ${project.description}
name: ${project.parent.name}
description: ${project.parent.description}
version: ${project.version}
api-version: 1.13
@ -26,7 +26,7 @@ softdepend:
- WorldGuard
author: Craftaro
website: ${project.url}
website: ${project.parent.url}
commands:
eh:

152
pom.xml
View File

@ -4,20 +4,32 @@
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>
<groupId>com.songoda</groupId>
<artifactId>EpicHoppers</artifactId>
<version>4.7.9</version>
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<packaging>pom</packaging>
<version>3.0.0-SNAPSHOT</version>
<!-- Run 'mvn versions:set -DgenerateBackupPoms=false -DnewVersion=X.Y.Z-DEV' to update version recursively -->
<modules>
<module>EpicHoppers-API</module>
<module>EpicHoppers-Plugin</module>
</modules>
<name>EpicHoppers</name>
<description>Connect hoppers over long distances, filter out unwanted items, auto break blocks, auto sell items and much more.</description>
<url>https://craftaro.com/marketplace/product/15</url>
<properties>
<craftaro.coreVersion>3.0.0-SNAPSHOT</craftaro.coreVersion>
<maven.compiler.release>8</maven.compiler.release>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
</properties>
<issueManagement>
@ -30,67 +42,6 @@
<connection>scm:git:git://github.com/craftaro/EpicHoppers.git</connection>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${project.name}-${project.version}</finalName>
<shadedArtifactAttached>false</shadedArtifactAttached>
<useDependencyReducedPomInJar>true</useDependencyReducedPomInJar>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>com.craftaro.core</pattern>
<shadedPattern>com.songoda.epichoppers.core</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
<exclude>LICENSE</exclude>
<exclude>LICENSE.**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.craftaro:CraftaroCore</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
</includes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>craftaro-minecraft-plugins</id>
@ -101,79 +52,14 @@
<id>SpigotMC</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>public</id>
<url>https://repo.songoda.com/repository/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io/</url>
</repository>
</repositories>
<dependencies>
<!-- Dev dependencies -->
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId>
<version>3.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.3.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>EpicFarming</artifactId>
<version>3.0.24</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.brcdev-minecraft</groupId>
<artifactId>shopgui-api</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Gypopo</groupId>
<artifactId>EconomyShopGUI-API</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>UltimateStacker</artifactId>
<version>2.1.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>wildstacker</artifactId>
<version>3.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.DeadSilenceIV</groupId>
<artifactId>AdvancedChestsAPI</artifactId>
<version>2.2</version>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>24.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>