From 57be14698fa1d0612d8b03d76e892b415eed6528 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Mon, 24 Jul 2023 12:27:29 -0500 Subject: [PATCH] Reformat and add missing attribute --- build.gradle.kts | 2 +- settings.gradle.kts | 2 +- .../java/dev/plex/itemizerx/Attributes.java | 30 ++++++++------ .../dev/plex/itemizerx/CoreProtectBridge.java | 39 +++++++++++++------ .../dev/plex/itemizerx/ItemizerXCommand.java | 23 +++++------ .../itemizerx/ItemizerXCompatCommand.java | 27 ++++++------- .../java/dev/plex/itemizerx/ItemizerXTab.java | 9 +++-- .../itemizerx/v1_17_R1/AttributeManager.java | 13 ++++--- .../itemizerx.v1_18_R1/AttributeManager.java | 13 ++++--- .../itemizerx/v1_18_R2/AttributeManager.java | 13 ++++--- .../itemizerx/v1_19_R1/AttributeManager.java | 13 ++++--- .../itemizerx/v1_19_R2/AttributeManager.java | 13 ++++--- .../itemizerx/v1_19_R3/AttributeManager.java | 13 ++++--- .../itemizerx/v1_20_R1/AttributeManager.java | 13 ++++--- 14 files changed, 128 insertions(+), 95 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f034956..981fa02 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -70,7 +70,7 @@ bukkit { // Adapted from PlotSquared val supportedVersions = - listOf("1.17.1", "1.18.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20", "1.20.1") + listOf("1.17.1", "1.18.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20", "1.20.1") tasks { supportedVersions.forEach { register("runServer-$it") { diff --git a/settings.gradle.kts b/settings.gradle.kts index 8e9057c..5cb759c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version("0.5.0") + id("org.gradle.toolchains.foojay-resolver-convention") version ("0.5.0") } rootProject.name = "ItemizerX" diff --git a/shared/src/main/java/dev/plex/itemizerx/Attributes.java b/shared/src/main/java/dev/plex/itemizerx/Attributes.java index 87582c0..cf2640c 100644 --- a/shared/src/main/java/dev/plex/itemizerx/Attributes.java +++ b/shared/src/main/java/dev/plex/itemizerx/Attributes.java @@ -5,17 +5,18 @@ import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; -public enum Attributes { - +public enum Attributes +{ MAX_HEALTH("generic.max_health", 0), FOLLOW_RANGE("generic.follow_range", 1), KNOCKBACK_RESISTANCE("generic.knockback_resistance", 1), MOVEMENT_SPEED("generic.movement_speed", 1), + FLYING_SPEED("generic.flying_speed", 1), DAMAGE("generic.attack_damage", 0), + ATTACK_KNOCKBACK("generic.attack_knockback", 0), + ATTACK_SPEED("generic.attack_speed", 1), ARMOR("generic.armor", 0), ARMOR_TOUGHNESS("generic.armor_toughness", 0), - FLYING_SPEED("generic.flying_speed", 1), - ATTACK_SPEED("generic.attack_speed", 1), LUCK("generic.luck", 0), HORSE_JUMP("horse.jump_strength", 1), ZOMBIE_REINFORCEMENTS("zombie.spawn_reinforcements", 1); @@ -23,27 +24,34 @@ public enum Attributes { public final String mcName; public final int op; - Attributes(String mcName, int op) { + Attributes(String mcName, int op) + { this.mcName = mcName; this.op = op; } - public static Attributes get(String name) { - for (Attributes attr : values()) { - if (attr.name().equalsIgnoreCase(name) || attr.mcName.equalsIgnoreCase(name)) { + public static Attributes get(String name) + { + for (Attributes attr : values()) + { + if (attr.name().equalsIgnoreCase(name) || attr.mcName.equalsIgnoreCase(name)) + { return attr; } } return null; } - public static String getAttributes() { + public static String getAttributes() + { return StringUtils.join(values(), ", "); } - public static List getAttributeList() { + public static List getAttributeList() + { List attributes = new ArrayList<>(); - for (Attributes attr : values()) { + for (Attributes attr : values()) + { attributes.add(attr.name()); } return attributes; diff --git a/shared/src/main/java/dev/plex/itemizerx/CoreProtectBridge.java b/shared/src/main/java/dev/plex/itemizerx/CoreProtectBridge.java index 8c2b4a1..4a44385 100644 --- a/shared/src/main/java/dev/plex/itemizerx/CoreProtectBridge.java +++ b/shared/src/main/java/dev/plex/itemizerx/CoreProtectBridge.java @@ -5,40 +5,55 @@ import net.coreprotect.CoreProtectAPI; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; -public class CoreProtectBridge { +public class CoreProtectBridge +{ public static CoreProtect cp = null; public static CoreProtectAPI api = null; public static boolean logged = false; - public CoreProtect getCoreProtect() { - try { + public CoreProtect getCoreProtect() + { + try + { final Plugin pl = Bukkit.getPluginManager().getPlugin("CoreProtect"); - if (pl instanceof CoreProtect) { + if (pl instanceof CoreProtect) + { cp = (CoreProtect) pl; - } else { - if (!logged) { // To stop the console log spam - not persistent on server restarts + } + else + { + if (!logged) + { // To stop the console log spam - not persistent on server restarts Bukkit.getLogger().info("CoreProtect not detected, some features will not be logged!"); logged = true; } } - } catch (Exception ex) { + } + catch (Exception ex) + { ex.printStackTrace(); } return cp; } - public CoreProtectAPI getAPI() { + public CoreProtectAPI getAPI() + { final CoreProtect cp = getCoreProtect(); - if (cp != null && api == null) { - try { + if (cp != null && api == null) + { + try + { api = cp.getAPI(); - if (!cp.isEnabled() || !api.isEnabled()) { + if (!cp.isEnabled() || !api.isEnabled()) + { Bukkit.getLogger().info("CoreProtect is disabled, some features will not be logged!"); return null; } - } catch (Exception ex) { + } + catch (Exception ex) + { ex.printStackTrace(); } } diff --git a/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java b/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java index 5c91a6b..60db0e8 100644 --- a/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java +++ b/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java @@ -1,9 +1,5 @@ package dev.plex.itemizerx; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import org.apache.commons.lang3.StringUtils; @@ -27,6 +23,11 @@ import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + public class ItemizerXCommand implements CommandExecutor, ItemizerXBase { final List POTIONS = Arrays.asList(Material.POTION, Material.LINGERING_POTION, Material.SPLASH_POTION); @@ -348,7 +349,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase return true; } final PotionEffect pot = new PotionEffect(potType, tick, level); - final PotionMeta potionMeta = (PotionMeta)meta; + final PotionMeta potionMeta = (PotionMeta) meta; assert potionMeta != null; if (potionMeta.hasCustomEffect(pot.getType())) { @@ -379,7 +380,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase sender.sendMessage(mm.deserialize("The potion effect \"" + args[2] + "\" does not exist!")); return true; } - final PotionMeta potionMeta = (PotionMeta)meta; + final PotionMeta potionMeta = (PotionMeta) meta; assert potionMeta != null; if (!potionMeta.hasCustomEffect(potType)) { @@ -427,7 +428,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase sender.sendMessage(mm.deserialize("/itemizer potion color <hexcolor> - Set the potion color")); return true; } - final PotionMeta potionMeta = (PotionMeta)meta; + final PotionMeta potionMeta = (PotionMeta) meta; assert potionMeta != null; try { @@ -818,7 +819,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase return true; } Component name = mm.deserialize(StringUtils.join(args, " ", 1, args.length)); - final BookMeta bookMeta = (BookMeta)meta; + final BookMeta bookMeta = (BookMeta) meta; assert bookMeta != null; bookMeta.title(name); item.setItemMeta(bookMeta); @@ -844,7 +845,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase return true; } Component name = mm.deserialize(args[1]); - final BookMeta bookMeta = (BookMeta)meta; + final BookMeta bookMeta = (BookMeta) meta; assert bookMeta != null; bookMeta.author(name); item.setItemMeta(bookMeta); @@ -874,7 +875,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase { name = name.substring(0, 16); } - final SkullMeta skullMeta = (SkullMeta)meta; + final SkullMeta skullMeta = (SkullMeta) meta; assert skullMeta != null; skullMeta.setOwner(name); item.setItemMeta(skullMeta); @@ -915,7 +916,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase { cpb.getAPI().logRemoval(player.getName(), block.getLocation(), block.getType(), block.getBlockData()); } - Sign sign = (Sign)block.getState(); + Sign sign = (Sign) block.getState(); sign.line(line - 1, text); sign.update(); if (cpb.getAPI() != null) diff --git a/src/main/java/dev/plex/itemizerx/ItemizerXCompatCommand.java b/src/main/java/dev/plex/itemizerx/ItemizerXCompatCommand.java index 9fa6d6a..68c4946 100644 --- a/src/main/java/dev/plex/itemizerx/ItemizerXCompatCommand.java +++ b/src/main/java/dev/plex/itemizerx/ItemizerXCompatCommand.java @@ -1,11 +1,5 @@ package dev.plex.itemizerx; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -28,6 +22,13 @@ import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase { final List POTIONS = Arrays.asList(Material.POTION, Material.LINGERING_POTION, Material.SPLASH_POTION); @@ -352,7 +353,7 @@ public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase return true; } final PotionEffect pot = new PotionEffect(potType, tick, level); - final PotionMeta potionMeta = (PotionMeta)meta; + final PotionMeta potionMeta = (PotionMeta) meta; assert potionMeta != null; if (potionMeta.hasCustomEffect(pot.getType())) { @@ -383,7 +384,7 @@ public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase sender.sendMessage(colorize("&4The potion effect &f\"" + args[2] + "&f\"&4 does not exist!")); return true; } - final PotionMeta potionMeta = (PotionMeta)meta; + final PotionMeta potionMeta = (PotionMeta) meta; assert potionMeta != null; if (!potionMeta.hasCustomEffect(potType)) { @@ -434,7 +435,7 @@ public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase + "&b/itemizer potion color <&fhexcolor&b> &c- &6Set a potion color")); return true; } - final PotionMeta potionMeta = (PotionMeta)meta; + final PotionMeta potionMeta = (PotionMeta) meta; assert potionMeta != null; try { @@ -830,7 +831,7 @@ public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase return true; } String name = colorize(StringUtils.join(args, " ", 1, args.length)); - final BookMeta bookMeta = (BookMeta)meta; + final BookMeta bookMeta = (BookMeta) meta; assert bookMeta != null; bookMeta.setTitle(name); item.setItemMeta(bookMeta); @@ -856,7 +857,7 @@ public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase return true; } String name = colorize(args[1]); - final BookMeta bookMeta = (BookMeta)meta; + final BookMeta bookMeta = (BookMeta) meta; assert bookMeta != null; bookMeta.setAuthor(name); item.setItemMeta(bookMeta); @@ -886,7 +887,7 @@ public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase { name = name.substring(0, 16); } - final SkullMeta skullMeta = (SkullMeta)meta; + final SkullMeta skullMeta = (SkullMeta) meta; assert skullMeta != null; skullMeta.setOwner(name); item.setItemMeta(skullMeta); @@ -928,7 +929,7 @@ public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase { cpb.getAPI().logRemoval(player.getName(), block.getLocation(), block.getType(), block.getBlockData()); } - Sign sign = (Sign)block.getState(); + Sign sign = (Sign) block.getState(); sign.setLine(line - 1, text); sign.update(); if (cpb.getAPI() != null) diff --git a/src/main/java/dev/plex/itemizerx/ItemizerXTab.java b/src/main/java/dev/plex/itemizerx/ItemizerXTab.java index ba747de..a784df4 100644 --- a/src/main/java/dev/plex/itemizerx/ItemizerXTab.java +++ b/src/main/java/dev/plex/itemizerx/ItemizerXTab.java @@ -1,9 +1,5 @@ package dev.plex.itemizerx; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -12,6 +8,11 @@ import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; import org.bukkit.potion.PotionEffectType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + public class ItemizerXTab implements TabCompleter { @Override diff --git a/v1_17_R1/src/main/java/dev/plex/itemizerx/v1_17_R1/AttributeManager.java b/v1_17_R1/src/main/java/dev/plex/itemizerx/v1_17_R1/AttributeManager.java index f90b2ad..0af830b 100644 --- a/v1_17_R1/src/main/java/dev/plex/itemizerx/v1_17_R1/AttributeManager.java +++ b/v1_17_R1/src/main/java/dev/plex/itemizerx/v1_17_R1/AttributeManager.java @@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_17_R1; import dev.plex.itemizerx.Attributes; import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; @@ -14,6 +11,10 @@ import org.bukkit.ChatColor; import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class AttributeManager implements IAttributeManager { @Override @@ -62,7 +63,7 @@ public class AttributeManager implements IAttributeManager final ListTag attrmod = getAttrList(nms); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (c.getString("Name").equals(args[2])) { player.sendMessage(colorize("&4An attribute with the name \"&f" + args[2] + "&4\" already exists!")); @@ -116,7 +117,7 @@ public class AttributeManager implements IAttributeManager boolean r = false; for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (!c.getString("Name").equals(string)) { newList.add(nbtBase); @@ -150,7 +151,7 @@ public class AttributeManager implements IAttributeManager player.sendMessage(colorize("&2Item attributes: ")); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; player.sendMessage(colorize("&e" + Attributes.get(c.getString("AttributeName")).mcName + ", " + c.getDouble("Amount"))); } diff --git a/v1_18_R1/src/main/java/dev/plex/itemizerx.v1_18_R1/AttributeManager.java b/v1_18_R1/src/main/java/dev/plex/itemizerx.v1_18_R1/AttributeManager.java index 0a59006..2bd109c 100644 --- a/v1_18_R1/src/main/java/dev/plex/itemizerx.v1_18_R1/AttributeManager.java +++ b/v1_18_R1/src/main/java/dev/plex/itemizerx.v1_18_R1/AttributeManager.java @@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_18_R1; import dev.plex.itemizerx.Attributes; import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; @@ -14,6 +11,10 @@ import org.bukkit.ChatColor; import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class AttributeManager implements IAttributeManager { @Override @@ -62,7 +63,7 @@ public class AttributeManager implements IAttributeManager final ListTag attrmod = getAttrList(nms); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (c.getString("Name").equals(args[2])) { player.sendMessage(colorize("&4An attribute with the name \"&f" + args[2] + "&4\" already exists!")); @@ -116,7 +117,7 @@ public class AttributeManager implements IAttributeManager boolean r = false; for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (!c.getString("Name").equals(string)) { newList.add(nbtBase); @@ -150,7 +151,7 @@ public class AttributeManager implements IAttributeManager player.sendMessage(colorize("&2Item attributes: ")); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; player.sendMessage(colorize("&e" + Attributes.get(c.getString("AttributeName")).mcName + ", " + c.getDouble("Amount"))); } diff --git a/v1_18_R2/src/main/java/dev/plex/itemizerx/v1_18_R2/AttributeManager.java b/v1_18_R2/src/main/java/dev/plex/itemizerx/v1_18_R2/AttributeManager.java index 2b64039..405e1e8 100644 --- a/v1_18_R2/src/main/java/dev/plex/itemizerx/v1_18_R2/AttributeManager.java +++ b/v1_18_R2/src/main/java/dev/plex/itemizerx/v1_18_R2/AttributeManager.java @@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_18_R2; import dev.plex.itemizerx.Attributes; import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; import net.kyori.adventure.text.minimessage.MiniMessage; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -14,6 +11,10 @@ import org.apache.commons.lang.StringUtils; import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class AttributeManager implements IAttributeManager { private final MiniMessage mm = MiniMessage.miniMessage(); @@ -64,7 +65,7 @@ public class AttributeManager implements IAttributeManager final ListTag attrmod = getAttrList(nms); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (c.getString("Name").equals(args[2])) { player.sendMessage(mm.deserialize("An attribute with the name \"" + args[2] + "\" already exists!")); @@ -118,7 +119,7 @@ public class AttributeManager implements IAttributeManager boolean r = false; for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (!c.getString("Name").equals(string)) { newList.add(nbtBase); @@ -152,7 +153,7 @@ public class AttributeManager implements IAttributeManager player.sendMessage(mm.deserialize("Item attributes: ")); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; player.sendMessage(mm.deserialize("" + Attributes.get(c.getString("AttributeName")).mcName + ", " + c.getDouble("Amount"))); } diff --git a/v1_19_R1/src/main/java/dev/plex/itemizerx/v1_19_R1/AttributeManager.java b/v1_19_R1/src/main/java/dev/plex/itemizerx/v1_19_R1/AttributeManager.java index 4222c5b..e07cddf 100644 --- a/v1_19_R1/src/main/java/dev/plex/itemizerx/v1_19_R1/AttributeManager.java +++ b/v1_19_R1/src/main/java/dev/plex/itemizerx/v1_19_R1/AttributeManager.java @@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_19_R1; import dev.plex.itemizerx.Attributes; import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; import net.kyori.adventure.text.minimessage.MiniMessage; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils; import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class AttributeManager implements IAttributeManager { private final MiniMessage mm = MiniMessage.miniMessage(); @@ -64,7 +65,7 @@ public class AttributeManager implements IAttributeManager final ListTag attrmod = getAttrList(nms); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (c.getString("Name").equals(args[2])) { player.sendMessage(mm.deserialize("An attribute with the name \"" + args[2] + "\" already exists!")); @@ -118,7 +119,7 @@ public class AttributeManager implements IAttributeManager boolean r = false; for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (!c.getString("Name").equals(string)) { newList.add(nbtBase); @@ -152,7 +153,7 @@ public class AttributeManager implements IAttributeManager player.sendMessage(mm.deserialize("Item attributes: ")); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; player.sendMessage(mm.deserialize("" + Attributes.get(c.getString("AttributeName")).mcName + ", " + c.getDouble("Amount"))); } diff --git a/v1_19_R2/src/main/java/dev/plex/itemizerx/v1_19_R2/AttributeManager.java b/v1_19_R2/src/main/java/dev/plex/itemizerx/v1_19_R2/AttributeManager.java index 9c93606..a7617dd 100644 --- a/v1_19_R2/src/main/java/dev/plex/itemizerx/v1_19_R2/AttributeManager.java +++ b/v1_19_R2/src/main/java/dev/plex/itemizerx/v1_19_R2/AttributeManager.java @@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_19_R2; import dev.plex.itemizerx.Attributes; import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; import net.kyori.adventure.text.minimessage.MiniMessage; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils; import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class AttributeManager implements IAttributeManager { private final MiniMessage mm = MiniMessage.miniMessage(); @@ -64,7 +65,7 @@ public class AttributeManager implements IAttributeManager final ListTag attrmod = getAttrList(nms); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (c.getString("Name").equals(args[2])) { player.sendMessage(mm.deserialize("An attribute with the name \"" + args[2] + "\" already exists!")); @@ -118,7 +119,7 @@ public class AttributeManager implements IAttributeManager boolean r = false; for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (!c.getString("Name").equals(string)) { newList.add(nbtBase); @@ -152,7 +153,7 @@ public class AttributeManager implements IAttributeManager player.sendMessage(mm.deserialize("Item attributes: ")); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; player.sendMessage(mm.deserialize("" + Attributes.get(c.getString("AttributeName")).mcName + ", " + c.getDouble("Amount"))); } diff --git a/v1_19_R3/src/main/java/dev/plex/itemizerx/v1_19_R3/AttributeManager.java b/v1_19_R3/src/main/java/dev/plex/itemizerx/v1_19_R3/AttributeManager.java index df49d4f..1b5b8ee 100644 --- a/v1_19_R3/src/main/java/dev/plex/itemizerx/v1_19_R3/AttributeManager.java +++ b/v1_19_R3/src/main/java/dev/plex/itemizerx/v1_19_R3/AttributeManager.java @@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_19_R3; import dev.plex.itemizerx.Attributes; import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; import net.kyori.adventure.text.minimessage.MiniMessage; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils; import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class AttributeManager implements IAttributeManager { private final MiniMessage mm = MiniMessage.miniMessage(); @@ -64,7 +65,7 @@ public class AttributeManager implements IAttributeManager final ListTag attrmod = getAttrList(nms); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (c.getString("Name").equals(args[2])) { player.sendMessage(mm.deserialize("An attribute with the name \"" + args[2] + "\" already exists!")); @@ -118,7 +119,7 @@ public class AttributeManager implements IAttributeManager boolean r = false; for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (!c.getString("Name").equals(string)) { newList.add(nbtBase); @@ -152,7 +153,7 @@ public class AttributeManager implements IAttributeManager player.sendMessage(mm.deserialize("Item attributes: ")); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; player.sendMessage(mm.deserialize("" + Attributes.get(c.getString("AttributeName")).mcName + ", " + c.getDouble("Amount"))); } diff --git a/v1_20_R1/src/main/java/dev/plex/itemizerx/v1_20_R1/AttributeManager.java b/v1_20_R1/src/main/java/dev/plex/itemizerx/v1_20_R1/AttributeManager.java index 2d440f5..f6b3e47 100644 --- a/v1_20_R1/src/main/java/dev/plex/itemizerx/v1_20_R1/AttributeManager.java +++ b/v1_20_R1/src/main/java/dev/plex/itemizerx/v1_20_R1/AttributeManager.java @@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_20_R1; import dev.plex.itemizerx.Attributes; import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; import net.kyori.adventure.text.minimessage.MiniMessage; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils; import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class AttributeManager implements IAttributeManager { private final MiniMessage mm = MiniMessage.miniMessage(); @@ -64,7 +65,7 @@ public class AttributeManager implements IAttributeManager final ListTag attrmod = getAttrList(nms); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (c.getString("Name").equals(args[2])) { player.sendMessage(mm.deserialize("An attribute with the name \"" + args[2] + "\" already exists!")); @@ -118,7 +119,7 @@ public class AttributeManager implements IAttributeManager boolean r = false; for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; if (!c.getString("Name").equals(string)) { newList.add(nbtBase); @@ -152,7 +153,7 @@ public class AttributeManager implements IAttributeManager player.sendMessage(mm.deserialize("Item attributes: ")); for (Tag nbtBase : attrmod) { - final CompoundTag c = (CompoundTag)nbtBase; + final CompoundTag c = (CompoundTag) nbtBase; player.sendMessage(mm.deserialize("" + Attributes.get(c.getString("AttributeName")).mcName + ", " + c.getDouble("Amount"))); }