Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RenanMsV authored Sep 18, 2024
0 parents commit 727fb75
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug Report
about: Report a Bug or an Issue with this Plugin.
title: ''
labels: bug
assignees: ''

---

## Description (Required)
<!-- A clear and detailed description of what exactly the Issue consists of. -->
<!-- Please try to write as much as possible. "it doesn't work" is not sufficient. -->
<!-- Try to write at least 4-6 sentences. -->

## Steps to reproduce the Issue (Required)
<!-- Youtube Videos and Screenshots are recommended! -->

## Expected behavior (Required)
<!-- What did you expect to happen? -->

## Server Log / Error Report
<!-- Take a look at your Server Log and please provide any error reports you can find via https://pastebin.com/ -->
<!-- We may discard your Issue if you just post it here, as it's unreadable for us. Please use Pastebin! -->

## Environment (Required)
<!-- We may also close your Issue if you are not providing the exact version numbers. -->
<!-- "latest" IS NOT A VERSION NUMBER. -->
<!-- You can also just run "/sf versions" and show us a screenshot of that. -->

- Minecraft Version:
- CS-CoreLib Version:
- Slimefun Version:
- Plugin Version:
24 changes: 24 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Java CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
if: startsWith(github.event.head_commit.message, '[CI skip]') == false
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- name: Set up JDK 16
uses: actions/[email protected]
with:
java-version: 16
distribution: temurin
- name: Build with Maven
run: mvn package --file pom.xml
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/bin/
/.settings/
/target/
/.idea/
*.iml
.project
.classpath
dependency-reduced-pom.xml
.DS_Store
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Slimefun4 Addon
This is an example Repository for a generic Slimefun4 Addon.
In the top left is a button "Use this template", click this to create your own Addon for Slimefun4 using this basic template.

## How to create your own addon.
This is a template repository that you can use to create your own Slimefun4 Addon.<br>
We have also written an extensive step-by-step tutorial which you can find here:<br>
https://github.com/Slimefun/Slimefun4/wiki/Developer-Guide

## Changing some important things
Navigate to `src/main/java` and rename the package and the .java File to your liking.<br>
Suggestion: "me.yourname.yourproject" (all lower case) and "ProjectName.java"<br>
Example: "me.thebusybiscuit.cooladdon" and "CoolAddon.java"

Navigate to `src/main/resources/plugin.yml` and change the "author" and "main" attributes.
You may also want to change the description to something meaningful.

Navigate to `pom.xml` and change the group id to "me.%Your name%" and change the artifact id to the name of your Project.

After that you are good to go, you can now start developing your own Addon for Slimefun4.
70 changes: 70 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<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>me.CHANGEME</groupId>
<artifactId>SlimefunAddon</artifactId>
<version>1.0.0</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>paper-repo</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>

<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>

<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<build>
<finalName>${project.name} v${project.version}</finalName>
<defaultGoal>clean package</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>

<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</build>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-28</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>io.github.baked-libs</groupId>
<artifactId>dough-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
84 changes: 84 additions & 0 deletions src/main/java/me/CHANGEME/slimefunaddon/ExampleAddon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package me.CHANGEME.slimefunaddon;

import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public class ExampleAddon extends JavaPlugin implements SlimefunAddon {

@Override
public void onEnable() {
// Read something from your config.yml
Config cfg = new Config(this);

if (cfg.getBoolean("options.auto-update")) {
// You could start an Auto-Updater for example
}

/*
* 1. Creating a new Category
* This Category will use the following ItemStack
*/
ItemStack itemGroupItem = new CustomItemStack(Material.DIAMOND, "&4Addon Category", "", "&a> Click to open");

// Give your Category a unique id.
NamespacedKey itemGroupId = new NamespacedKey(this, "addon_category");
ItemGroup itemGroup = new ItemGroup(itemGroupId, itemGroupItem);

/*
* 2. Create a new SlimefunItemStack
* This class has many constructors, it is very important
* that you give each item a unique id.
*/
SlimefunItemStack slimefunItem = new SlimefunItemStack("COOL_DIAMOND", Material.DIAMOND, "&4Cool Diamond", "&c+20% Coolness");

/*
* 3. Creating a Recipe
* The Recipe is an ItemStack Array with a length of 9.
* It represents a Shaped Recipe in a 3x3 crafting grid.
* The machine in which this recipe is crafted in is specified
* further down as the RecipeType.
*/
ItemStack[] recipe = { new ItemStack(Material.EMERALD), null, new ItemStack(Material.EMERALD), null, new ItemStack(Material.DIAMOND), null, new ItemStack(Material.EMERALD), null, new ItemStack(Material.EMERALD) };

/*
* 4. Registering the Item
* Now you just have to register the item.
* RecipeType.ENHANCED_CRAFTING_TABLE refers to the machine in
* which this item is crafted in.
* Recipe Types from Slimefun itself will automatically add the recipe to that machine.
*/
SlimefunItem item = new SlimefunItem(itemGroup, slimefunItem, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
item.register(this);
}

@Override
public void onDisable() {
// Logic for disabling the plugin...
}

@Override
public String getBugTrackerURL() {
// You can return a link to your Bug Tracker instead of null here
return null;
}

@Override
public JavaPlugin getJavaPlugin() {
/*
* You will need to return a reference to your Plugin here.
* If you are using your main class for this, simply return "this".
*/
return this;
}

}
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
options:
auto-update: true
25 changes: 25 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## CHANGE this to the name of your plugin.
name: SlimefunAddon

## CHANGE this to your username.
author: CHANGEME

## CHANGE this to a meaninful but short description of your plugin.
description: A generic Slimefun4-Addon

## CHANGE this to the path of the class that extends JavaPlugin.
main: me.CHANGEME.slimefunaddon.ExampleAddon

## You can change this to link to your website or repository. You can also remove this line if you want to.
website: https://github.com/Slimefun/Addon-Template

## This value is automatically replaced by the version specified in your pom.xml file.
## Do not change this.
version: ${project.version}

## This is the minimum minecraft version required to run your plugin.
api-version: 1.14

## This is required and marks Slimefun as a plugin dependency.
depend:
- Slimefun

0 comments on commit 727fb75

Please sign in to comment.