<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>xyz.xenondevs.nova</groupId>
        <artifactId>Nova-Parent</artifactId>
        <version>0.9.6</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>Nova</artifactId>

    <properties>
        <particlelib.version>1.8</particlelib.version>
        <fuzzywuzzy.version>1.4.0</fuzzywuzzy.version>
        <zip4j.version>2.11.1</zip4j.version>
        <annotations.version>23.0.0</annotations.version>
        <invui.version>0.7-SNAPSHOT</invui.version>
        <ktor.version>2.0.2</ktor.version>
        <maven-resolver-provider.version>3.8.5</maven-resolver-provider.version>
        <maven-resolver-connector-basic.version>1.8.0</maven-resolver-connector-basic.version>
        <maven-resolver-transport-http.version>1.8.0</maven-resolver-transport-http.version>
    </properties>

    <pluginRepositories>
        <pluginRepository>
            <id>xenondevs</id>
            <url>https://repo.xenondevs.xyz/releases</url>
        </pluginRepository>
    </pluginRepositories>

    <repositories>
        <repository>
            <id>xenondevs</id>
            <url>https://repo.xenondevs.xyz/releases</url>
        </repository>
        <repository>
            <id>xenondevs-third-party</id>
            <url>https://repo.xenondevs.xyz/third-party-releases</url>
        </repository>
        <repository>
            <id>jitpack</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>enginehub</id>
            <url>https://maven.enginehub.org/repo/</url>
        </repository>
        <repository>
            <id>glaremasters</id>
            <url>https://repo.glaremasters.me/repository/bloodshot</url>
        </repository>
        <repository>
            <id>Lumine</id>
            <url>https://mvn.lumine.io/repository/maven-public/</url>
        </repository>
    </repositories>

    <profiles>
        <profile>
            <id>codemc-nms</id>
            <repositories>
                <!-- NMS repository -->
                <repository>
                    <id>nms-repo</id>
                    <url>https://repo.codemc.io/repository/nms/</url>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>spigot-mapped</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <string.remapper.remap.goal>spigot</string.remapper.remap.goal>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R10</artifactId>
                    <version>${invui.version}</version>
                </dependency>
                <dependency>
                    <groupId>xyz.xenondevs.kadvancements</groupId>
                    <artifactId>kadvancements-adapter-r2</artifactId>
                    <version>0.1-SNAPSHOT</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>xyz.xenondevs</groupId>
                        <artifactId>specialsource-maven-plugin</artifactId>
                        <version>1.2.4</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>remap</goal>
                                </goals>
                                <id>remap-obf</id>
                                <configuration>
                                    <srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
                                    <reverse>true</reverse>
                                    <remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
                                    <remappedArtifactAttached>false</remappedArtifactAttached>
                                    <finalName>${project.artifactId}-${project.version}-remapped-obf</finalName>
                                </configuration>
                            </execution>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>remap</goal>
                                </goals>
                                <id>remap-spigot</id>
                                <configuration>
                                    <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                                    <srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
                                    <remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>mojang-mapped</id>
            <properties>
                <string.remapper.remap.goal>mojang</string.remapper.remap.goal>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R10</artifactId>
                    <version>${invui.version}</version>
                    <classifier>remapped-mojang</classifier>
                </dependency>
                <dependency>
                    <groupId>xyz.xenondevs.kadvancements</groupId>
                    <artifactId>kadvancements-adapter-r2</artifactId>
                    <classifier>remapped-mojang</classifier>
                    <version>0.1-SNAPSHOT</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <dependencies>
        <!-- Nova API -->
        <dependency>
            <groupId>xyz.xenondevs.nova</groupId>
            <artifactId>Nova-API</artifactId>
            <version>0.9.6</version>
        </dependency>

        <!-- Spigot -->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <classifier>remapped-mojang</classifier>
            <version>${spigot.version}</version>
        </dependency>

        <!-- Provided through library loader -->
        <!-- Not using the provided scope, so they're transitive for addons -->
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>${annotations.version}</version>
        </dependency>
        <dependency>
            <groupId>xyz.xenondevs</groupId>
            <artifactId>particle</artifactId>
            <version>${particlelib.version}</version>
        </dependency>
        <dependency>
            <groupId>me.xdrop</groupId>
            <artifactId>fuzzywuzzy</artifactId>
            <version>${fuzzywuzzy.version}</version>
        </dependency>
        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>${zip4j.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-server-core-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-server-netty-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-core-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-cio-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-client-content-negotiation-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-serialization-gson-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <!-- Provided through library loader, not transitive -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-resolver-provider</artifactId>
            <version>${maven-resolver-provider.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-connector-basic</artifactId>
            <version>${maven-resolver-connector-basic.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-transport-http</artifactId>
            <version>${maven-resolver-transport-http.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Provided through plugins -->
        <dependency>
            <groupId>com.sk89q.worldguard</groupId>
            <artifactId>worldguard-bukkit</artifactId>
            <version>7.0.6</version>
            <scope>provided</scope>
            <exclusions>
                <!-- WG Deps -->
                <exclusion>
                    <groupId>com.sk89q.worldguard.worldguard-libs</groupId>
                    <artifactId>core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.flywaydb</groupId>
                    <artifactId>flyway-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.yaml</groupId>
                    <artifactId>snakeyaml</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.spigotmc</groupId>
                    <artifactId>spigot-api</artifactId>
                </exclusion>
                <!-- WE Deps -->
                <exclusion>
                    <groupId>com.sk89q.worldedit.worldedit-libs</groupId>
                    <artifactId>core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.antlr</groupId>
                    <artifactId>antlr4</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.antlr</groupId>
                    <artifactId>antlr4-runtime</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mozilla</groupId>
                    <artifactId>rhino-runtime</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>it.unimi.dsi</groupId>
                    <artifactId>fastutil</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.TechFortress</groupId>
            <artifactId>GriefPrevention</artifactId>
            <version>16.17.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.MilkBowl</groupId>
            <artifactId>VaultAPI</artifactId>
            <version>1.7</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.bukkit</groupId>
                    <artifactId>bukkit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.plotsquared</groupId>
            <artifactId>PlotSquared-Bukkit</artifactId>
            <version>6.9.0</version>
            <scope>provided</scope>
            <exclusions>
                <!-- PS Bukkit Deps -->
                <exclusion>
                    <groupId>net.kyori</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bstats</groupId>
                    <artifactId>bstats-bukkit</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.papermc</groupId>
                    <artifactId>paperlib</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.enginehub</groupId>
                    <artifactId>squirrelid</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>dev.notmyfault.serverlib</groupId>
                    <artifactId>ServerLib</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.intellectualsites.arkitektonika</groupId>
                    <artifactId>Arkitektonika-Client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.intellectualsites.http</groupId>
                    <artifactId>HTTP4J</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.intellectualsites.paster</groupId>
                    <artifactId>Paster</artifactId>
                </exclusion>
                <!-- PS Core Deps -->
                <exclusion>
                    <groupId>com.google.inject</groupId>
                    <artifactId>guice</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.inject.extensions</groupId>
                    <artifactId>guice-assistedinject</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.intellectualsites.prtree</groupId>
                    <artifactId>PRTree</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>aopalliance</groupId>
                    <artifactId>aopalliance</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.intellectualsites</groupId>
                    <artifactId>Pipeline</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.checkerframework</groupId>
                    <artifactId>checker-qual</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.yaml</groupId>
                    <artifactId>snakeyaml</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.griefdefender</groupId>
            <artifactId>api</artifactId>
            <version>2.0.0-SNAPSHOT</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.LoneDev6</groupId>
            <artifactId>API-ItemsAdder</artifactId>
            <version>3.1.0b</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.TownyAdvanced</groupId>
            <artifactId>Towny</artifactId>
            <version>0.97.2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.Th0rgal</groupId>
            <artifactId>Oraxen</artifactId>
            <version>2ddf3c68b7</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.lumine</groupId>
            <artifactId>MythicLib-dist</artifactId>
            <version>1.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.Indyuce</groupId>
            <artifactId>MMOItems</artifactId>
            <version>6.7</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dev.espi</groupId>
            <artifactId>protectionstones</artifactId>
            <version>2.10.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.maxgamer</groupId>
            <artifactId>QuickShop</artifactId>
            <version>5.1.0.7</version>
            <scope>provided</scope>
        </dependency>

        <!-- Not provided -->
        <dependency>
            <groupId>xyz.xenondevs.kadvancements</groupId>
            <artifactId>kadvancements-core</artifactId>
            <version>0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>de.studiocode.invui</groupId>
            <artifactId>InvUI</artifactId>
            <version>${invui.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.jetbrains</groupId>
                    <artifactId>annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R1</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R2</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R3</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R4</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R5</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R6</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R7</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R8</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R9</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.studiocode.invui</groupId>
                    <artifactId>IA-R10</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>de.studiocode.invui</groupId>
            <artifactId>ResourcePack</artifactId>
            <version>${invui.version}</version>
        </dependency>
        <dependency>
            <groupId>org.bstats</groupId>
            <artifactId>bstats-bukkit</artifactId>
            <version>3.0.0</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.8.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>xyz.xenondevs</groupId>
                <artifactId>string-remapper-maven-plugin</artifactId>
                <version>0.6</version>

                <executions>
                    <execution>
                        <id>remap-strings</id>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <configuration>
                            <remapGoal>${string.remapper.remap.goal}</remapGoal>
                            <classesIn>${project.build.directory}/classes</classesIn>
                            <classesOut>${project.build.directory}/classes-${string.remapper.remap.goal}</classesOut>
                            <mapsMojang>org.spigotmc:minecraft-server:txt:maps-mojang:${spigot.version}</mapsMojang>
                            <mapsSpigot>
                                <classes>org.spigotmc:minecraft-server:csrg:maps-spigot:${spigot.version}</classes>
                                <members>org.spigotmc:minecraft-server:csrg:maps-spigot-members:${spigot.version}</members>
                            </mapsSpigot>
                            <classes>
                                <class>xyz.xenondevs.nova.util.reflection.ReflectionRegistry</class>
                                <class>xyz.xenondevs.nova.util.NMSUtils</class>
                            </classes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <classesDirectory>${project.build.directory}/classes-${string.remapper.remap.goal}</classesDirectory>
                </configuration>
            </plugin>

            <!-- re-declare to change execution order -->
            <plugin>
                <groupId>xyz.xenondevs</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>1.2.4</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.1-xenondevs</version>
                <configuration>
                    <outputFile>${dir}/${project.artifactId}-${project.version}.jar</outputFile>
                    <createDependencyReducedPom>false</createDependencyReducedPom>

                    <relocations>
                        <relocation>
                            <pattern>org.bstats</pattern>
                            <shadedPattern>xyz.xenondevs.nova.bstats</shadedPattern>
                        </relocation>
                    </relocations>

                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                                <exclude>META-INF/*.MF</exclude>
                                <exclude>META-INF/DEPENDENCIES</exclude>
                                <exclude>META-INF/**/module-info.class</exclude>
                            </excludes>
                        </filter>
                    </filters>
                    <artifactSet>
                        <includes>
                            <include>xyz.xenondevs.nova:Nova-API</include>
                            <include>de.studiocode.invui:*</include>
                            <include>org.bstats:*</include>
                            <include>xyz.xenondevs.kadvancements:*</include>
                        </includes>
                    </artifactSet>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.0</version>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

</project>
