From 07d837299ff3feae12eeeb6f37b4891f661a50f6 Mon Sep 17 00:00:00 2001 From: LinoxGH Date: Sun, 28 Jun 2020 01:07:37 +0300 Subject: [PATCH] Did the requested changes. --- .../core/attributes/ProtectionType.java | 9 +++++++++ .../items/armor/HazmatArmorPiece.java | 16 ++++++++++++++-- .../items/armor/SlimefunArmorPiece.java | 5 ++--- 3 files changed, 25 insertions(+), 5 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 c4b74703f..5fbc54eeb 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 @@ -1,5 +1,14 @@ package io.github.thebusybiscuit.slimefun4.core.attributes; +/** + * Represents the {@link ProtectionType} that a {@link CustomProtection} + * prevents the damage from. + * + * @author Linox + * + * @see CustomProtection + * + */ public enum ProtectionType { RADIATION, diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/HazmatArmorPiece.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/HazmatArmorPiece.java index 16db6724a..dc49b0c83 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/HazmatArmorPiece.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/HazmatArmorPiece.java @@ -1,20 +1,32 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.armor; +import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import io.github.thebusybiscuit.slimefun4.core.attributes.CustomProtection; import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType; +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; +/** + * Represents 1 {@link SlimefunArmorPiece} of the Hazmat armor set. + * One of the very few utilisations of {@link CustomProtection}. + * + * @author Linox + * + * @see SlimefunArmorPiece + * @see CustomProtection + * + */ public class HazmatArmorPiece extends SlimefunArmorPiece implements CustomProtection { private final ProtectionType[] types; - public HazmatArmorPiece(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects, String setID) { - super(category, item, recipeType, recipe, effects, setID); + public HazmatArmorPiece(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects) { + super(category, item, recipeType, recipe, effects, new NamespacedKey(SlimefunPlugin.instance, "hazmat_suit")); types = new ProtectionType[] {ProtectionType.BEES, ProtectionType.RADIATION}; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/SlimefunArmorPiece.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/SlimefunArmorPiece.java index 9d48d6a40..306238eb1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/SlimefunArmorPiece.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/SlimefunArmorPiece.java @@ -22,10 +22,9 @@ public class SlimefunArmorPiece extends SlimefunItem { this.effects = effects == null ? new PotionEffect[0] : effects; } - public SlimefunArmorPiece(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects, String setId) { + public SlimefunArmorPiece(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects, NamespacedKey setId) { this(category, item, recipeType, recipe, effects); - - this.id = new NamespacedKey(SlimefunPlugin.instance, setId); + this.id = setId; } /**