From 071a2ce196a71d3da3f4286a38a68de4c9e8421d Mon Sep 17 00:00:00 2001 From: Matt Worzala Date: Mon, 28 Dec 2020 14:57:39 -0500 Subject: [PATCH] Change ArrayList types to List --- .../builder/arguments/minecraft/ArgumentEntities.java | 6 +++--- src/main/java/net/minestom/server/item/ItemStack.java | 6 +++--- .../minestom/server/item/metadata/WritableBookMeta.java | 7 ++++--- .../net/minestom/server/item/metadata/WrittenBookMeta.java | 7 ++++--- .../network/packet/server/play/PlayerInfoPacket.java | 5 +++-- src/main/java/net/minestom/server/utils/NBTUtils.java | 4 ++-- .../net/minestom/server/utils/entity/EntityFinder.java | 3 ++- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java index e6462d737..66c13e647 100644 --- a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java +++ b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java @@ -16,7 +16,7 @@ import java.util.List; * Represents the target selector argument. * https://minecraft.gamepedia.com/Commands#Target_selectors */ -public class ArgumentEntities extends Argument> { +public class ArgumentEntities extends Argument> { public static final int INVALID_SYNTAX = -2; public static final int ONLY_SINGLE_ENTITY_ERROR = -3; @@ -115,12 +115,12 @@ public class ArgumentEntities extends Argument> { @NotNull @Override - public ArrayList parse(@NotNull String value) { + public List parse(@NotNull String value) { return null; } @Override - public int getConditionResult(@NotNull ArrayList value) { + public int getConditionResult(@NotNull List value) { return SUCCESS; } diff --git a/src/main/java/net/minestom/server/item/ItemStack.java b/src/main/java/net/minestom/server/item/ItemStack.java index a35131159..70dfb8b40 100644 --- a/src/main/java/net/minestom/server/item/ItemStack.java +++ b/src/main/java/net/minestom/server/item/ItemStack.java @@ -54,7 +54,7 @@ public class ItemStack implements DataContainer, PublicCloneable { private ColoredText displayName; private boolean unbreakable; - private ArrayList lore; + private List lore; private Map enchantmentMap; private List attributes; @@ -288,7 +288,7 @@ public class ItemStack implements DataContainer, PublicCloneable { * @return a modifiable list containing the item lore, can be null if not present */ @Nullable - public ArrayList getLore() { + public List getLore() { return lore; } @@ -297,7 +297,7 @@ public class ItemStack implements DataContainer, PublicCloneable { * * @param lore the item lore, can be null to remove */ - public void setLore(@Nullable ArrayList lore) { + public void setLore(@Nullable List lore) { this.lore = lore; } diff --git a/src/main/java/net/minestom/server/item/metadata/WritableBookMeta.java b/src/main/java/net/minestom/server/item/metadata/WritableBookMeta.java index 0ed54453f..2a41d3a18 100644 --- a/src/main/java/net/minestom/server/item/metadata/WritableBookMeta.java +++ b/src/main/java/net/minestom/server/item/metadata/WritableBookMeta.java @@ -7,10 +7,11 @@ import org.jglrxavpok.hephaistos.nbt.NBTString; import org.jglrxavpok.hephaistos.nbt.NBTTypes; import java.util.ArrayList; +import java.util.List; public class WritableBookMeta extends ItemMeta { - private ArrayList pages = new ArrayList<>(); + private List pages = new ArrayList<>(); /** * Gets an array list containing the book pages. @@ -20,7 +21,7 @@ public class WritableBookMeta extends ItemMeta { * @return a modifiable {@link ArrayList} containing the book pages */ @NotNull - public ArrayList getPages() { + public List getPages() { return pages; } @@ -29,7 +30,7 @@ public class WritableBookMeta extends ItemMeta { * * @param pages the pages list */ - public void setPages(@NotNull ArrayList pages) { + public void setPages(@NotNull List pages) { this.pages = pages; } diff --git a/src/main/java/net/minestom/server/item/metadata/WrittenBookMeta.java b/src/main/java/net/minestom/server/item/metadata/WrittenBookMeta.java index 5f94bf6c1..575fa102a 100644 --- a/src/main/java/net/minestom/server/item/metadata/WrittenBookMeta.java +++ b/src/main/java/net/minestom/server/item/metadata/WrittenBookMeta.java @@ -10,6 +10,7 @@ import org.jglrxavpok.hephaistos.nbt.NBTString; import org.jglrxavpok.hephaistos.nbt.NBTTypes; import java.util.ArrayList; +import java.util.List; public class WrittenBookMeta extends ItemMeta { @@ -17,7 +18,7 @@ public class WrittenBookMeta extends ItemMeta { private WrittenBookGeneration generation; private String author; private String title; - private ArrayList pages = new ArrayList<>(); + private List pages = new ArrayList<>(); /** * Gets if the book is resolved. @@ -99,7 +100,7 @@ public class WrittenBookMeta extends ItemMeta { * * @return a modifiable {@link ArrayList} with the pages of the book */ - public ArrayList getPages() { + public List getPages() { return pages; } @@ -108,7 +109,7 @@ public class WrittenBookMeta extends ItemMeta { * * @param pages the array list containing the book pages */ - public void setPages(ArrayList pages) { + public void setPages(List pages) { this.pages = pages; } diff --git a/src/main/java/net/minestom/server/network/packet/server/play/PlayerInfoPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/PlayerInfoPacket.java index ca9741dd3..40d420319 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/PlayerInfoPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/PlayerInfoPacket.java @@ -8,12 +8,13 @@ import net.minestom.server.utils.binary.BinaryWriter; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; +import java.util.List; import java.util.UUID; public class PlayerInfoPacket implements ServerPacket { public Action action; - public ArrayList playerInfos; + public List playerInfos; public PlayerInfoPacket(Action action) { this.action = action; @@ -71,7 +72,7 @@ public class PlayerInfoPacket implements ServerPacket { public static class AddPlayer extends PlayerInfo { public String name; - public ArrayList properties; + public List properties; public GameMode gameMode; public int ping; public JsonMessage displayName; // Only text diff --git a/src/main/java/net/minestom/server/utils/NBTUtils.java b/src/main/java/net/minestom/server/utils/NBTUtils.java index 47435db44..f2cac6187 100644 --- a/src/main/java/net/minestom/server/utils/NBTUtils.java +++ b/src/main/java/net/minestom/server/utils/NBTUtils.java @@ -136,7 +136,7 @@ public final class NBTUtils { } if (display.containsKey("Lore")) { NBTList loreList = display.getList("Lore"); - ArrayList lore = new ArrayList<>(); + List lore = new ArrayList<>(); for (NBTString s : loreList) { lore.add(ChatParser.toColoredText(s.getValue())); } @@ -266,7 +266,7 @@ public final class NBTUtils { } if (hasLore) { - final ArrayList lore = itemStack.getLore(); + final List lore = itemStack.getLore(); final NBTList loreNBT = new NBTList<>(NBTTypes.TAG_String); for (ColoredText line : lore) { diff --git a/src/main/java/net/minestom/server/utils/entity/EntityFinder.java b/src/main/java/net/minestom/server/utils/entity/EntityFinder.java index 88a2797f1..808c21bb2 100644 --- a/src/main/java/net/minestom/server/utils/entity/EntityFinder.java +++ b/src/main/java/net/minestom/server/utils/entity/EntityFinder.java @@ -5,6 +5,7 @@ import net.minestom.server.entity.EntityType; import net.minestom.server.utils.math.IntRange; import java.util.ArrayList; +import java.util.List; // TODO @@ -52,7 +53,7 @@ public class EntityFinder { * * @return all entities validating the conditions */ - public ArrayList find() { + public List find() { return new ArrayList<>(); }