From 9e0485e526e02446e334f0416dd8a224b9c1047b Mon Sep 17 00:00:00 2001 From: Seggan Date: Sat, 3 Oct 2020 16:21:39 -0400 Subject: [PATCH 01/51] Added crash helmet --- .../slimefun4/implementation/SlimefunItems.java | 2 ++ .../slimefun4/implementation/setup/SlimefunItemSetup.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 254a3f511..463e84234 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -838,6 +838,8 @@ public final class SlimefunItems { public static final SlimefunItemStack MAGNESIUM_SALT = new SlimefunItemStack("MAGNESIUM_SALT", Material.SUGAR, "&cMagnesium Salt", "", "&7A special type of fuel that can be", "&7used in a Magnesium-powered Generator"); public static final SlimefunItemStack MAGNESIUM_GENERATOR = new SlimefunItemStack("MAGNESIUM_GENERATOR", HeadTexture.GENERATOR, "&cMagnesium-powered Generator", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.GENERATOR), LoreBuilder.powerBuffer(128), LoreBuilder.powerPerSecond(36)); + public static final SlimefunItemStack CRASH_HELMET = new SlimefunItemStack("CRASH_HELMET", Material.IRON_HELMET, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); + static { INFUSED_ELYTRA.addUnsafeEnchantment(Enchantment.MENDING, 1); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 2ce4ff063..ce6b1e3e4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1016,6 +1016,10 @@ public final class SlimefunItemSetup { new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 20)}) .register(plugin); + new SlimefunItem(categories.technicalGadgets, SlimefunItems.CRASH_HELMET, RecipeType.ARMOR_FORGE, + new ItemStack[]{new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.IRON_INGOT)}) + .register(plugin); + new PickaxeOfContainment(categories.tools, SlimefunItems.PICKAXE_OF_CONTAINMENT, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {SlimefunItems.FERROSILICON, SlimefunItems.FERROSILICON, SlimefunItems.FERROSILICON, null, SlimefunItems.GILDED_IRON, null, null, SlimefunItems.GILDED_IRON, null}) .register(plugin); From 23efd62c4961c498cb083786cb6060fff56e60cc Mon Sep 17 00:00:00 2001 From: Seggan Date: Sat, 3 Oct 2020 16:31:27 -0400 Subject: [PATCH 02/51] Added crash helmet listener and research --- .../implementation/SlimefunPlugin.java | 37 +------------------ .../listeners/CrashHelmetListener.java | 31 ++++++++++++++++ .../implementation/setup/ResearchSetup.java | 1 + .../resources/languages/researches_en.yml | 1 + 4 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index ab0b9e2d0..970fdfa82 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -13,6 +13,7 @@ import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.*; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Server; @@ -56,41 +57,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GrapplingHook; import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAxe; import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.EntityInteractionListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.FireworksListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.GadgetsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.IronGolemListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.PiglinListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemConsumeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.VanillaMachinesListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.VillagerTradingListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.WitherListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener; import io.github.thebusybiscuit.slimefun4.implementation.resources.GEOResourcesSetup; import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup; import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup; @@ -453,6 +419,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { new EntityInteractionListener(this); new MobDropListener(this); new VillagerTradingListener(this); + new CrashHelmetListener(this); if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { new BeeListener(this); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java new file mode 100644 index 000000000..fbe40d78d --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java @@ -0,0 +1,31 @@ +package io.github.thebusybiscuit.slimefun4.implementation.listeners; + +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.inventory.ItemStack; + +import javax.annotation.Nonnull; + +public class CrashHelmetListener implements Listener { + + public CrashHelmetListener(@Nonnull SlimefunPlugin plugin) { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + public void onPlayerCrash(EntityDamageEvent e) { + if (!(e.getCause() == EntityDamageEvent.DamageCause.FLY_INTO_WALL) || !(e.getEntity() instanceof Player)) { + return; + } + + ItemStack stack = ((Player) e.getEntity()).getInventory().getHelmet(); + SlimefunItem item = SlimefunItem.getByItem(stack); + if ((item != null) && (item.getID().equals("CRASH_HELMET"))) { + e.setCancelled(true); + } + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java index ae98e4d27..87074f103 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java @@ -276,6 +276,7 @@ public final class ResearchSetup { register("climbing_pick", 265, "Block Raider", 20, SlimefunItems.CLIMBING_PICK); register("even_higher_tier_capacitors", 266, "Tier 3 Capacitors", 40, SlimefunItems.ENERGIZED_CAPACITOR); register("caveman_talisman", 267, "Talisman of the Caveman", 20, SlimefunItems.TALISMAN_CAVEMAN); + register("crash_helmet", 268, "Crash Gear", 20, SlimefunItems.CRASH_HELMET); } private static void register(String key, int id, String name, int defaultCost, ItemStack... items) { diff --git a/src/main/resources/languages/researches_en.yml b/src/main/resources/languages/researches_en.yml index 7f7826637..6fb6c4811 100644 --- a/src/main/resources/languages/researches_en.yml +++ b/src/main/resources/languages/researches_en.yml @@ -244,3 +244,4 @@ slimefun: tape_measure: Tape Measure iron_golem_assembler: Automated Iron Golems villager_rune: Reset Villager Trades + crash_helmet: Crash Gear From b540bc05bc96b1a9b925514ec61bb02cb64b8fbc Mon Sep 17 00:00:00 2001 From: Seggan Date: Sat, 3 Oct 2020 17:20:29 -0400 Subject: [PATCH 03/51] Crash helmet now works --- .../implementation/SlimefunPlugin.java | 37 ++++++++++++++++++- .../listeners/CrashHelmetListener.java | 17 +++++---- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index 970fdfa82..6f1a32240 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -13,7 +13,42 @@ import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.*; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.CrashHelmetListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.EntityInteractionListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.FireworksListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.GadgetsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.IronGolemListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.PiglinListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemConsumeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.VanillaMachinesListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.VillagerTradingListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.WitherListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Server; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java index fbe40d78d..d18f6b484 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java @@ -18,14 +18,17 @@ public class CrashHelmetListener implements Listener { @EventHandler public void onPlayerCrash(EntityDamageEvent e) { - if (!(e.getCause() == EntityDamageEvent.DamageCause.FLY_INTO_WALL) || !(e.getEntity() instanceof Player)) { - return; - } + if (!(e.getEntity() instanceof Player)) return; + if (!(e.getCause() == EntityDamageEvent.DamageCause.FALL || + e.getCause() == EntityDamageEvent.DamageCause.FLY_INTO_WALL)) return; - ItemStack stack = ((Player) e.getEntity()).getInventory().getHelmet(); - SlimefunItem item = SlimefunItem.getByItem(stack); - if ((item != null) && (item.getID().equals("CRASH_HELMET"))) { - e.setCancelled(true); + Player p = (Player) e.getEntity(); + if (p.isGliding()) { + ItemStack stack = p.getInventory().getHelmet(); + SlimefunItem item = SlimefunItem.getByItem(stack); + if ((item != null) && (item.getID().equals("CRASH_HELMET"))) { + e.setDamage(0); + } } } } From 99e0c542aede9f7e8b225a1e67f377f254d7d090 Mon Sep 17 00:00:00 2001 From: Seggan Date: Sat, 3 Oct 2020 17:22:03 -0400 Subject: [PATCH 04/51] Moved crash helmet item declaration --- .../thebusybiscuit/slimefun4/implementation/SlimefunItems.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 463e84234..7deb21d4d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -56,6 +56,7 @@ public final class SlimefunItems { public static final SlimefunItemStack REINFORCED_CLOTH = new SlimefunItemStack("REINFORCED_CLOTH", Material.PAPER, "&bReinforced Cloth", "", "&fThis cloth has been reinforced", "&fwith &bLead &fto protect against", "&fradioactive substances"); public static final SlimefunItemStack TIN_CAN = new SlimefunItemStack("CAN", HeadTexture.TIN_CAN, "&fTin Can"); public static final SlimefunItemStack NIGHT_VISION_GOGGLES = new SlimefunItemStack("NIGHT_VISION_GOGGLES", Material.LEATHER_HELMET, Color.BLACK, "&aNight Vision Goggles", "", "&9+ Night Vision"); + public static final SlimefunItemStack CRASH_HELMET = new SlimefunItemStack("CRASH_HELMET", Material.IRON_HELMET, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); public static final SlimefunItemStack FARMER_SHOES = new SlimefunItemStack("FARMER_SHOES", Material.LEATHER_BOOTS, Color.YELLOW, "&eFarmer Shoes", "", "&6&oPrevents you from trampling your Crops"); public static final SlimefunItemStack INFUSED_MAGNET = new SlimefunItemStack("INFUSED_MAGNET", HeadTexture.MAGNET, "&aInfused Magnet", "", "&fMagical infused Magnets", "&fattract nearby Items", "&fas long as it is somewhere in", "&fyour Inventory", "", "&7Hold &eShift&7 to pick up nearby Items"); public static final SlimefunItemStack RAG = new SlimefunItemStack("RAG", Material.PAPER, "&cRag", "", "&aLevel I - Medical Supply", "", "&fRestores 2 Hearts", "&fExtinguishes Fire", "", LoreBuilder.RIGHT_CLICK_TO_USE); @@ -838,8 +839,6 @@ public final class SlimefunItems { public static final SlimefunItemStack MAGNESIUM_SALT = new SlimefunItemStack("MAGNESIUM_SALT", Material.SUGAR, "&cMagnesium Salt", "", "&7A special type of fuel that can be", "&7used in a Magnesium-powered Generator"); public static final SlimefunItemStack MAGNESIUM_GENERATOR = new SlimefunItemStack("MAGNESIUM_GENERATOR", HeadTexture.GENERATOR, "&cMagnesium-powered Generator", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.GENERATOR), LoreBuilder.powerBuffer(128), LoreBuilder.powerPerSecond(36)); - public static final SlimefunItemStack CRASH_HELMET = new SlimefunItemStack("CRASH_HELMET", Material.IRON_HELMET, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); - static { INFUSED_ELYTRA.addUnsafeEnchantment(Enchantment.MENDING, 1); From d9aceea4d67aadeab0437d8ddecc2bdc7e0f4f10 Mon Sep 17 00:00:00 2001 From: Seggan Date: Sat, 3 Oct 2020 17:27:22 -0400 Subject: [PATCH 05/51] Changed recipe --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index ce6b1e3e4..f6d93646c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1017,7 +1017,7 @@ public final class SlimefunItemSetup { .register(plugin); new SlimefunItem(categories.technicalGadgets, SlimefunItems.CRASH_HELMET, RecipeType.ARMOR_FORGE, - new ItemStack[]{new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.IRON_INGOT)}) + new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) .register(plugin); new PickaxeOfContainment(categories.tools, SlimefunItems.PICKAXE_OF_CONTAINMENT, RecipeType.MAGIC_WORKBENCH, From 70be1c38d0c79d82f1e1879a51aef15c7ec26149 Mon Sep 17 00:00:00 2001 From: Seggan Date: Sun, 4 Oct 2020 14:42:50 -0400 Subject: [PATCH 06/51] Did requested changes --- .../implementation/SlimefunItems.java | 2 +- .../implementation/SlimefunPlugin.java | 4 ++-- .../implementation/items/armor/ElytraCap.java | 19 +++++++++++++++++++ ...etListener.java => ElytraCapListener.java} | 16 ++++++++++++---- .../implementation/setup/ResearchSetup.java | 2 +- .../setup/SlimefunItemSetup.java | 3 ++- 6 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java rename src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/{CrashHelmetListener.java => ElytraCapListener.java} (69%) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 7deb21d4d..0e16a5ce4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -56,7 +56,7 @@ public final class SlimefunItems { public static final SlimefunItemStack REINFORCED_CLOTH = new SlimefunItemStack("REINFORCED_CLOTH", Material.PAPER, "&bReinforced Cloth", "", "&fThis cloth has been reinforced", "&fwith &bLead &fto protect against", "&fradioactive substances"); public static final SlimefunItemStack TIN_CAN = new SlimefunItemStack("CAN", HeadTexture.TIN_CAN, "&fTin Can"); public static final SlimefunItemStack NIGHT_VISION_GOGGLES = new SlimefunItemStack("NIGHT_VISION_GOGGLES", Material.LEATHER_HELMET, Color.BLACK, "&aNight Vision Goggles", "", "&9+ Night Vision"); - public static final SlimefunItemStack CRASH_HELMET = new SlimefunItemStack("CRASH_HELMET", Material.IRON_HELMET, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); + public static final SlimefunItemStack ELYTRA_CAP = new SlimefunItemStack("CRASH_HELMET", Material.LEATHER_HELMET, Color.PURPLE, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); public static final SlimefunItemStack FARMER_SHOES = new SlimefunItemStack("FARMER_SHOES", Material.LEATHER_BOOTS, Color.YELLOW, "&eFarmer Shoes", "", "&6&oPrevents you from trampling your Crops"); public static final SlimefunItemStack INFUSED_MAGNET = new SlimefunItemStack("INFUSED_MAGNET", HeadTexture.MAGNET, "&aInfused Magnet", "", "&fMagical infused Magnets", "&fattract nearby Items", "&fas long as it is somewhere in", "&fyour Inventory", "", "&7Hold &eShift&7 to pick up nearby Items"); public static final SlimefunItemStack RAG = new SlimefunItemStack("RAG", Material.PAPER, "&cRag", "", "&aLevel I - Medical Supply", "", "&fRestores 2 Hearts", "&fExtinguishes Fire", "", LoreBuilder.RIGHT_CLICK_TO_USE); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index 6f1a32240..b8edb1107 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -20,7 +20,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.CrashHelmetListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCapListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener; @@ -454,7 +454,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { new EntityInteractionListener(this); new MobDropListener(this); new VillagerTradingListener(this); - new CrashHelmetListener(this); + new ElytraCapListener(this); if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { new BeeListener(this); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java new file mode 100644 index 000000000..3f95744f3 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java @@ -0,0 +1,19 @@ +package io.github.thebusybiscuit.slimefun4.implementation.items.armor; + +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 org.bukkit.inventory.ItemStack; + +/** + * A class for the Elytra Cap. + * + * @author Seggan + */ +public class ElytraCap extends SlimefunItem { + + public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { + super(category, item, recipeType, recipe); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java similarity index 69% rename from src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java index d18f6b484..25b37bffa 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CrashHelmetListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java @@ -1,7 +1,9 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -10,9 +12,14 @@ import org.bukkit.inventory.ItemStack; import javax.annotation.Nonnull; -public class CrashHelmetListener implements Listener { +/** + * The {@link Listener} for the {@link ElytraCap}. + * + * @author Seggan + */ +public class ElytraCapListener implements Listener { - public CrashHelmetListener(@Nonnull SlimefunPlugin plugin) { + public ElytraCapListener(@Nonnull SlimefunPlugin plugin) { plugin.getServer().getPluginManager().registerEvents(this, plugin); } @@ -26,8 +33,9 @@ public class CrashHelmetListener implements Listener { if (p.isGliding()) { ItemStack stack = p.getInventory().getHelmet(); SlimefunItem item = SlimefunItem.getByItem(stack); - if ((item != null) && (item.getID().equals("CRASH_HELMET"))) { - e.setDamage(0); + if (item instanceof ElytraCap) { + e.setCancelled(true); + p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 10, 1); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java index 87074f103..a83b23872 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java @@ -276,7 +276,7 @@ public final class ResearchSetup { register("climbing_pick", 265, "Block Raider", 20, SlimefunItems.CLIMBING_PICK); register("even_higher_tier_capacitors", 266, "Tier 3 Capacitors", 40, SlimefunItems.ENERGIZED_CAPACITOR); register("caveman_talisman", 267, "Talisman of the Caveman", 20, SlimefunItems.TALISMAN_CAVEMAN); - register("crash_helmet", 268, "Crash Gear", 20, SlimefunItems.CRASH_HELMET); + register("crash_helmet", 268, "Crash Gear", 20, SlimefunItems.ELYTRA_CAP); } private static void register(String key, int id, String name, int defaultCost, ItemStack... items) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index f6d93646c..e87da5234 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -5,6 +5,7 @@ import java.util.List; import javax.annotation.Nonnull; +import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -1016,7 +1017,7 @@ public final class SlimefunItemSetup { new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 20)}) .register(plugin); - new SlimefunItem(categories.technicalGadgets, SlimefunItems.CRASH_HELMET, RecipeType.ARMOR_FORGE, + new ElytraCap(categories.technicalGadgets, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE, new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) .register(plugin); From 1dbdd077ec3c4c8d2bf85d28fb8825872320e3b5 Mon Sep 17 00:00:00 2001 From: Seggan Date: Sun, 4 Oct 2020 14:43:30 -0400 Subject: [PATCH 07/51] Updated recipe --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index e87da5234..23f8e9fed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1018,7 +1018,7 @@ public final class SlimefunItemSetup { .register(plugin); new ElytraCap(categories.technicalGadgets, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE, - new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) + new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) .register(plugin); new PickaxeOfContainment(categories.tools, SlimefunItems.PICKAXE_OF_CONTAINMENT, RecipeType.MAGIC_WORKBENCH, From 107125802cc7ea75b1bdd1e242b786d29dff0a1c Mon Sep 17 00:00:00 2001 From: Seggan Date: Sun, 4 Oct 2020 15:02:21 -0400 Subject: [PATCH 08/51] Forgot to change id. Reverted back to setDamage() --- .../slimefun4/implementation/SlimefunItems.java | 2 +- .../slimefun4/implementation/listeners/ElytraCapListener.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 0e16a5ce4..461a04ba7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -56,7 +56,7 @@ public final class SlimefunItems { public static final SlimefunItemStack REINFORCED_CLOTH = new SlimefunItemStack("REINFORCED_CLOTH", Material.PAPER, "&bReinforced Cloth", "", "&fThis cloth has been reinforced", "&fwith &bLead &fto protect against", "&fradioactive substances"); public static final SlimefunItemStack TIN_CAN = new SlimefunItemStack("CAN", HeadTexture.TIN_CAN, "&fTin Can"); public static final SlimefunItemStack NIGHT_VISION_GOGGLES = new SlimefunItemStack("NIGHT_VISION_GOGGLES", Material.LEATHER_HELMET, Color.BLACK, "&aNight Vision Goggles", "", "&9+ Night Vision"); - public static final SlimefunItemStack ELYTRA_CAP = new SlimefunItemStack("CRASH_HELMET", Material.LEATHER_HELMET, Color.PURPLE, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); + public static final SlimefunItemStack ELYTRA_CAP = new SlimefunItemStack("ELYTRA_CAP", Material.LEATHER_HELMET, Color.PURPLE, "&5Elytra Cap", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); public static final SlimefunItemStack FARMER_SHOES = new SlimefunItemStack("FARMER_SHOES", Material.LEATHER_BOOTS, Color.YELLOW, "&eFarmer Shoes", "", "&6&oPrevents you from trampling your Crops"); public static final SlimefunItemStack INFUSED_MAGNET = new SlimefunItemStack("INFUSED_MAGNET", HeadTexture.MAGNET, "&aInfused Magnet", "", "&fMagical infused Magnets", "&fattract nearby Items", "&fas long as it is somewhere in", "&fyour Inventory", "", "&7Hold &eShift&7 to pick up nearby Items"); public static final SlimefunItemStack RAG = new SlimefunItemStack("RAG", Material.PAPER, "&cRag", "", "&aLevel I - Medical Supply", "", "&fRestores 2 Hearts", "&fExtinguishes Fire", "", LoreBuilder.RIGHT_CLICK_TO_USE); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java index 25b37bffa..76a6f7e1b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java @@ -34,8 +34,8 @@ public class ElytraCapListener implements Listener { ItemStack stack = p.getInventory().getHelmet(); SlimefunItem item = SlimefunItem.getByItem(stack); if (item instanceof ElytraCap) { - e.setCancelled(true); - p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 10, 1); + e.setDamage(0); + p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); } } } From f87a1d3660f03de84949f0787976ccf6e5d7649f Mon Sep 17 00:00:00 2001 From: Seggan Date: Sun, 4 Oct 2020 15:07:11 -0400 Subject: [PATCH 09/51] Added research check --- .../slimefun4/implementation/listeners/ElytraCapListener.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java index 76a6f7e1b..c3e46da33 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java @@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; +import me.mrCookieSlime.Slimefun.api.Slimefun; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -32,6 +33,7 @@ public class ElytraCapListener implements Listener { Player p = (Player) e.getEntity(); if (p.isGliding()) { ItemStack stack = p.getInventory().getHelmet(); + if (!Slimefun.hasUnlocked(p, stack, true)) return; SlimefunItem item = SlimefunItem.getByItem(stack); if (item instanceof ElytraCap) { e.setDamage(0); From 8bbef4c9110b6c20774d9c53e5d5e7a63166c9a8 Mon Sep 17 00:00:00 2001 From: Seggan Date: Sun, 4 Oct 2020 16:08:42 -0400 Subject: [PATCH 10/51] Did some requested changes --- .../implementation/SlimefunPlugin.java | 73 +++++++++---------- .../implementation/items/armor/ElytraCap.java | 16 ++-- .../listeners/ElytraCapListener.java | 6 ++ .../setup/SlimefunItemSetup.java | 2 +- 4 files changed, 54 insertions(+), 43 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index b8edb1107..e12cdcf3c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -12,43 +12,6 @@ import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; - -import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCapListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.EntityInteractionListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.FireworksListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.GadgetsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.IronGolemListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.PiglinListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemConsumeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.VanillaMachinesListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.VillagerTradingListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.WitherListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Server; @@ -92,6 +55,42 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GrapplingHook; import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAxe; import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCapListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.EntityInteractionListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.FireworksListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.GadgetsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.IronGolemListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.PiglinListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemConsumeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.VanillaMachinesListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.VillagerTradingListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.WitherListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener; import io.github.thebusybiscuit.slimefun4.implementation.resources.GEOResourcesSetup; import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup; import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java index 3f95744f3..f81ab0e6f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java @@ -1,19 +1,25 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.armor; +import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; 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 org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; /** - * A class for the Elytra Cap. + * The {@link ElytraCap} negates damage taken when crashing into a wall using elytra. * * @author Seggan */ -public class ElytraCap extends SlimefunItem { +public class ElytraCap extends SlimefunArmorPiece implements DamageableItem { - public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { - super(category, item, recipeType, recipe); + public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects) { + super(category, item, recipeType, recipe, effects); + } + + @Override + public boolean isDamageable() { + return true; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java index c3e46da33..656ceaee3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java @@ -1,15 +1,18 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; +import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.api.Slimefun; +import org.bukkit.GameMode; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.Damageable; import javax.annotation.Nonnull; @@ -38,6 +41,9 @@ public class ElytraCapListener implements Listener { if (item instanceof ElytraCap) { e.setDamage(0); p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); + if (p.getGameMode() != GameMode.CREATIVE) { + ((ElytraCap) item).damageItem(p, stack); + } } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 23f8e9fed..118f4e2fa 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1018,7 +1018,7 @@ public final class SlimefunItemSetup { .register(plugin); new ElytraCap(categories.technicalGadgets, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE, - new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) + new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}, null) .register(plugin); new PickaxeOfContainment(categories.tools, SlimefunItems.PICKAXE_OF_CONTAINMENT, RecipeType.MAGIC_WORKBENCH, From d6df2ea00c9074b5361c60081998e87c1490b24b Mon Sep 17 00:00:00 2001 From: Seggan Date: Sun, 4 Oct 2020 21:59:10 -0400 Subject: [PATCH 11/51] Added crash protection type --- .../core/attributes/ProtectionType.java | 7 +++- .../implementation/items/armor/ElytraCap.java | 34 ++++++++++++++++--- .../listeners/ElytraCapListener.java | 14 +++++--- .../setup/SlimefunItemSetup.java | 2 +- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectionType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectionType.java index df48ca2eb..bb2fd0a17 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectionType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectionType.java @@ -21,6 +21,11 @@ public enum ProtectionType { /** * This damage type represents damage caused by a {@link Bee} */ - BEES; + BEES, + + /** + * This damage type represents damage caused by flying into a wall with an elytra + */ + FLYING_INTO_WALL; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java index f81ab0e6f..025b7a027 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java @@ -1,25 +1,51 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.armor; import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; +import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; +import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectiveArmor; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; +import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; + +import javax.annotation.Nonnull; /** * The {@link ElytraCap} negates damage taken when crashing into a wall using elytra. * * @author Seggan */ -public class ElytraCap extends SlimefunArmorPiece implements DamageableItem { +public class ElytraCap extends SlimefunArmorPiece implements DamageableItem, ProtectiveArmor { - public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects) { - super(category, item, recipeType, recipe, effects); + private NamespacedKey key; + + public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { + super(category, item, recipeType, recipe, null); + + key = new NamespacedKey(SlimefunPlugin.instance(), "elytra_armor"); } @Override public boolean isDamageable() { return true; } + + @Nonnull + @Override + public ProtectionType[] getProtectionTypes() { + return new ProtectionType[] {ProtectionType.FLYING_INTO_WALL}; + } + + @Override + public boolean isFullSetRequired() { + return false; + } + + @Nonnull + @Override + public NamespacedKey getArmorSetId() { + return key; + } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java index 656ceaee3..3460ac580 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java @@ -1,6 +1,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; +import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; +import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectiveArmor; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; @@ -12,9 +14,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.Damageable; import javax.annotation.Nonnull; +import java.util.Arrays; /** * The {@link Listener} for the {@link ElytraCap}. @@ -36,13 +38,15 @@ public class ElytraCapListener implements Listener { Player p = (Player) e.getEntity(); if (p.isGliding()) { ItemStack stack = p.getInventory().getHelmet(); - if (!Slimefun.hasUnlocked(p, stack, true)) return; SlimefunItem item = SlimefunItem.getByItem(stack); - if (item instanceof ElytraCap) { + if (!Slimefun.hasUnlocked(p, item, true)) return; + if (item instanceof ProtectiveArmor) { + if (!Arrays.asList(((ProtectiveArmor) item).getProtectionTypes()) + .contains(ProtectionType.FLYING_INTO_WALL)) return; e.setDamage(0); p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); - if (p.getGameMode() != GameMode.CREATIVE) { - ((ElytraCap) item).damageItem(p, stack); + if (p.getGameMode() != GameMode.CREATIVE && item instanceof DamageableItem) { + ((DamageableItem) item).damageItem(p, stack); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 118f4e2fa..23f8e9fed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1018,7 +1018,7 @@ public final class SlimefunItemSetup { .register(plugin); new ElytraCap(categories.technicalGadgets, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE, - new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}, null) + new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) .register(plugin); new PickaxeOfContainment(categories.tools, SlimefunItems.PICKAXE_OF_CONTAINMENT, RecipeType.MAGIC_WORKBENCH, From 3dcd5942aaa3be9a75747cdca1d5ce738646f1d0 Mon Sep 17 00:00:00 2001 From: Seggan Date: Sun, 4 Oct 2020 22:03:48 -0400 Subject: [PATCH 12/51] Changed some linguistic things (Biscuit needs to be an English professor) --- .../thebusybiscuit/slimefun4/implementation/SlimefunItems.java | 2 +- .../slimefun4/implementation/items/armor/ElytraCap.java | 2 +- .../slimefun4/implementation/setup/ResearchSetup.java | 2 +- src/main/resources/languages/researches_en.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 461a04ba7..c3bcfdf8c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -56,7 +56,7 @@ public final class SlimefunItems { public static final SlimefunItemStack REINFORCED_CLOTH = new SlimefunItemStack("REINFORCED_CLOTH", Material.PAPER, "&bReinforced Cloth", "", "&fThis cloth has been reinforced", "&fwith &bLead &fto protect against", "&fradioactive substances"); public static final SlimefunItemStack TIN_CAN = new SlimefunItemStack("CAN", HeadTexture.TIN_CAN, "&fTin Can"); public static final SlimefunItemStack NIGHT_VISION_GOGGLES = new SlimefunItemStack("NIGHT_VISION_GOGGLES", Material.LEATHER_HELMET, Color.BLACK, "&aNight Vision Goggles", "", "&9+ Night Vision"); - public static final SlimefunItemStack ELYTRA_CAP = new SlimefunItemStack("ELYTRA_CAP", Material.LEATHER_HELMET, Color.PURPLE, "&5Elytra Cap", "", "&7This helmet will protect you from", "&7crashing while flying elytra."); + public static final SlimefunItemStack ELYTRA_CAP = new SlimefunItemStack("ELYTRA_CAP", Material.LEATHER_HELMET, Color.PURPLE, "&5Elytra Cap", "", "&7This helmet will protect you from", "&7crashing while flying with an elytra."); public static final SlimefunItemStack FARMER_SHOES = new SlimefunItemStack("FARMER_SHOES", Material.LEATHER_BOOTS, Color.YELLOW, "&eFarmer Shoes", "", "&6&oPrevents you from trampling your Crops"); public static final SlimefunItemStack INFUSED_MAGNET = new SlimefunItemStack("INFUSED_MAGNET", HeadTexture.MAGNET, "&aInfused Magnet", "", "&fMagical infused Magnets", "&fattract nearby Items", "&fas long as it is somewhere in", "&fyour Inventory", "", "&7Hold &eShift&7 to pick up nearby Items"); public static final SlimefunItemStack RAG = new SlimefunItemStack("RAG", Material.PAPER, "&cRag", "", "&aLevel I - Medical Supply", "", "&fRestores 2 Hearts", "&fExtinguishes Fire", "", LoreBuilder.RIGHT_CLICK_TO_USE); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java index f81ab0e6f..49d765081 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java @@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; /** - * The {@link ElytraCap} negates damage taken when crashing into a wall using elytra. + * The {@link ElytraCap} negates damage taken when crashing into a wall using an elytra. * * @author Seggan */ diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java index a83b23872..80c2c2b1d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java @@ -276,7 +276,7 @@ public final class ResearchSetup { register("climbing_pick", 265, "Block Raider", 20, SlimefunItems.CLIMBING_PICK); register("even_higher_tier_capacitors", 266, "Tier 3 Capacitors", 40, SlimefunItems.ENERGIZED_CAPACITOR); register("caveman_talisman", 267, "Talisman of the Caveman", 20, SlimefunItems.TALISMAN_CAVEMAN); - register("crash_helmet", 268, "Crash Gear", 20, SlimefunItems.ELYTRA_CAP); + register("elytra_cap", 268, "Crash Gear", 20, SlimefunItems.ELYTRA_CAP); } private static void register(String key, int id, String name, int defaultCost, ItemStack... items) { diff --git a/src/main/resources/languages/researches_en.yml b/src/main/resources/languages/researches_en.yml index 6fb6c4811..b197c8cd8 100644 --- a/src/main/resources/languages/researches_en.yml +++ b/src/main/resources/languages/researches_en.yml @@ -244,4 +244,4 @@ slimefun: tape_measure: Tape Measure iron_golem_assembler: Automated Iron Golems villager_rune: Reset Villager Trades - crash_helmet: Crash Gear + elytra_cap: Crash Gear From 5ec63f632f0480d70e61d5774bca51e7934419bf Mon Sep 17 00:00:00 2001 From: svr333 Date: Mon, 5 Oct 2020 14:20:44 +0200 Subject: [PATCH 13/51] Update lore --- .../thebusybiscuit/slimefun4/implementation/SlimefunItems.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 254a3f511..a33a279d7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -63,7 +63,7 @@ public final class SlimefunItems { public static final SlimefunItemStack SPLINT = new SlimefunItemStack("SPLINT", Material.STICK, "&cSplint", "", "&aLevel I - Medical Supply", "", "&fRestores 2 Hearts", "", LoreBuilder.RIGHT_CLICK_TO_USE); public static final SlimefunItemStack VITAMINS = new SlimefunItemStack("VITAMINS", Material.NETHER_WART, "&cVitamins", "", "&aLevel III - Medical Supply", "", "&fRestores 4 Hearts", "&fExtinguishes Fire", "&fCures Poison/Wither/Radiation", "", LoreBuilder.RIGHT_CLICK_TO_USE); public static final SlimefunItemStack MEDICINE = new SlimefunItemStack("MEDICINE", Material.POTION, Color.RED, "&cMedicine", "", "&aLevel III - Medical Supply", "", "&fRestores 4 Hearts", "&fExtinguishes Fire", "&fCures Poison/Wither/Radiation"); - public static final SlimefunItemStack MAGICAL_ZOMBIE_PILLS = new SlimefunItemStack("MAGICAL_ZOMBIE_PILLS", Material.NETHER_WART, "&6Magical Zombie Pills", "", "&eRight Click &7a Zombified Villager to", "&7instantly cure it from its curse"); + public static final SlimefunItemStack MAGICAL_ZOMBIE_PILLS = new SlimefunItemStack("MAGICAL_ZOMBIE_PILLS", Material.NETHER_WART, "&6Magical Zombie Pills", "", "&eRight Click &7a Zombified Villager", "&eor &7a Zombified Piglin to", "&7instantly cure it from its curse"); public static final SlimefunItemStack FLASK_OF_KNOWLEDGE = new SlimefunItemStack("FLASK_OF_KNOWLEDGE", Material.GLASS_BOTTLE, "&cFlask of Knowledge", "", "&fAllows you to store some of", "&fyour Experience in a Bottle", "&7Cost: &a1 Level"); public static final SlimefunItemStack FILLED_FLASK_OF_KNOWLEDGE = new SlimefunItemStack("FILLED_FLASK_OF_KNOWLEDGE", Material.EXPERIENCE_BOTTLE, "&aFlask of Knowledge"); From e1488c0811997a083f01cd51bdcf94e258e27d90 Mon Sep 17 00:00:00 2001 From: svr333 Date: Mon, 5 Oct 2020 14:56:40 +0200 Subject: [PATCH 14/51] Add Zombified piglin conversion --- .../items/magical/MagicalZombiePills.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 775a970bd..34ab39174 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -1,12 +1,10 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical; +import org.bukkit.Bukkit; import org.bukkit.GameMode; +import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Villager; -import org.bukkit.entity.ZombieVillager; +import org.bukkit.entity.*; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; @@ -63,6 +61,21 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 14:58:53 +0200 Subject: [PATCH 15/51] Fix imports --- .../implementation/items/magical/MagicalZombiePills.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 34ab39174..58d4f058a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -1,10 +1,13 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical; -import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.*; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager; +import org.bukkit.entity.ZombieVillager; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; From 21bf7cf60704eee6da3dfaf9ebaae223f305e48f Mon Sep 17 00:00:00 2001 From: svr333 Date: Mon, 5 Oct 2020 15:00:21 +0200 Subject: [PATCH 16/51] Refactor slightly --- .../implementation/items/magical/MagicalZombiePills.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 58d4f058a..f30bdc669 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -72,9 +72,8 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 15:25:11 +0200 Subject: [PATCH 17/51] Refactor --- .../items/magical/MagicalZombiePills.java | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index f30bdc669..134de0d6e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -48,7 +48,7 @@ public class MagicalZombiePills extends SimpleSlimefunItem { Entity entity = e.getRightClicked(); - if (entity.getType() == EntityType.ZOMBIE_VILLAGER) { + if (entity.getType() == EntityType.ZOMBIE_VILLAGER || entity.getType() == EntityType.ZOMBIFIED_PIGLIN) { Player p = e.getPlayer(); if (p.getGameMode() != GameMode.CREATIVE) { @@ -57,26 +57,20 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 15:28:43 +0200 Subject: [PATCH 18/51] Extra code to separate methods --- .../items/magical/MagicalZombiePills.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 134de0d6e..976b080b0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -58,18 +58,11 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 15:29:02 +0200 Subject: [PATCH 19/51] Add newline --- .../implementation/items/magical/MagicalZombiePills.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 976b080b0..141ed39df 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -91,4 +91,4 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 15:30:23 +0200 Subject: [PATCH 20/51] Fix compile error --- .../implementation/items/magical/MagicalZombiePills.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 141ed39df..89ef16aec 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -58,7 +58,7 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 15:33:48 +0200 Subject: [PATCH 21/51] Add @nonnull --- .../implementation/items/magical/MagicalZombiePills.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 89ef16aec..1b336c640 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -23,6 +23,8 @@ import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; +import javax.annotation.Nonnull; + /** * This {@link SlimefunItem} allows you to convert any {@link ZombieVillager} to * their {@link Villager} variant. It is also one of the very few utilisations of {@link EntityInteractHandler}. @@ -77,7 +79,7 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 15:37:45 +0200 Subject: [PATCH 22/51] Use instanceof --- .../items/magical/MagicalZombiePills.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 1b336c640..61d0282d2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -3,11 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Villager; -import org.bukkit.entity.ZombieVillager; +import org.bukkit.entity.*; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; @@ -50,7 +46,7 @@ public class MagicalZombiePills extends SimpleSlimefunItem { Entity entity = e.getRightClicked(); - if (entity.getType() == EntityType.ZOMBIE_VILLAGER || entity.getType() == EntityType.ZOMBIFIED_PIGLIN) { + if (entity instanceof ZombieVillager || entity instanceof PigZombie) { Player p = e.getPlayer(); if (p.getGameMode() != GameMode.CREATIVE) { @@ -59,11 +55,11 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 15:38:21 +0200 Subject: [PATCH 23/51] Fix imports --- .../implementation/items/magical/MagicalZombiePills.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 61d0282d2..9513705e4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -3,7 +3,11 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.*; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager; +import org.bukkit.entity.ZombieVillager; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; From b8c2c97766abc475e12ea9aa8fc7b010acdffcec Mon Sep 17 00:00:00 2001 From: svr333 Date: Mon, 5 Oct 2020 15:43:24 +0200 Subject: [PATCH 24/51] Add missing import --- .../implementation/items/magical/MagicalZombiePills.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 9513705e4..bb9c5ce7b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -8,6 +8,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.entity.ZombieVillager; +import org.bukkit.entity.PigZombie; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; From 0a19f767872159d6cb963230c81da0bfa403e89c Mon Sep 17 00:00:00 2001 From: svr333 Date: Mon, 5 Oct 2020 15:56:54 +0200 Subject: [PATCH 25/51] Use PigZombie over Entity --- .../implementation/items/magical/MagicalZombiePills.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index bb9c5ce7b..61b3f0b47 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -65,7 +65,7 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 10:01:38 -0400 Subject: [PATCH 26/51] Moved elytra cap to magical gadgets --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 23f8e9fed..653df9d6f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1017,10 +1017,6 @@ public final class SlimefunItemSetup { new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 20)}) .register(plugin); - new ElytraCap(categories.technicalGadgets, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE, - new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) - .register(plugin); - new PickaxeOfContainment(categories.tools, SlimefunItems.PICKAXE_OF_CONTAINMENT, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {SlimefunItems.FERROSILICON, SlimefunItems.FERROSILICON, SlimefunItems.FERROSILICON, null, SlimefunItems.GILDED_IRON, null, null, SlimefunItems.GILDED_IRON, null}) .register(plugin); @@ -1122,6 +1118,10 @@ public final class SlimefunItemSetup { new ItemStack[] {SlimefunItems.NICKEL_INGOT, SlimefunItems.ALUMINUM_DUST, SlimefunItems.IRON_DUST, SlimefunItems.COBALT_INGOT, null, null, null, null, null}) .register(plugin); + new ElytraCap(categories.magicalGadgets, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE, + new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)}) + .register(plugin); + new InfusedMagnet(categories.magicalGadgets, SlimefunItems.INFUSED_MAGNET, RecipeType.MAGIC_WORKBENCH, new ItemStack[] {SlimefunItems.MAGIC_LUMP_3, null, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ENDER_LUMP_2, SlimefunItems.MAGNET, SlimefunItems.ENDER_LUMP_2, SlimefunItems.MAGIC_LUMP_3, null, SlimefunItems.MAGIC_LUMP_3}) .register(plugin); From 58e2b9ab3b694f1e750fafc911ab6ea5e4ff33c4 Mon Sep 17 00:00:00 2001 From: Seggan Date: Mon, 5 Oct 2020 11:01:58 -0400 Subject: [PATCH 27/51] Added default annonation --- .../slimefun4/implementation/items/armor/ElytraCap.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java index ef4cc2b1c..a3457bef6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java @@ -11,6 +11,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; /** * The {@link ElytraCap} negates damage taken when crashing into a wall using an elytra. @@ -21,6 +22,7 @@ public class ElytraCap extends SlimefunArmorPiece implements DamageableItem, Pro private NamespacedKey key; + @ParametersAreNonnullByDefault public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(category, item, recipeType, recipe, null); From cff403a7b975e16910cf9d79d034792f5c2c53bd Mon Sep 17 00:00:00 2001 From: Sfiguz7 Date: Mon, 5 Oct 2020 17:15:53 +0200 Subject: [PATCH 28/51] Added blackstone and basalt to crucible's recipes --- .../slimefun4/implementation/items/blocks/Crucible.java | 6 ++++++ .../items/electric/machines/ElectrifiedCrucible.java | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java index 4ed2e7e3d..690df1e74 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java @@ -50,6 +50,12 @@ public class Crucible extends SimpleSlimefunItem implements Rec items.add(new ItemStack(Material.COBBLESTONE, 16)); items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(new ItemStack(Material.BLACKSTONE, 16)); + items.add(new ItemStack(Material.LAVA_BUCKET)); + + items.add(new ItemStack(Material.BASALT, 16)); + items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(new ItemStack(Material.NETHERRACK, 16)); items.add(new ItemStack(Material.LAVA_BUCKET)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java index 8bd212d00..6a020e0ee 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java @@ -19,6 +19,8 @@ public abstract class ElectrifiedCrucible extends AContainer { @Override protected void registerDefaultRecipes() { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.COBBLESTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.TERRACOTTA, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.OBSIDIAN) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); From 87dedf34925848c269159e11cdb706c0b839190a Mon Sep 17 00:00:00 2001 From: Sfiguz7 Date: Mon, 5 Oct 2020 17:17:16 +0200 Subject: [PATCH 29/51] Swapped order as it makes more sense + consistency --- .../items/electric/machines/ElectrifiedCrucible.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java index 6a020e0ee..40501ab19 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java @@ -19,8 +19,8 @@ public abstract class ElectrifiedCrucible extends AContainer { @Override protected void registerDefaultRecipes() { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.COBBLESTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.TERRACOTTA, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.OBSIDIAN) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); From 1d1adf9b3ee5b176236e58c2732dfad2c85c2516 Mon Sep 17 00:00:00 2001 From: Sfiguz7 Date: Mon, 5 Oct 2020 17:25:57 +0200 Subject: [PATCH 30/51] Added mc version check --- .../implementation/items/blocks/Crucible.java | 15 +++++++++------ .../electric/machines/ElectrifiedCrucible.java | 9 +++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java index 690df1e74..e34c1a48e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java @@ -7,6 +7,7 @@ import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.Tag; @@ -50,12 +51,6 @@ public class Crucible extends SimpleSlimefunItem implements Rec items.add(new ItemStack(Material.COBBLESTONE, 16)); items.add(new ItemStack(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.BLACKSTONE, 16)); - items.add(new ItemStack(Material.LAVA_BUCKET)); - - items.add(new ItemStack(Material.BASALT, 16)); - items.add(new ItemStack(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.NETHERRACK, 16)); items.add(new ItemStack(Material.LAVA_BUCKET)); @@ -78,6 +73,14 @@ public class Crucible extends SimpleSlimefunItem implements Rec items.add(new ItemStack(Material.LAVA_BUCKET)); } + if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { + items.add(new ItemStack(Material.BLACKSTONE, 16)); + items.add(new ItemStack(Material.LAVA_BUCKET)); + + items.add(new ItemStack(Material.BASALT, 16)); + items.add(new ItemStack(Material.LAVA_BUCKET)); + } + return items; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java index 40501ab19..d3e70e86f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java @@ -1,5 +1,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.inventory.ItemStack; @@ -19,8 +21,6 @@ public abstract class ElectrifiedCrucible extends AContainer { @Override protected void registerDefaultRecipes() { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.COBBLESTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.TERRACOTTA, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.OBSIDIAN) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); @@ -31,6 +31,11 @@ public abstract class ElectrifiedCrucible extends AContainer { for (Material leaves : Tag.LEAVES.getValues()) { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(leaves, 16) }, new ItemStack[] { new ItemStack(Material.WATER_BUCKET) }); } + + if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { + registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + } } @Override From fe50d962700c5093a9534d2a6fac092e150f1e2f Mon Sep 17 00:00:00 2001 From: svr333 Date: Mon, 5 Oct 2020 18:38:58 +0200 Subject: [PATCH 31/51] Remove empty line --- .../implementation/items/magical/MagicalZombiePills.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 61b3f0b47..e3ff5b1e0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -63,7 +63,6 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 19:34:00 +0200 Subject: [PATCH 32/51] Add version check --- .../implementation/items/magical/MagicalZombiePills.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index e3ff5b1e0..65a116426 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -51,7 +51,8 @@ public class MagicalZombiePills extends SimpleSlimefunItem { Entity entity = e.getRightClicked(); - if (entity instanceof ZombieVillager || entity instanceof PigZombie) { + if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16) && entity instanceof PigZombie + || entity instanceof ZombieVillager) { Player p = e.getPlayer(); if (p.getGameMode() != GameMode.CREATIVE) { From 868a7e566b0be9358354343e32638b1ccb7337ee Mon Sep 17 00:00:00 2001 From: svr333 Date: Mon, 5 Oct 2020 19:34:26 +0200 Subject: [PATCH 33/51] Change else if to else --- .../implementation/items/magical/MagicalZombiePills.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 65a116426..86125782c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -64,7 +64,7 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 20:03:50 +0200 Subject: [PATCH 34/51] Move version check Co-authored-by: TheBusyBiscuit --- .../implementation/items/magical/MagicalZombiePills.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 86125782c..c19334ea2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -64,7 +64,7 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 20:07:56 +0200 Subject: [PATCH 35/51] Extract to method && remove redundant if statement --- .../items/magical/MagicalZombiePills.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index c19334ea2..7baf9f181 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.entity.ZombieVillager; import org.bukkit.entity.PigZombie; +import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; @@ -50,23 +51,15 @@ public class MagicalZombiePills extends SimpleSlimefunItem { Entity entity = e.getRightClicked(); + Player p = e.getPlayer(); - if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16) && entity instanceof PigZombie - || entity instanceof ZombieVillager) { - Player p = e.getPlayer(); - - if (p.getGameMode() != GameMode.CREATIVE) { - ItemUtils.consumeItem(item, false); - } - - p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1, 1); - - if (entity instanceof ZombieVillager) { - healZombieVillager((ZombieVillager) entity, p); - } - else if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16) && entity instanceof PigZombie) { - healZombifiedPiglin((PigZombie) entity); - } + if (entity instanceof ZombieVillager) { + useItem(p); + healZombieVillager((ZombieVillager) entity, p); + } + else if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16) && entity instanceof PigZombie) { + useItem(p); + healZombifiedPiglin((PigZombie) entity); } }; } @@ -80,6 +73,14 @@ public class MagicalZombiePills extends SimpleSlimefunItem Date: Mon, 5 Oct 2020 22:50:32 +0200 Subject: [PATCH 36/51] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99252737f..b5a3670d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ * Added a config option for Grappling Hooks to not be consumed on use * Added Talisman of the Caveman * You can now convert any gold ingot into gold dust with slightly less returns +* Magical Zombie Pills now also work on Zombified Piglins * (API) Added SlimefunGuideOpenEvent #### Changes From 4b3e31a8c7b03c91cbd984143841779d269bd2af Mon Sep 17 00:00:00 2001 From: Seggan Date: Mon, 5 Oct 2020 16:56:25 -0400 Subject: [PATCH 37/51] Renamed listener --- .../slimefun4/implementation/SlimefunPlugin.java | 4 ++-- .../{ElytraCapListener.java => ElytraCrashListener.java} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/{ElytraCapListener.java => ElytraCrashListener.java} (94%) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index e12cdcf3c..2944e4621 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -62,7 +62,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; -import io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCapListener; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCrashListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener; @@ -453,7 +453,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { new EntityInteractionListener(this); new MobDropListener(this); new VillagerTradingListener(this); - new ElytraCapListener(this); + new ElytraCrashListener(this); if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { new BeeListener(this); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java similarity index 94% rename from src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java index 3460ac580..8f43a7b28 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCapListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java @@ -23,9 +23,9 @@ import java.util.Arrays; * * @author Seggan */ -public class ElytraCapListener implements Listener { +public class ElytraCrashListener implements Listener { - public ElytraCapListener(@Nonnull SlimefunPlugin plugin) { + public ElytraCrashListener(@Nonnull SlimefunPlugin plugin) { plugin.getServer().getPluginManager().registerEvents(this, plugin); } From a4dc1428bc5bc52362c95ac3049079cbe12d977d Mon Sep 17 00:00:00 2001 From: Seggan Date: Mon, 5 Oct 2020 17:02:09 -0400 Subject: [PATCH 38/51] Changed protection check (untested) --- .../listeners/ElytraCrashListener.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java index 8f43a7b28..f26d569b6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java @@ -1,5 +1,6 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; +import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectiveArmor; @@ -17,6 +18,7 @@ import org.bukkit.inventory.ItemStack; import javax.annotation.Nonnull; import java.util.Arrays; +import java.util.Optional; /** * The {@link Listener} for the {@link ElytraCap}. @@ -41,12 +43,19 @@ public class ElytraCrashListener implements Listener { SlimefunItem item = SlimefunItem.getByItem(stack); if (!Slimefun.hasUnlocked(p, item, true)) return; if (item instanceof ProtectiveArmor) { - if (!Arrays.asList(((ProtectiveArmor) item).getProtectionTypes()) - .contains(ProtectionType.FLYING_INTO_WALL)) return; - e.setDamage(0); - p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); - if (p.getGameMode() != GameMode.CREATIVE && item instanceof DamageableItem) { - ((DamageableItem) item).damageItem(p, stack); + Optional optional = PlayerProfile.find(p); + if (!optional.isPresent()) { + PlayerProfile.request(p); + return; + } + PlayerProfile profile = optional.get(); + + if (profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { + e.setDamage(0); + p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); + if (p.getGameMode() != GameMode.CREATIVE && item instanceof DamageableItem) { + ((DamageableItem) item).damageItem(p, stack); + } } } } From db6295616e9e7ef3ed891c41ea0b2b9d57765ed5 Mon Sep 17 00:00:00 2001 From: Seggan Date: Mon, 5 Oct 2020 17:05:05 -0400 Subject: [PATCH 39/51] Did more requested changes --- .../slimefun4/implementation/SlimefunPlugin.java | 1 + .../slimefun4/implementation/items/armor/ElytraCap.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index 2944e4621..0a237ef2a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -12,6 +12,7 @@ import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; + import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Server; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java index a3457bef6..3028015ad 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java @@ -17,10 +17,12 @@ import javax.annotation.ParametersAreNonnullByDefault; * The {@link ElytraCap} negates damage taken when crashing into a wall using an elytra. * * @author Seggan + * + * @see io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCrashListener */ public class ElytraCap extends SlimefunArmorPiece implements DamageableItem, ProtectiveArmor { - private NamespacedKey key; + private final NamespacedKey key; @ParametersAreNonnullByDefault public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { From f98d048b557a3b55e7f992e4ebc06c3a83a9f6ff Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 6 Oct 2020 20:20:02 +0200 Subject: [PATCH 40/51] [CI skip] Reduced technical debt --- .../core/commands/SlimefunCommand.java | 5 +++- .../items/magical/MagicalZombiePills.java | 7 ++--- .../items/tools/GrapplingHook.java | 28 ++++++++++++++----- .../items/tools/TapeMeasure.java | 1 - .../listeners/GrapplingHookEntity.java | 10 +++---- 5 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java index 8fd253456..5bbc09820 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java @@ -83,7 +83,10 @@ public class SlimefunCommand implements CommandExecutor, Listener { sendHelp(sender); - return true; + // We could just return true here, but if there's no subcommands, then + // something went horribly wrong anyway. This will also stop sonarcloud + // from nagging about this always returning true... + return !commands.isEmpty(); } public void sendHelp(@Nonnull CommandSender sender) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 7baf9f181..5d114ee63 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -1,15 +1,16 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical; +import javax.annotation.Nonnull; + import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.PigZombie; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.entity.ZombieVillager; -import org.bukkit.entity.PigZombie; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; @@ -25,8 +26,6 @@ import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; -import javax.annotation.Nonnull; - /** * This {@link SlimefunItem} allows you to convert any {@link ZombieVillager} to * their {@link Villager} variant. It is also one of the very few utilisations of {@link EntityInteractHandler}. diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GrapplingHook.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GrapplingHook.java index 0a9b9cb8f..8b521ecdd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GrapplingHook.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GrapplingHook.java @@ -2,6 +2,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.tools; import java.util.UUID; +import javax.annotation.ParametersAreNonnullByDefault; + import org.bukkit.Material; import org.bukkit.entity.Arrow; import org.bukkit.entity.Bat; @@ -12,19 +14,33 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; +import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener; 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; +/** + * The {@link GrapplingHook} is a simple {@link SlimefunItem} which allows a {@link Player} + * to launch towards a target destination via right click. + * It also has a cool visual effect where it shows a leash following a fired {@link Arrow}. + * + * @author TheBusyBiscuit + * + * @see GrapplingHookListener + * + */ public class GrapplingHook extends SimpleSlimefunItem { private final ItemSetting consumeOnUse = new ItemSetting<>("consume-on-use", true); private final ItemSetting despawnTicks = new ItemSetting<>("despawn-seconds", 60); + @ParametersAreNonnullByDefault public GrapplingHook(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(category, item, recipeType, recipe); @@ -37,7 +53,7 @@ public class GrapplingHook extends SimpleSlimefunItem { return e -> { Player p = e.getPlayer(); UUID uuid = p.getUniqueId(); - boolean consumeOnUseValue = consumeOnUse.getValue(); + boolean isConsumed = consumeOnUse.getValue(); if (!e.getClickedBlock().isPresent() && !SlimefunPlugin.getGrapplingHookListener().isGrappling(uuid)) { e.cancel(); @@ -49,11 +65,9 @@ public class GrapplingHook extends SimpleSlimefunItem { ItemStack item = e.getItem(); - if (item.getType() == Material.LEAD) { - //If consume on use is enabled, the if statement below will take 1 grappling hook out of player's hand - if (consumeOnUseValue) { - item.setAmount(item.getAmount() - 1); - } + if (item.getType() == Material.LEAD && isConsumed) { + // If consume on use is enabled, consume one item + ItemUtils.consumeItem(item, false); } Vector direction = p.getEyeLocation().getDirection().multiply(2.0); @@ -69,7 +83,7 @@ public class GrapplingHook extends SimpleSlimefunItem { bat.setLeashHolder(arrow); boolean state = item.getType() != Material.SHEARS; - SlimefunPlugin.getGrapplingHookListener().addGrapplingHook(p, arrow, bat, state, despawnTicks.getValue(), consumeOnUseValue); + SlimefunPlugin.getGrapplingHookListener().addGrapplingHook(p, arrow, bat, state, despawnTicks.getValue(), isConsumed); } }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TapeMeasure.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TapeMeasure.java index c9fb3cd54..d4a6bb326 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TapeMeasure.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TapeMeasure.java @@ -76,7 +76,6 @@ public class TapeMeasure extends SimpleSlimefunItem implements N SlimefunPlugin.getLocalization().sendMessage(p, "messages.tape-measure.anchor-set", msg -> msg.replace("%anchor%", anchor)); item.setItemMeta(meta); - } @Nonnull diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GrapplingHookEntity.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GrapplingHookEntity.java index 57cfa4c9b..f4572f3a4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GrapplingHookEntity.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GrapplingHookEntity.java @@ -33,12 +33,10 @@ final class GrapplingHookEntity { } public void drop(@Nonnull Location l) { - if (dropItem) { - //If a grappling hook was consumed, then the below if statement will be executed and will drop one grappling hook on the floor - if (wasConsumed) { - Item item = l.getWorld().dropItem(l, SlimefunItems.GRAPPLING_HOOK.clone()); - item.setPickupDelay(16); - } + // If a grappling hook was consumed, drop one grappling hook on the floor + if (dropItem && wasConsumed) { + Item item = l.getWorld().dropItem(l, SlimefunItems.GRAPPLING_HOOK.clone()); + item.setPickupDelay(16); } } From 07c84af3b56d2373efab00ac940ef14922b18649 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 6 Oct 2020 21:01:18 +0200 Subject: [PATCH 41/51] Added NotConfigurable attribute --- CHANGELOG.md | 2 + .../core/attributes/NotConfigurable.java | 14 +++ .../Objects/SlimefunItem/SlimefunItem.java | 103 +++++++++++++----- 3 files changed, 91 insertions(+), 28 deletions(-) create mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a3670d8..032d02aeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ * You can now convert any gold ingot into gold dust with slightly less returns * Magical Zombie Pills now also work on Zombified Piglins * (API) Added SlimefunGuideOpenEvent +* (API) Added "NotConfigurable" attribute to disable configurability #### Changes * Improved Auto-Updater (Multi-Threading and more) @@ -59,6 +60,7 @@ * Fixed #2357 * Fixed Auto Enchanters being unaffected by speed modifications from addons * Fixed Auto Disenchanters being unaffected by speed modifications from addons +* Fixed radioactive items still being radioactive when disabled ## Release Candidate 16 (07 Sep 2020) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#16 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java new file mode 100644 index 000000000..8d52d32c7 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java @@ -0,0 +1,14 @@ +package io.github.thebusybiscuit.slimefun4.core.attributes; + +import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; + +/** + * Implement this interface for any {@link SlimefunItem} to prevent + * that {@link SlimefunItem} from showing up in the {@code Items.yml} config file. + * + * @author TheBusyBiscuit + * + */ +public interface NotConfigurable { + +} diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java index 1800613fa..ca4f39e17 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java @@ -8,6 +8,7 @@ import java.util.Optional; import java.util.Set; import java.util.function.Consumer; import java.util.logging.Level; +import java.util.logging.Logger; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -30,6 +31,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.UnregisteredItemExcepti import io.github.thebusybiscuit.slimefun4.api.exceptions.WrongItemStackException; import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; import io.github.thebusybiscuit.slimefun4.api.items.ItemState; +import io.github.thebusybiscuit.slimefun4.core.attributes.NotConfigurable; import io.github.thebusybiscuit.slimefun4.core.attributes.Placeable; import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactive; import io.github.thebusybiscuit.slimefun4.core.attributes.Rechargeable; @@ -360,15 +362,18 @@ public class SlimefunItem implements Placeable { SlimefunPlugin.getRegistry().getAllSlimefunItems().add(this); SlimefunPlugin.getRegistry().getSlimefunItemIds().put(id, this); - SlimefunPlugin.getItemCfg().setDefaultValue(id + ".enabled", true); - SlimefunPlugin.getItemCfg().setDefaultValue(id + ".can-be-used-in-workbenches", useableInWorkbench); - SlimefunPlugin.getItemCfg().setDefaultValue(id + ".hide-in-guide", hidden); - SlimefunPlugin.getItemCfg().setDefaultValue(id + ".allow-enchanting", enchantable); - SlimefunPlugin.getItemCfg().setDefaultValue(id + ".allow-disenchanting", disenchantable); + // Items that are "not-configurable" cannot be configured. + if (!(this instanceof NotConfigurable)) { + SlimefunPlugin.getItemCfg().setDefaultValue(id + ".enabled", true); + SlimefunPlugin.getItemCfg().setDefaultValue(id + ".can-be-used-in-workbenches", useableInWorkbench); + SlimefunPlugin.getItemCfg().setDefaultValue(id + ".hide-in-guide", hidden); + SlimefunPlugin.getItemCfg().setDefaultValue(id + ".allow-enchanting", enchantable); + SlimefunPlugin.getItemCfg().setDefaultValue(id + ".allow-disenchanting", disenchantable); - // Load all item settings - for (ItemSetting setting : itemSettings) { - setting.load(this); + // Load all item settings + for (ItemSetting setting : itemSettings) { + setting.load(this); + } } if (ticking && !SlimefunPlugin.getCfg().getBoolean("URID.enable-tickers")) { @@ -376,26 +381,17 @@ public class SlimefunItem implements Placeable { return; } - if (this instanceof Radioactive) { - SlimefunPlugin.getRegistry().getRadioactiveItems().add(this); - } - - if (SlimefunPlugin.getItemCfg().getBoolean(id + ".enabled")) { - - if (!category.isRegistered()) { - category.register(); - } - + if (this instanceof NotConfigurable) { + // Not-configurable items will be enabled. + // Any other settings will remain as default. + state = ItemState.ENABLED; + } + else if (SlimefunPlugin.getItemCfg().getBoolean(id + ".enabled")) { state = ItemState.ENABLED; - checkForDeprecations(getClass()); - useableInWorkbench = SlimefunPlugin.getItemCfg().getBoolean(id + ".can-be-used-in-workbenches"); hidden = SlimefunPlugin.getItemCfg().getBoolean(id + ".hide-in-guide"); enchantable = SlimefunPlugin.getItemCfg().getBoolean(id + ".allow-enchanting"); disenchantable = SlimefunPlugin.getItemCfg().getBoolean(id + ".allow-disenchanting"); - - SlimefunPlugin.getRegistry().getEnabledSlimefunItems().add(this); - loadItemHandlers(); } else if (this instanceof VanillaItem) { state = ItemState.VANILLA_FALLBACK; @@ -404,19 +400,43 @@ public class SlimefunItem implements Placeable { state = ItemState.DISABLED; } + // Now we can be certain this item should be enabled + if (state == ItemState.ENABLED) { + // Register the Category too if it hasn't been registered yet + if (!category.isRegistered()) { + category.register(); + } + + // Send out deprecation warnings for any classes or intefaces + checkForDeprecations(getClass()); + + // Add it to the list of enabled items + SlimefunPlugin.getRegistry().getEnabledSlimefunItems().add(this); + + // Load our Item Handlers + loadItemHandlers(); + + // Properly mark this Item as radioactive + if (this instanceof Radioactive) { + SlimefunPlugin.getRegistry().getRadioactiveItems().add(this); + } + } + + // Lock the SlimefunItemStack from any accidental manipulations if (item instanceof SlimefunItemStack && isItemStackImmutable()) { ((SlimefunItemStack) item).lock(); } postRegister(); + // handle runtime-registrations / auto-loading if (SlimefunPlugin.getRegistry().isAutoLoadingEnabled() && state == ItemState.ENABLED) { info("Item was registered during runtime."); load(); } } catch (Exception x) { - error("Registering " + toString() + " has failed", x); + error("Registering " + toString() + " has failed!", x); } } @@ -464,7 +484,7 @@ public class SlimefunItem implements Placeable { * @param c * The {@link Class} from which to start this operation. */ - private void checkForDeprecations(Class c) { + private void checkForDeprecations(@Nullable Class c) { if (SlimefunPlugin.getUpdater().getBranch() == SlimefunBranch.DEVELOPMENT) { // This method is currently way too spammy with all the restructuring going on... // Since DEV builds are anyway under "development", things may be relocated. @@ -526,6 +546,12 @@ public class SlimefunItem implements Placeable { this.recipeType = type; } + /** + * This sets the {@link Category} in which this {@link SlimefunItem} will be displayed. + * + * @param category + * The new {@link Category} + */ public void setCategory(@Nonnull Category category) { Validate.notNull(category, "The Category is not allowed to be null!"); @@ -590,6 +616,7 @@ public class SlimefunItem implements Placeable { return false; } + // If the given item is a SlimefunitemStack, simply compare the id if (item instanceof SlimefunItemStack) { return getID().equals(((SlimefunItemStack) item).getItemId()); } @@ -670,6 +697,10 @@ public class SlimefunItem implements Placeable { throw new UnsupportedOperationException("You cannot add an ItemSetting after the SlimefunItem was registered."); } + if (this instanceof NotConfigurable) { + throw new UnsupportedOperationException("This Item has been marked as NotConfigurable and cannot accept Item Settings!"); + } + for (ItemSetting setting : settings) { if (setting != null) { // Prevent two Item Settings with the same key @@ -817,12 +848,28 @@ public class SlimefunItem implements Placeable { return getDrops(); } - public void info(String message) { + /** + * This will send an info message to the console and signal that this message came + * from this {@link SlimefunItem}, the message will be sent using the {@link Logger} + * of the {@link SlimefunAddon} which registered this {@link SlimefunItem}. + * + * @param message + * The message to send + */ + public void info(@Nonnull String message) { String msg = toString() + ": " + message; addon.getLogger().log(Level.INFO, msg); } - public void warn(String message) { + /** + * This will send a warning to the console and signal that this warning came from + * this {@link SlimefunItem}, the warning will be sent using the {@link Logger} + * of the {@link SlimefunAddon} which registered this {@link SlimefunItem}. + * + * @param message + * The message to send + */ + public void warn(@Nonnull String message) { String msg = toString() + ": " + message; addon.getLogger().log(Level.WARNING, msg); @@ -841,7 +888,7 @@ public class SlimefunItem implements Placeable { * @param throwable * The {@link Throwable} to throw as a stacktrace. */ - public void error(String message, Throwable throwable) { + public void error(@Nonnull String message, @Nonnull Throwable throwable) { addon.getLogger().log(Level.SEVERE, "Item \"{0}\" from {1} v{2} has caused an Error!", new Object[] { id, addon.getName(), addon.getPluginVersion() }); if (addon.getBugTrackerURL() != null) { From d09a7e0f93c9617337832bf50cd3cfbe4e14d79c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 6 Oct 2020 21:05:39 +0200 Subject: [PATCH 42/51] Fixes #2391 --- CHANGELOG.md | 1 + .../me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 032d02aeb..681bb6b07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ * Fixed Auto Enchanters being unaffected by speed modifications from addons * Fixed Auto Disenchanters being unaffected by speed modifications from addons * Fixed radioactive items still being radioactive when disabled +* Fixed #2391 ## Release Candidate 16 (07 Sep 2020) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#16 diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java index 20fda5505..066e5d40f 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java @@ -127,6 +127,7 @@ public class DirtyChestMenu extends ChestMenu { if (ItemUtils.canStack(wrapper, stack)) { amount -= (stack.getMaxStackSize() - stack.getAmount()); + item.setAmount(amount); stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), stack.getMaxStackSize())); } } From d1ede58f85ad6d51d2229418f859c432eaf90fa4 Mon Sep 17 00:00:00 2001 From: Seggan Date: Tue, 6 Oct 2020 15:12:35 -0400 Subject: [PATCH 43/51] More requested changes... --- .../implementation/items/armor/ElytraCap.java | 3 +- .../listeners/ElytraCrashListener.java | 38 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java index 3028015ad..cdeef8ca3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/ElytraCap.java @@ -4,6 +4,7 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectiveArmor; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCrashListener; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; @@ -18,7 +19,7 @@ import javax.annotation.ParametersAreNonnullByDefault; * * @author Seggan * - * @see io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCrashListener + * @see ElytraCrashListener */ public class ElytraCap extends SlimefunArmorPiece implements DamageableItem, ProtectiveArmor { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java index f26d569b6..a79edaa73 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java @@ -1,5 +1,6 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; +import io.github.thebusybiscuit.slimefun4.api.items.HashedArmorpiece; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; @@ -39,22 +40,27 @@ public class ElytraCrashListener implements Listener { Player p = (Player) e.getEntity(); if (p.isGliding()) { - ItemStack stack = p.getInventory().getHelmet(); - SlimefunItem item = SlimefunItem.getByItem(stack); - if (!Slimefun.hasUnlocked(p, item, true)) return; - if (item instanceof ProtectiveArmor) { - Optional optional = PlayerProfile.find(p); - if (!optional.isPresent()) { - PlayerProfile.request(p); - return; - } - PlayerProfile profile = optional.get(); - - if (profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { - e.setDamage(0); - p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); - if (p.getGameMode() != GameMode.CREATIVE && item instanceof DamageableItem) { - ((DamageableItem) item).damageItem(p, stack); + Optional optional = PlayerProfile.find(p); + if (!optional.isPresent()) { + PlayerProfile.request(p); + return; + } + PlayerProfile profile = optional.get(); + HashedArmorpiece helmet = profile.getArmor()[0]; + SlimefunItem item; + if (helmet.getItem().isPresent()) { + item = helmet.getItem().get(); + } else { + return; + } + if (Slimefun.hasUnlocked(p, item, true)) { + if (item instanceof ProtectiveArmor) { + if (profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { + e.setDamage(0); + p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); + if (p.getGameMode() != GameMode.CREATIVE && item instanceof DamageableItem) { + ((DamageableItem) item).damageItem(p, p.getInventory().getHelmet()); + } } } } From 20aa5d49dc327745f65c5db9a3079a830f522b76 Mon Sep 17 00:00:00 2001 From: Seggan Date: Tue, 6 Oct 2020 15:34:37 -0400 Subject: [PATCH 44/51] Merged ifs --- .../listeners/ElytraCrashListener.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java index a79edaa73..9de71294d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java @@ -50,17 +50,12 @@ public class ElytraCrashListener implements Listener { SlimefunItem item; if (helmet.getItem().isPresent()) { item = helmet.getItem().get(); - } else { - return; - } - if (Slimefun.hasUnlocked(p, item, true)) { - if (item instanceof ProtectiveArmor) { - if (profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { - e.setDamage(0); - p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); - if (p.getGameMode() != GameMode.CREATIVE && item instanceof DamageableItem) { - ((DamageableItem) item).damageItem(p, p.getInventory().getHelmet()); - } + if (Slimefun.hasUnlocked(p, item, true) + && profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { + e.setDamage(0); + p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); + if (p.getGameMode() != GameMode.CREATIVE && item instanceof DamageableItem) { + ((DamageableItem) item).damageItem(p, p.getInventory().getHelmet()); } } } From 960d53840a8b4f3b30f654cd71931627b5cde6e1 Mon Sep 17 00:00:00 2001 From: Seggan Date: Tue, 6 Oct 2020 15:39:15 -0400 Subject: [PATCH 45/51] Moved import --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 653df9d6f..891c0728a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -5,7 +5,6 @@ import java.util.List; import javax.annotation.Nonnull; -import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,6 +38,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.armor.HazmatArmor import io.github.thebusybiscuit.slimefun4.implementation.items.armor.Parachute; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.StomperBoots; +import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler; import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.EnderBackpack; import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.RestoredBackpack; From 1ccd4c14ac0dd6b4c9e2d87e92f3c14ae0911c0f Mon Sep 17 00:00:00 2001 From: Seggan Date: Tue, 6 Oct 2020 15:41:14 -0400 Subject: [PATCH 46/51] More changes... --- .../implementation/listeners/ElytraCrashListener.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java index 9de71294d..d01992c45 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraCrashListener.java @@ -47,9 +47,8 @@ public class ElytraCrashListener implements Listener { } PlayerProfile profile = optional.get(); HashedArmorpiece helmet = profile.getArmor()[0]; - SlimefunItem item; if (helmet.getItem().isPresent()) { - item = helmet.getItem().get(); + SlimefunItem item = helmet.getItem().get(); if (Slimefun.hasUnlocked(p, item, true) && profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { e.setDamage(0); From f8be44782199f1b2a03a3f9260665dc344b9ec27 Mon Sep 17 00:00:00 2001 From: Sfiguz7 Date: Wed, 7 Oct 2020 13:32:10 +0200 Subject: [PATCH 47/51] Fixes #2403 --- .../me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java index 066e5d40f..86696d817 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java @@ -127,8 +127,8 @@ public class DirtyChestMenu extends ChestMenu { if (ItemUtils.canStack(wrapper, stack)) { amount -= (stack.getMaxStackSize() - stack.getAmount()); - item.setAmount(amount); stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), stack.getMaxStackSize())); + item.setAmount(amount); } } } From 46dca73e04469a400f355018e58ccbe7b5beb71e Mon Sep 17 00:00:00 2001 From: Sfiguz7 Date: Wed, 7 Oct 2020 13:36:11 +0200 Subject: [PATCH 48/51] Forgot to clean crucible changes off --- .../implementation/items/blocks/Crucible.java | 41 +++++++------------ .../machines/ElectrifiedCrucible.java | 14 ++----- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java index e34c1a48e..c5a5a04bc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java @@ -1,23 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.blocks; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; - -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; - -import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.Tag; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.data.Levelled; -import org.bukkit.block.data.Waterlogged; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem; @@ -29,6 +11,21 @@ import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.Tag; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Levelled; +import org.bukkit.block.data.Waterlogged; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; public class Crucible extends SimpleSlimefunItem implements RecipeDisplayItem { @@ -73,14 +70,6 @@ public class Crucible extends SimpleSlimefunItem implements Rec items.add(new ItemStack(Material.LAVA_BUCKET)); } - if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { - items.add(new ItemStack(Material.BLACKSTONE, 16)); - items.add(new ItemStack(Material.LAVA_BUCKET)); - - items.add(new ItemStack(Material.BASALT, 16)); - items.add(new ItemStack(Material.LAVA_BUCKET)); - } - return items; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java index d3e70e86f..031d5ce8b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java @@ -1,16 +1,13 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; -import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import org.bukkit.Material; -import org.bukkit.Tag; -import org.bukkit.inventory.ItemStack; - import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; +import org.bukkit.Material; +import org.bukkit.Tag; +import org.bukkit.inventory.ItemStack; public abstract class ElectrifiedCrucible extends AContainer { @@ -31,11 +28,6 @@ public abstract class ElectrifiedCrucible extends AContainer { for (Material leaves : Tag.LEAVES.getValues()) { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(leaves, 16) }, new ItemStack[] { new ItemStack(Material.WATER_BUCKET) }); } - - if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - } } @Override From 91a7d9eacd27b2e20de4fec6d1ac2ed53930da71 Mon Sep 17 00:00:00 2001 From: Sfiguz7 Date: Wed, 7 Oct 2020 13:37:32 +0200 Subject: [PATCH 49/51] Why u do dis IntelliJ >:( --- .../implementation/items/blocks/Crucible.java | 32 ++++++++++--------- .../machines/ElectrifiedCrucible.java | 7 ++-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java index c5a5a04bc..4ed2e7e3d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java @@ -1,5 +1,22 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.blocks; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; + +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.Tag; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Levelled; +import org.bukkit.block.data.Waterlogged; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem; @@ -11,21 +28,6 @@ import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.Tag; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.data.Levelled; -import org.bukkit.block.data.Waterlogged; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; public class Crucible extends SimpleSlimefunItem implements RecipeDisplayItem { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java index 031d5ce8b..8bd212d00 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java @@ -1,13 +1,14 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; +import org.bukkit.Material; +import org.bukkit.Tag; +import org.bukkit.inventory.ItemStack; + import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; -import org.bukkit.Material; -import org.bukkit.Tag; -import org.bukkit.inventory.ItemStack; public abstract class ElectrifiedCrucible extends AContainer { From c33f73d2feaf23d7bfaf8d32ef801f9c7b749771 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Wed, 7 Oct 2020 14:30:01 +0200 Subject: [PATCH 50/51] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 681bb6b07..ae84aca7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ * Fixed Auto Disenchanters being unaffected by speed modifications from addons * Fixed radioactive items still being radioactive when disabled * Fixed #2391 +* Fixed #2403 ## Release Candidate 16 (07 Sep 2020) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#16 From 7b179239e41b6e356b5c6e0ceba25b2886a71494 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Wed, 7 Oct 2020 16:01:19 +0200 Subject: [PATCH 51/51] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae84aca7e..20b3c4609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ * Magical Zombie Pills now also work on Zombified Piglins * (API) Added SlimefunGuideOpenEvent * (API) Added "NotConfigurable" attribute to disable configurability +* Added Elytra Cap #### Changes * Improved Auto-Updater (Multi-Threading and more)