Initial commit
This commit is contained in:
commit
ee86b7d84a
9 changed files with 384 additions and 0 deletions
56
.gitignore
vendored
Normal file
56
.gitignore
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#
|
||||||
|
# Project specific excludes
|
||||||
|
#
|
||||||
|
|
||||||
|
tomcat
|
||||||
|
|
||||||
|
#
|
||||||
|
# Default excludes
|
||||||
|
#
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
*.7z
|
||||||
|
*.dmg
|
||||||
|
*.gz
|
||||||
|
*.iso
|
||||||
|
*.jar
|
||||||
|
*.rar
|
||||||
|
*.tar
|
||||||
|
*.zip
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
*.sar
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
target/
|
||||||
|
|
||||||
|
# IntelliJ project files
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
*.ipr
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# eclipse project file
|
||||||
|
.settings/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
|
||||||
|
# NetBeans specific
|
||||||
|
nbproject/private/
|
||||||
|
build/
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
nbactions.xml
|
||||||
|
nb-configuration.xml
|
||||||
|
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
*.swp
|
||||||
|
release.properties
|
||||||
|
pom.xml.releaseBackup
|
||||||
|
pom.xml.tag
|
36
Jenkinsfile
vendored
Normal file
36
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
tools {
|
||||||
|
maven 'Maven 3.9.9'
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
MAVEN_OPTS = '-Dmaven.repo.local=.m2/repository'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
sh 'mvn clean install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Archive Artifacts') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def artifact = sh(script: "mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout", returnStdout: true).trim()
|
||||||
|
archiveArtifacts artifacts: "**/target/${artifact}-*.jar", fingerprint: true, allowEmptyArchive: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// stage('Notify Discord') {
|
||||||
|
// steps {
|
||||||
|
// script {
|
||||||
|
// discordSend webhookURL: '<DISCORD_WEBHOOK_URL>', title: "${env.JOB_NAME} #${env.BUILD_NUMBER}", enableArtifactsList: true, showChangeset: true, link: env.BUILD_URL, result: currentBuild.currentResult
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
91
pom.xml
Normal file
91
pom.xml
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<groupId>nl.maartenvr98</groupId>
|
||||||
|
<artifactId>PluginTemplate</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>PluginTemplate</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>21</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<defaultGoal>clean package</defaultGoal>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.5.3</version>
|
||||||
|
<configuration>
|
||||||
|
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>nl.maartenvr98.PluginKit</pattern>
|
||||||
|
<shadedPattern>nl.maartenvr98.PluginKit</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigotmc-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype</id>
|
||||||
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>maartenvr98-repository-plugins</id>
|
||||||
|
<name>Maarten's Repository</name>
|
||||||
|
<url>https://maven.maartenvr98.nl/plugins</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>nl.maartenvr98</groupId>
|
||||||
|
<artifactId>PluginKit</artifactId>
|
||||||
|
<version>1.1.3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
84
readme.md
Normal file
84
readme.md
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
# PluginTemplate
|
||||||
|
|
||||||
|
PluginTemplate is a simple starting point for creating Spigot plugins using the **PluginKit** framework. It provides a streamlined setup to kickstart your development with pre-configured essentials.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Integrated with PluginKit**: Build on top of your custom PluginKit framework for consistency and reduced boilerplate.
|
||||||
|
- **Pre-configured Structure**: Includes a clear folder and package layout for your Spigot plugin.
|
||||||
|
- **Ease of Use**: Designed to get you started quickly with minimal setup.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- **Java 17+**
|
||||||
|
- **Spigot API**: Compatible with Spigot version 1.16 and above.
|
||||||
|
- **PluginKit Framework**: Ensure the PluginKit framework is available in your project.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
1. **Clone the Template**
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/yourusername/PluginTemplate.git
|
||||||
|
cd PluginTemplate
|
||||||
|
|
||||||
|
|
||||||
|
2. **Set Up PluginKit**
|
||||||
|
|
||||||
|
Ensure PluginKit is added as a dependency in your project. Update the pom.xml or build.gradle file if necessary.
|
||||||
|
|
||||||
|
|
||||||
|
3. **Customize Plugin Metadata**
|
||||||
|
|
||||||
|
Update plugin.yml with your plugin's name, version, and other metadata:
|
||||||
|
```yaml
|
||||||
|
name: YourPluginName
|
||||||
|
version: '1.0-SNAPSHOT'
|
||||||
|
main: nl.maartenvr98.YourPluginName.Main
|
||||||
|
api-version: '1.21'
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Start coding**
|
||||||
|
|
||||||
|
Use the provided structure to add commands, events, and any other logic for your plugin.
|
||||||
|
|
||||||
|
|
||||||
|
5. **Build Your Plugin**
|
||||||
|
|
||||||
|
Use Maven or Gradle to compile your plugin:
|
||||||
|
```bash
|
||||||
|
mvn clean package
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
6. **Test in Spigot Server**
|
||||||
|
|
||||||
|
Copy the JAR file into your Spigot server's plugins folder and start the server.
|
||||||
|
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
```plaintext
|
||||||
|
PluginTemplate/
|
||||||
|
├── src/
|
||||||
|
│ ├── main/
|
||||||
|
│ │ ├── java/
|
||||||
|
│ │ │ └── nl/maartenvr98/YourPluginName
|
||||||
|
│ │ │ ├── commands/
|
||||||
|
│ │ │ │ └── MyCommand.java
|
||||||
|
│ │ │ ├── listener/
|
||||||
|
│ │ │ │ └── PlayerListener.java
|
||||||
|
│ │ │ ├── config/
|
||||||
|
│ │ │ │ └── MainConfig.java
|
||||||
|
│ │ │ └── Main.java
|
||||||
|
│ │ ├── resources/
|
||||||
|
│ │ │ ├── plugin.yml
|
||||||
|
├── pom.xml
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Contributions are welcome! Feel free to open issues or submit pull requests to improve the template
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
This project is licensed under the MIT License.
|
69
src/main/java/nl/maartenvr98/PluginTemplate/Main.java
Normal file
69
src/main/java/nl/maartenvr98/PluginTemplate/Main.java
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
package nl.maartenvr98.PluginTemplate;
|
||||||
|
|
||||||
|
import nl.maartenvr98.PluginKit.PluginKit;
|
||||||
|
import nl.maartenvr98.PluginKit.config.ConfigFile;
|
||||||
|
import nl.maartenvr98.PluginKit.log.Log;
|
||||||
|
import nl.maartenvr98.PluginTemplate.commands.MyCommand;
|
||||||
|
import nl.maartenvr98.PluginTemplate.config.MainConfig;
|
||||||
|
import nl.maartenvr98.PluginTemplate.listeners.PlayerListener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public final class Main extends JavaPlugin {
|
||||||
|
|
||||||
|
private static JavaPlugin instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
instance = this;
|
||||||
|
Log.success("Enabling PluginTemplate");
|
||||||
|
|
||||||
|
// Setup plugin with PluginKit
|
||||||
|
PluginKit.setPlugin(this)
|
||||||
|
// Commands
|
||||||
|
.addCommand("template", new MyCommand())
|
||||||
|
|
||||||
|
// Listeners
|
||||||
|
.addListener(new PlayerListener())
|
||||||
|
|
||||||
|
// Configs
|
||||||
|
.addConfig(new MainConfig())
|
||||||
|
|
||||||
|
// Tasks
|
||||||
|
// .addTask(new SpawnerSpawnTask())
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
// .addHook("Vault", new Vault())
|
||||||
|
|
||||||
|
// Migrations
|
||||||
|
// .addMigration(new CreatePlayersMigration());
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
.withSettings(settings -> {
|
||||||
|
// Define your settings here
|
||||||
|
|
||||||
|
// settings.setMessagesConfig("messages");
|
||||||
|
});
|
||||||
|
|
||||||
|
Log.success("PluginTemplate is enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
Log.success("Disabling PluginTemplate");
|
||||||
|
|
||||||
|
// Disable plugin
|
||||||
|
PluginKit.disablePlugin();
|
||||||
|
|
||||||
|
Log.success("PluginTemplate is disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get plugin instance
|
||||||
|
*
|
||||||
|
* @return JavaPlugin instance
|
||||||
|
*/
|
||||||
|
public static JavaPlugin getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package nl.maartenvr98.PluginTemplate.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
public class MyCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||||
|
// Implement logic here
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package nl.maartenvr98.PluginTemplate.config;
|
||||||
|
|
||||||
|
import nl.maartenvr98.PluginKit.config.ConfigFile;
|
||||||
|
import nl.maartenvr98.PluginKit.config.abstracts.AbstractConfig;
|
||||||
|
|
||||||
|
public class MainConfig extends AbstractConfig {
|
||||||
|
public MainConfig() {
|
||||||
|
super("config.yml");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDefaults(ConfigFile config) {
|
||||||
|
config.setDefault("foo.bar", "value");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package nl.maartenvr98.PluginTemplate.listeners;
|
||||||
|
|
||||||
|
import nl.maartenvr98.PluginKit.message.Message;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Message.chat(event.getPlayer(), "Welcome to my server!");
|
||||||
|
}
|
||||||
|
}
|
4
src/main/resources/plugin.yml
Normal file
4
src/main/resources/plugin.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name: PluginTemplate
|
||||||
|
version: '1.0-SNAPSHOT'
|
||||||
|
main: nl.maartenvr98.PluginTemplate.Main
|
||||||
|
api-version: '1.21'
|
Loading…
Add table
Add a link
Reference in a new issue