Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunnky committed Oct 13, 2024
1 parent 98ed7ca commit 834e089
Show file tree
Hide file tree
Showing 7 changed files with 917 additions and 138 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# 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.
![I Dream of Easy!](https://github.com/user-attachments/assets/044e9fec-5a44-4b16-b091-23738f4ae4bf)

## 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
### I Dream of Easy is a Slimefun Addon that implements workable community suggestions as well as other random tools and machines.

## 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"
## How it works
TODO

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.
## Important info
TODO

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.
## Items
### Base:
TODO
99 changes: 84 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@
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>
<groupId>me.Bunnky</groupId>
<artifactId>IDreamOfEasy</artifactId>
<version>DEV</version>

<name>IDreamOfEasy</name>
<description>I Dream of Easy is a Slimefun Addon that implements workable community suggestions as well as other random tools and machines.</description>
<url>https://github.com/Bunnky/IDreamOfEasy</url>

<developers>
<developer>
<name>Bunnky</name>
</developer>
</developers>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -31,7 +41,39 @@
</repositories>

<build>
<finalName>${project.name} v${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<!-- Replace this with your package! -->
<shadedPattern>me.bunnky.idreamofeasy</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
</plugins>
<finalName>${project.name}</finalName>
<defaultGoal>clean package</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>

Expand All @@ -48,23 +90,50 @@

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

<dependency>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-28</version>
<version>e02a0f61d1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>io.github.baked-libs</groupId>
<artifactId>dough-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.github.baked-libs</groupId>
<artifactId>dough-api</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.1u2</version>
</dependency>
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</dependency>
</dependencies>
</project>
84 changes: 0 additions & 84 deletions src/main/java/me/CHANGEME/slimefunaddon/ExampleAddon.java

This file was deleted.

82 changes: 82 additions & 0 deletions src/main/java/me/bunnky/idreamofeasy/IDreamOfEasy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package me.bunnky.idreamofeasy;

import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.libraries.dough.updater.BlobBuildUpdater;
import me.bunnky.idreamofeasy.slimefun.Setup;
import org.bstats.bukkit.Metrics;
import org.bukkit.plugin.java.JavaPlugin;

import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;

import javax.annotation.Nonnull;
import java.text.MessageFormat;

public class IDreamOfEasy extends JavaPlugin implements SlimefunAddon {
private static IDreamOfEasy instance;
private final String username;
private final String repo;

public IDreamOfEasy() {
this.username = "Bunnky";
this.repo = "IDreamOfEasy";
}

@Override
public void onEnable() {
instance = this;

getLogger().info(" ┳ ┳┓┳┓┏┓┏┓┳┳┓ ┏┓┏┓ ┏┓┏┓┏┓┓┏ ");
getLogger().info(" ┃ ┃┃┣┫┣ ┣┫┃┃┃ ┃┃┣ ┣ ┣┫┗┓┗┫ ");
getLogger().info(" ┻ ┻┛┛┗┗┛┛┗┛ ┗ ┗┛┻ ┗┛┛┗┗┛┗┛ ");
getLogger().info(" by Bunnky ");

saveDefaultConfig();
tryUpdate();


Setup.setup();
setupMetrics();

if (!Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20)) {
getLogger().warning("IDOE only support 1.20+, disabling.");
getServer().getPluginManager().disablePlugin(this);
}
}

public void setupMetrics (){
Metrics metrics = new Metrics(this, 23610);
}

public void tryUpdate() {
if (getConfig().getBoolean("options.auto-update", true)
&& getDescription().getVersion().startsWith("Dev - ")
) {
new BlobBuildUpdater(this, getFile(), "SlimeVision", "Dev").start();
}
}

public static void consoleMsg(@Nonnull String string) {
instance.getLogger().info(string);
}

public static IDreamOfEasy getInstance() {
return instance;
}

@Override
public void onDisable() {
}

@Override
public String getBugTrackerURL() {
return MessageFormat.format("https://github.com/{0}/{1}/issues", this.username, this.repo);
}

@Nonnull
@Override
public JavaPlugin getJavaPlugin() {
return this;
}

}
61 changes: 61 additions & 0 deletions src/main/java/me/bunnky/idreamofeasy/slimefun/Setup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package me.bunnky.idreamofeasy.slimefun;

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.libraries.dough.items.CustomItemStack;
import lombok.experimental.UtilityClass;
import me.bunnky.idreamofeasy.IDreamOfEasy;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;

@UtilityClass
public class Setup {


public static void setup() {

IDreamOfEasy plugin = IDreamOfEasy.getInstance();

ItemStack groupItem = new CustomItemStack(Material.CALIBRATED_SCULK_SENSOR, "&bI Dream of Easy", "", "I wish this worked!");
NamespacedKey groupId = new NamespacedKey(IDreamOfEasy.getInstance(), "i_dream_of_easy");
ItemGroup group = new ItemGroup(groupId, groupItem);

//########################
// ITEMS
//########################

SlimefunItemStack placeholder = new SlimefunItemStack(
"IDOE_PLACEHOLDER",
Material.CALIBRATED_SCULK_SENSOR,
"&2PLACEHOLDER",
""
);


//########################
// RECIPES
//########################

ItemStack[] placeholderRecipe = {
null, null, null,
null, null, null,
null, null, null
};

//########################
// INSTANTIATE
//########################

SlimefunItem placeholderItem = new SlimefunItem(group, placeholder, RecipeType.ENHANCED_CRAFTING_TABLE, placeholderRecipe);


//########################
// REGISTER
//########################

placeholderItem.register(plugin);
}
}
Loading

0 comments on commit 834e089

Please sign in to comment.