Skip to content

Commit

Permalink
Merge pull request #43 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 5, 2021
2 parents 2d44303 + 24024f5 commit 60f0c8d
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 64 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/target/
.classpath
.project
/.settings/*
.iml
/.idea/
/.settings/*
dependency-reduced-pom.xml
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@
<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-21</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
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;

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.core.handlers.BlockBreakHandler;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
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;

public class LuckyBlock extends SlimefunItem {

private Collection<Surprise> surprises;
private Predicate<Surprise> predicate;

public LuckyBlock(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public LuckyBlock(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);

addItemHandler(onBlockBreak());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;

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.common.ChatColors;
import io.github.thebusybiscuit.slimefun4.libraries.dough.common.CommonPatterns;
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.skins.PlayerHead;
import io.github.thebusybiscuit.slimefun4.libraries.dough.skins.PlayerSkin;
import io.github.thebusybiscuit.slimefun4.libraries.dough.updater.GitHubBuildsUpdater;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.CustomItemSurprise;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
Expand Down Expand Up @@ -79,18 +89,7 @@
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.unlucky.WalshrusSurprise;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.unlucky.WitchSurprise;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.unlucky.ZombiePigmenSurprise;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.cscorelib2.chat.ChatColors;
import me.mrCookieSlime.Slimefun.cscorelib2.config.Config;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.cscorelib2.skull.SkullBlock;
import me.mrCookieSlime.Slimefun.cscorelib2.skull.SkullItem;
import me.mrCookieSlime.Slimefun.cscorelib2.updater.GitHubBuildsUpdater;
import me.mrCookieSlime.Slimefun.cscorelib2.updater.Updater;

public class SlimefunLuckyBlocks extends JavaPlugin implements SlimefunAddon {

Expand All @@ -107,32 +106,28 @@ public void onEnable() {
// Setting up bStats
new Metrics(this, 4858);

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

if (cfg.getBoolean("options.auto-update")) {
updater.start();
}
if (cfg.getBoolean("options.auto-update") && getDescription().getVersion().startsWith("DEV - ")) {
new GitHubBuildsUpdater(this, getFile(), "TheBusyBiscuit/luckyblocks-sf/master").start();
}

Category category = new Category(new NamespacedKey(this, "lucky_blocks"), new CustomItem(SkullItem.fromHash(TEXTURE), "&rLucky Blocks"));
ItemGroup itemGroup = new ItemGroup(new NamespacedKey(this, "lucky_blocks"), new CustomItemStack(PlayerHead.getItemStack(PlayerSkin.fromHashCode(TEXTURE)), "&rLucky Blocks"));

SlimefunItemStack luckyBlock = new SlimefunItemStack("LUCKY_BLOCK", TEXTURE, "&fLucky Block", "&7Luck: &f0");
SlimefunItemStack veryLuckyBlock = new SlimefunItemStack("LUCKY_BLOCK_LUCKY", TEXTURE, "&fVery lucky Block", "&7Luck: &a+80");
SlimefunItemStack veryUnluckyBlock = new SlimefunItemStack("LUCKY_BLOCK_UNLUCKY", TEXTURE, "&fVery unlucky Block", "&7Luck: &c-80");
SlimefunItemStack pandorasBox = new SlimefunItemStack("PANDORAS_BOX", "86c7dde512871bd607b77e6635ad39f44f2d5b4729e60273f1b14fba9a86a", "&5Pandora\"s Box", "&7Luck: &c&oERROR");

// @formatter:off
new LuckyBlock(category, luckyBlock, RecipeType.ENHANCED_CRAFTING_TABLE,
new LuckyBlock(itemGroup, luckyBlock, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] { SlimefunItems.GOLD_12K, SlimefunItems.GOLD_12K, SlimefunItems.GOLD_12K, SlimefunItems.GOLD_12K, new ItemStack(Material.DISPENSER), SlimefunItems.GOLD_12K, SlimefunItems.GOLD_12K, SlimefunItems.GOLD_12K, SlimefunItems.GOLD_12K }).register(this, surprises, s -> s.getLuckLevel() != LuckLevel.PANDORA);

new LuckyBlock(category, veryLuckyBlock, RecipeType.ENHANCED_CRAFTING_TABLE,
new LuckyBlock(itemGroup, veryLuckyBlock, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] { null, SlimefunItems.GOLD_12K, null, SlimefunItems.GOLD_12K, luckyBlock, SlimefunItems.GOLD_12K, null, SlimefunItems.GOLD_12K, null }).register(this, surprises, s -> s.getLuckLevel() == LuckLevel.LUCKY);

new LuckyBlock(category, veryUnluckyBlock, RecipeType.ENHANCED_CRAFTING_TABLE,
new LuckyBlock(itemGroup, veryUnluckyBlock, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] { null, new ItemStack(Material.SPIDER_EYE), null, new ItemStack(Material.SPIDER_EYE), luckyBlock, new ItemStack(Material.SPIDER_EYE), null, new ItemStack(Material.SPIDER_EYE), null }).register(this, surprises, s -> s.getLuckLevel() == LuckLevel.UNLUCKY);

new LuckyBlock(category, pandorasBox, RecipeType.ENHANCED_CRAFTING_TABLE,
new LuckyBlock(itemGroup, pandorasBox, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] { new ItemStack(Material.OAK_PLANKS), new ItemStack(Material.LAPIS_BLOCK), new ItemStack(Material.OAK_PLANKS), new ItemStack(Material.LAPIS_BLOCK), luckyBlock, new ItemStack(Material.LAPIS_BLOCK), new ItemStack(Material.OAK_PLANKS), new ItemStack(Material.LAPIS_BLOCK), new ItemStack(Material.OAK_PLANKS) }).register(this, surprises, s -> s.getLuckLevel() == LuckLevel.PANDORA);
// @formatter:on

Expand Down Expand Up @@ -233,7 +228,7 @@ private void registerCustomSurprises() {

if (cfg.getString(itemPath + ".slimefun_item") != null) {
String id = cfg.getString(itemPath + ".slimefun_item").toUpperCase(Locale.ROOT);
SlimefunItem sfItem = SlimefunItem.getByID(id);
SlimefunItem sfItem = SlimefunItem.getById(id);

if (sfItem != null) {
item = sfItem.getItem();
Expand Down Expand Up @@ -273,7 +268,7 @@ private void registerCustomSurprises() {

if (enchantment != null) {
if (split.length == 2) {
if (!PatternUtils.NUMERIC.matcher(split[1]).matches()) {
if (!CommonPatterns.NUMERIC.matcher(split[1]).matches()) {
getLogger().log(Level.WARNING, "Could not set \"{0}\" enchant with level \"{1}\" for custom surprise \"{2}\"", new Object[] { enchName, split[1], name });
continue;
}
Expand Down Expand Up @@ -344,7 +339,7 @@ public void spawnLuckyBlock(Block b) {
});

b.setBlockData(data);
SkullBlock.setFromHash(b, TEXTURE);
PlayerHead.setSkin(b, PlayerSkin.fromHashCode(TEXTURE), true);
BlockStorage.store(b, "LUCKY_BLOCK");

if (getCfg().getBoolean("debug")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class LuckyAxeSurprise implements Surprise {

private final ItemStack axe;

public LuckyAxeSurprise() {
axe = new CustomItem(Material.GOLDEN_AXE, "&e&lLucky Axe");
axe = new CustomItemStack(Material.GOLDEN_AXE, "&e&lLucky Axe");
axe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
axe.addUnsafeEnchantment(Enchantment.DIG_SPEED, 10);
axe.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class LuckyBootsSurprise implements Surprise {

private final ItemStack boots;

public LuckyBootsSurprise() {
boots = new CustomItem(Material.DIAMOND_BOOTS, "&e&lLucky Boots");
boots = new CustomItemStack(Material.DIAMOND_BOOTS, "&e&lLucky Boots");
boots.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
boots.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
boots.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class LuckyChestplateSurprise implements Surprise {

private final ItemStack chestplate;

public LuckyChestplateSurprise() {
chestplate = new CustomItem(Material.DIAMOND_CHESTPLATE, "&e&lLucky Chestplate");
chestplate = new CustomItemStack(Material.DIAMOND_CHESTPLATE, "&e&lLucky Chestplate");
chestplate.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
chestplate.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
chestplate.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class LuckyHelmetSurprise implements Surprise {

private final ItemStack helmet;

public LuckyHelmetSurprise() {
helmet = new CustomItem(Material.DIAMOND_HELMET, "&e&lLucky Helmet");
helmet = new CustomItemStack(Material.DIAMOND_HELMET, "&e&lLucky Helmet");
helmet.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
helmet.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
helmet.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class LuckyLeggingsSurprise implements Surprise {

private final ItemStack leggings;

public LuckyLeggingsSurprise() {
leggings = new CustomItem(Material.DIAMOND_LEGGINGS, "&e&lLucky Leggings");
leggings = new CustomItemStack(Material.DIAMOND_LEGGINGS, "&e&lLucky Leggings");
leggings.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
leggings.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
leggings.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class LuckyPickaxeSurprise implements Surprise {

private final ItemStack pickaxe;

public LuckyPickaxeSurprise() {
pickaxe = new CustomItem(Material.GOLDEN_PICKAXE, "&e&lLucky Pickaxe");
pickaxe = new CustomItemStack(Material.GOLDEN_PICKAXE, "&e&lLucky Pickaxe");
pickaxe.addUnsafeEnchantment(Enchantment.DIG_SPEED, 10);
pickaxe.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 10);
pickaxe.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class LuckySwordSurprise implements Surprise {

private final ItemStack sword;

public LuckySwordSurprise() {
sword = new CustomItem(Material.GOLDEN_SWORD, "&e&lLucky Sword");
sword = new CustomItemStack(Material.GOLDEN_SWORD, "&e&lLucky Sword");
sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
sword.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
sword.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class PotatOSSurprise implements Surprise {

Expand All @@ -19,7 +19,7 @@ public String getName() {

@Override
public void activate(Random random, Player p, Location l) {
l.getWorld().dropItemNaturally(l, new CustomItem(Material.POTATO, "&e&lPotatOS"));
l.getWorld().dropItemNaturally(l, new CustomItemStack(Material.POTATO, "&e&lPotatOS"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.cscorelib2.skull.SkullItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.libraries.dough.skins.PlayerHead;
import io.github.thebusybiscuit.slimefun4.libraries.dough.skins.PlayerSkin;

public final class ReapersSurprise implements Surprise {

private final ItemStack hoe;

public ReapersSurprise() {
hoe = new CustomItem(Material.GOLDEN_HOE, "&e&lLucky Hoe");
hoe = new CustomItemStack(Material.GOLDEN_HOE, "&e&lLucky Hoe");
hoe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
hoe.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
hoe.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 5);
Expand All @@ -42,7 +43,7 @@ public void activate(Random random, Player p, Location l) {
zombie.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(120D);
zombie.setHealth(120D);

zombie.getEquipment().setHelmet(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTkzN2FmMjYzMzI2ZTJiNDA5MDQyNzFiODMxYzNiMTc2ZWEyMWYwMTg2YmZhZjRlMTZlZWUxZTI4OWRkYWQ4In19fQ=="));
zombie.getEquipment().setHelmet(PlayerHead.getItemStack(PlayerSkin.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTkzN2FmMjYzMzI2ZTJiNDA5MDQyNzFiODMxYzNiMTc2ZWEyMWYwMTg2YmZhZjRlMTZlZWUxZTI4OWRkYWQ4In19fQ==")));
zombie.getEquipment().setHelmetDropChance(0F);

zombie.getEquipment().setItemInMainHand(hoe.clone());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

import io.github.thebusybiscuit.slimefunluckyblocks.surprises.LuckLevel;
import io.github.thebusybiscuit.slimefunluckyblocks.surprises.Surprise;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;

public final class BryanZombieSurprise implements Surprise {

private final ItemStack axe;

public BryanZombieSurprise() {
axe = new CustomItem(Material.GOLDEN_AXE, "&e&lLucky Axe");
axe = new CustomItemStack(Material.GOLDEN_AXE, "&e&lLucky Axe");
axe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
axe.addUnsafeEnchantment(Enchantment.DIG_SPEED, 10);
axe.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 10);
Expand Down
Loading

0 comments on commit 60f0c8d

Please sign in to comment.