diff --git a/build.gradle b/build.gradle index 4b1d66a..0b72415 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,10 @@ plugins { id 'java' + id 'maven-publish' } +apply plugin: 'maven-publish' + group = 'com.impact.lib' version = '1.0' @@ -55,3 +58,15 @@ processResources { expand props } } + +publishing { + publications { + maven(MavenPublication) { + groupId = 'com.impact.lib' + artifactId = 'ImpactMC' + version = '1.0' + + from components.java + } + } +} \ No newline at end of file diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..1e41e00 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +jdk: + - openjdk17 \ No newline at end of file diff --git a/src/main/java/com/impact/lib/Impact.java b/src/main/java/com/impact/lib/Impact.java index 54696c3..26aaa79 100644 --- a/src/main/java/com/impact/lib/Impact.java +++ b/src/main/java/com/impact/lib/Impact.java @@ -20,6 +20,7 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitTask; import org.jetbrains.annotations.Contract; @@ -288,4 +289,37 @@ public static Command registerCommand(@NotNull NamespacedKey key, @NotNull MComm return ImpactRegistry.register(ImpactRegistries.COMMAND, key, command); } + public static ArrayList Items(ItemStack... items) { + return Arrays.stream(items).collect(Collectors.toCollection(ArrayList::new)); + } + + @Contract("_, _ -> new") + public static @NotNull ItemStack Item(Material material, int amount) { + return new ItemStack(material, amount); + } + + @Contract("_ -> new") + public static @NotNull ItemStack Item(Material material) { + return new ItemStack(material, 1); + } + + @Contract("_ -> new") + public static @NotNull ItemStack Stack(Material material) { + return new ItemStack(material, material.getMaxStackSize()); + } + + @Contract("_ -> new") + public static @NotNull ItemStack Item(String material_name) { + final Material material = Material.getMaterial(material_name); + if (material == null) throw new RuntimeException("Material of name '" + material_name + "' is unknown!"); + return new ItemStack(material, 1); + } + + @Contract("_ -> new") + public static @NotNull ItemStack Stack(String material_name) { + final Material material = Material.getMaterial(material_name); + if (material == null) throw new RuntimeException("Material of name '" + material_name + "' is unknown!"); + return new ItemStack(material, material.getMaxStackSize()); + } + }