Skip to content

Commit

Permalink
Merge pull request #28 from variananora/rc-27-update
Browse files Browse the repository at this point in the history
Update to RC-27
  • Loading branch information
TheBusyBiscuit authored Sep 6, 2021
2 parents 8b3c58b + 882211f commit b8358a1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 39 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.classpath
.project
.iml
/.settings/
/bin/
/target/
/target/
/.idea/
dependency-reduced-pom.xml
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@
<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-20</version>
<version>RC-27</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>io.github.thebusybiscuit</groupId>
<artifactId>cscorelib2</artifactId>
<groupId>io.github.baked-libs</groupId>
<artifactId>dough-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/github/thebusybiscuit/souljars/FilledJar.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import org.bukkit.inventory.ItemStack;

import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.UnplaceableBlock;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;

public class FilledJar extends UnplaceableBlock {

public FilledJar(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public FilledJar(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
this.hidden = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.ItemUtils;

public class JarsListener implements Listener {

Expand All @@ -24,7 +24,7 @@ public JarsListener(SoulJars plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);

this.plugin = plugin;
this.emptyJar = SlimefunItem.getByID("SOUL_JAR");
this.emptyJar = SlimefunItem.getById("SOUL_JAR");
}

@EventHandler
Expand All @@ -36,8 +36,8 @@ public void onKill(EntityDeathEvent e) {

Player killer = e.getEntity().getKiller();

SlimefunItem jar = SlimefunItem.getByID(e.getEntityType().name() + "_SOUL_JAR");
SlimefunItem filledJar = SlimefunItem.getByID("FILLED_" + e.getEntityType().name() + "_SOUL_JAR");
SlimefunItem jar = SlimefunItem.getById(e.getEntityType().name() + "_SOUL_JAR");
SlimefunItem filledJar = SlimefunItem.getById("FILLED_" + e.getEntityType().name() + "_SOUL_JAR");

// Filling all existing Jars
for (int slot = 0; slot < killer.getInventory().getSize(); slot++) {
Expand Down
44 changes: 19 additions & 25 deletions src/main/java/io/github/thebusybiscuit/souljars/SoulJars.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,26 @@
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.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.BrokenSpawner;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.UnplaceableBlock;
import io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.libraries.dough.updater.GitHubBuildsUpdater;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.cscorelib2.config.Config;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.cscorelib2.updater.GitHubBuildsUpdater;
import me.mrCookieSlime.Slimefun.cscorelib2.updater.Updater;

public class SoulJars extends JavaPlugin implements Listener, SlimefunAddon {

private static final String JAR_TEXTURE = "bd1c777ee166c47cae698ae6b769da4e2b67f468855330ad7bddd751c5293f";
private final Map<EntityType, Integer> mobs = new EnumMap<>(EntityType.class);

private Config cfg;
private Category category;
private ItemGroup itemGroup;
private RecipeType recipeType;
private SlimefunItemStack emptyJar;

Expand All @@ -43,20 +42,15 @@ public void onEnable() {
// Setting up bStats
new Metrics(this, 5581);

if (getDescription().getVersion().startsWith("DEV - ")) {
Updater updater = new GitHubBuildsUpdater(this, getFile(), "TheBusyBiscuit/SoulJars/master");

// Only run the Updater if it has not been disabled
if (cfg.getBoolean("options.auto-update")) {
updater.start();
}
if (cfg.getBoolean("options.auto-update") && getDescription().getVersion().startsWith("DEV - ")) {
new GitHubBuildsUpdater(this, getFile(), "TheBusyBiscuit/SoulJars/master").start();
}

emptyJar = new SlimefunItemStack("SOUL_JAR", JAR_TEXTURE, "&bSoul Jar &7(Empty)", "", "&rKill a Mob while having this", "&rItem in your Inventory to bind", "&rtheir Soul to this Jar");
category = new Category(new NamespacedKey(this, "soul_jars"), new CustomItem(emptyJar, "&bSoul Jars", "", "&a> Click to open"));
recipeType = new RecipeType(new NamespacedKey(this, "mob_killing"), new CustomItem(Material.DIAMOND_SWORD, "&cKill the specified Mob", "&cwhile having an empty Soul Jar", "&cin your Inventory"));
itemGroup = new ItemGroup(new NamespacedKey(this, "soul_jars"), new CustomItemStack(emptyJar, "&bSoul Jars", "", "&a> Click to open"));
recipeType = new RecipeType(new NamespacedKey(this, "mob_killing"), new CustomItemStack(Material.DIAMOND_SWORD, "&cKill the specified Mob", "&cwhile having an empty Soul Jar", "&cin your Inventory"));

new SlimefunItem(category, emptyJar, RecipeType.ANCIENT_ALTAR, new ItemStack[] { SlimefunItems.EARTH_RUNE, new ItemStack(Material.SOUL_SAND), SlimefunItems.WATER_RUNE, new ItemStack(Material.SOUL_SAND), SlimefunItems.NECROTIC_SKULL, new ItemStack(Material.SOUL_SAND), SlimefunItems.AIR_RUNE, new ItemStack(Material.SOUL_SAND), SlimefunItems.FIRE_RUNE }, new CustomItem(emptyJar, 3)).register(this);
new SlimefunItem(itemGroup, emptyJar, RecipeType.ANCIENT_ALTAR, new ItemStack[] { SlimefunItems.EARTH_RUNE, new ItemStack(Material.SOUL_SAND), SlimefunItems.WATER_RUNE, new ItemStack(Material.SOUL_SAND), SlimefunItems.NECROTIC_SKULL, new ItemStack(Material.SOUL_SAND), SlimefunItems.AIR_RUNE, new ItemStack(Material.SOUL_SAND), SlimefunItems.FIRE_RUNE }, new CustomItemStack(emptyJar, 3)).register(this);
new JarsListener(this);

for (String mob : cfg.getStringList("mobs")) {
Expand Down Expand Up @@ -85,19 +79,19 @@ private void registerSoul(EntityType type) {

// @formatter:off
SlimefunItemStack jarItem = new SlimefunItemStack(type.name() + "_SOUL_JAR", JAR_TEXTURE, "&cSoul Jar &7(" + name + ")", "", "&7Infused Souls: &e1");
SlimefunItem jar = new UnplaceableBlock(category, jarItem, recipeType,
new ItemStack[] { null, null, null, emptyJar, null, new CustomItem(mobEgg, "&rKill " + souls + "x " + name), null, null, null });
SlimefunItem jar = new UnplaceableBlock(itemGroup, jarItem, recipeType,
new ItemStack[] { null, null, null, emptyJar, null, new CustomItemStack(mobEgg, "&rKill " + souls + "x " + name), null, null, null });
jar.register(this);

SlimefunItemStack filledJarItem = new SlimefunItemStack("FILLED_" + type.name() + "_SOUL_JAR", JAR_TEXTURE, "&cFilled Soul Jar &7(" + name + ")", "", "&7Infused Souls: &e" + souls);
SlimefunItem filledJar = new FilledJar(category, filledJarItem, recipeType,
new ItemStack[] { null, null, null, emptyJar, null, new CustomItem(mobEgg, "&rKill " + souls + "x " + name), null, null, null });
SlimefunItem filledJar = new FilledJar(itemGroup, filledJarItem, recipeType,
new ItemStack[] { null, null, null, emptyJar, null, new CustomItemStack(mobEgg, "&rKill " + souls + "x " + name), null, null, null });
filledJar.register(this);

BrokenSpawner brokenSpawner = SlimefunItems.BROKEN_SPAWNER.getItem(BrokenSpawner.class);

SlimefunItemStack spawnerItem = new SlimefunItemStack(type.toString() + "_BROKEN_SPAWNER", Material.SPAWNER, "&cBroken Spawner &7(" + name + ")");
new SlimefunItem(category, spawnerItem, RecipeType.ANCIENT_ALTAR,
new SlimefunItem(itemGroup, spawnerItem, RecipeType.ANCIENT_ALTAR,
new ItemStack[] { new ItemStack(Material.IRON_BARS), SlimefunItems.EARTH_RUNE, new ItemStack(Material.IRON_BARS), SlimefunItems.EARTH_RUNE, filledJarItem, SlimefunItems.EARTH_RUNE, new ItemStack(Material.IRON_BARS), SlimefunItems.EARTH_RUNE, new ItemStack(Material.IRON_BARS) },
brokenSpawner.getItemForEntityType(type)).register(this);
// @formatter:on
Expand Down

0 comments on commit b8358a1

Please sign in to comment.