mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-07 19:28:11 +01:00
[WIP] Add paper plugin loading for release mode
This commit is contained in:
parent
a37458394e
commit
26d7df2bf4
53
Minepacks-Paper/pom.xml
Normal file
53
Minepacks-Paper/pom.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<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>
|
||||
<artifactId>Minepacks-Paper</artifactId>
|
||||
<parent>
|
||||
<artifactId>Minepacks-Parent</artifactId>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Minepacks-Paper</name>
|
||||
<description>Paper API extension for Minepacks.</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
7
Minepacks-Paper/resources/paper-plugin.yml
Normal file
7
Minepacks-Paper/resources/paper-plugin.yml
Normal file
@ -0,0 +1,7 @@
|
||||
name: "Minepacks"
|
||||
author: "GeorgH93"
|
||||
version: "${version}"
|
||||
api-version: "1.19"
|
||||
|
||||
main: "at.pcgamingfreaks.MinepacksStandalone.Bukkit.Minepacks"
|
||||
bootstrapper: "at.pcgamingfreaks.Minepacks.Paper.MinepacksBootstrap"
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2023 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Paper;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
|
||||
import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
|
||||
|
||||
public class MinepacksBootstrap implements PluginBootstrap
|
||||
{
|
||||
@Override
|
||||
public void bootstrap(@NotNull PluginProviderContext context)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull JavaPlugin createPlugin(@NotNull PluginProviderContext context)
|
||||
{
|
||||
//TODO find a way to check if PCGF PluginLib exists
|
||||
//Plugin pcgfPluginLib = Bukkit.getPluginManager().getPlugin("PCGF_PluginLib");
|
||||
boolean standalone = true;
|
||||
/*if(pcgfPluginLib != null)
|
||||
{
|
||||
if(new Version(pcgfPluginLib.getDescription().getVersion()).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION)))
|
||||
{
|
||||
getLogger().info("PCGF-PluginLib to old! Switching to standalone mode!");
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
|
||||
standalone = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!");
|
||||
}*/
|
||||
try
|
||||
{
|
||||
if(standalone)
|
||||
{
|
||||
Class<?> standaloneClass = Class.forName("at.pcgamingfreaks.MinepacksStandalone.Bukkit.Minepacks");
|
||||
return (JavaPlugin) standaloneClass.newInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
Class<?> normalClass = Class.forName("at.pcgamingfreaks.Minepacks.Bukkit.Minepacks");
|
||||
return (JavaPlugin) normalClass.newInstance();
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw new RuntimeException("Failed to create Minepacks plugin instance!", e);
|
||||
}
|
||||
}
|
||||
}
|
@ -237,6 +237,11 @@
|
||||
<artifactId>Minepacks-BadRabbit-Bukkit</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks-Paper</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
@ -259,6 +264,7 @@
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:Minepacks-MagicValues</include>
|
||||
<include>at.pcgamingfreaks:Minepacks-Paper</include>
|
||||
<include>at.pcgamingfreaks:BadRabbit-Bukkit</include>
|
||||
<include>at.pcgamingfreaks:Minepacks-BadRabbit-Bukkit</include>
|
||||
<include>at.pcgamingfreaks:Minepacks</include>
|
||||
|
Loading…
Reference in New Issue
Block a user