Skip to content

Commit

Permalink
Merge pull request #4 from freeserverproject/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Alpha9n authored Nov 23, 2022
2 parents 581974f + 70fef5f commit 3d793c1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>pro.freeserver.plugin.alphakun</groupId>
<artifactId>CraftSupporter</artifactId>
<version>2.0.2-release</version>
<version>2.0.4-dev</version>
<packaging>jar</packaging>

<name>CraftSupporter</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package pro.freeserver.plugin.alphakun.craftsupporter

import org.bukkit.Bukkit.recipeIterator
import org.bukkit.Material
import org.bukkit.NamespacedKey
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.Recipe
import org.bukkit.inventory.ShapedRecipe
import org.bukkit.plugin.java.JavaPlugin
import pro.freeserver.plugin.alphakun.craftsupporter.init.LoadRecipe

Expand All @@ -13,9 +19,19 @@ class CraftSupporter : JavaPlugin() {

override fun onDisable() {
// Plugin shutdown logic
removeRecipe()
}

companion object {
lateinit var plugin: CraftSupporter
var recipes: MutableList<NamespacedKey> = mutableListOf()
}

private fun removeRecipe() {
for (r in recipes) {
if (server.removeRecipe(r)) {
println("Recipe: " + r.key + "is now removed!!")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.Recipe
import org.bukkit.inventory.ShapedRecipe
import org.bukkit.inventory.ShapelessRecipe
import pro.freeserver.plugin.alphakun.craftsupporter.CraftSupporter
import pro.freeserver.plugin.alphakun.craftsupporter.CraftSupporter.Companion.plugin
import java.lang.NumberFormatException

Expand Down Expand Up @@ -75,6 +76,7 @@ class Racipe(recipeName: String, itemName: String?, material: String?, amount: I
}
if (Bukkit.addRecipe(recipe)) {
println("Recipe registered: $recipeName")
CraftSupporter.recipes.add(recipeName)
} else {
println("Recipe Failed: $recipeName")
}
Expand Down

0 comments on commit 3d793c1

Please sign in to comment.