Reformat and add missing attribute

This commit is contained in:
2023-07-24 12:27:29 -05:00
parent a07c68e4b3
commit 57be14698f
14 changed files with 128 additions and 95 deletions

View File

@ -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("<dark_red>An attribute with the name \"<white>" + args[2] + "<dark_red>\" 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("<dark_green>Item attributes: "));
for (Tag nbtBase : attrmod)
{
final CompoundTag c = (CompoundTag)nbtBase;
final CompoundTag c = (CompoundTag) nbtBase;
player.sendMessage(mm.deserialize("<yellow>" + Attributes.get(c.getString("AttributeName")).mcName
+ ", " + c.getDouble("Amount")));
}