Change ArrayList types to List

This commit is contained in:
Matt Worzala 2020-12-28 14:57:39 -05:00
parent f77ec96f25
commit 071a2ce196
No known key found for this signature in database
GPG Key ID: 046D16088BA8F7DD
7 changed files with 21 additions and 17 deletions

View File

@ -16,7 +16,7 @@ import java.util.List;
* Represents the target selector argument. * Represents the target selector argument.
* https://minecraft.gamepedia.com/Commands#Target_selectors * https://minecraft.gamepedia.com/Commands#Target_selectors
*/ */
public class ArgumentEntities extends Argument<ArrayList<Entity>> { public class ArgumentEntities extends Argument<List<Entity>> {
public static final int INVALID_SYNTAX = -2; public static final int INVALID_SYNTAX = -2;
public static final int ONLY_SINGLE_ENTITY_ERROR = -3; public static final int ONLY_SINGLE_ENTITY_ERROR = -3;
@ -115,12 +115,12 @@ public class ArgumentEntities extends Argument<ArrayList<Entity>> {
@NotNull @NotNull
@Override @Override
public ArrayList<Entity> parse(@NotNull String value) { public List<Entity> parse(@NotNull String value) {
return null; return null;
} }
@Override @Override
public int getConditionResult(@NotNull ArrayList<Entity> value) { public int getConditionResult(@NotNull List<Entity> value) {
return SUCCESS; return SUCCESS;
} }

View File

@ -54,7 +54,7 @@ public class ItemStack implements DataContainer, PublicCloneable<ItemStack> {
private ColoredText displayName; private ColoredText displayName;
private boolean unbreakable; private boolean unbreakable;
private ArrayList<ColoredText> lore; private List<ColoredText> lore;
private Map<Enchantment, Short> enchantmentMap; private Map<Enchantment, Short> enchantmentMap;
private List<ItemAttribute> attributes; private List<ItemAttribute> attributes;
@ -288,7 +288,7 @@ public class ItemStack implements DataContainer, PublicCloneable<ItemStack> {
* @return a modifiable list containing the item lore, can be null if not present * @return a modifiable list containing the item lore, can be null if not present
*/ */
@Nullable @Nullable
public ArrayList<ColoredText> getLore() { public List<ColoredText> getLore() {
return lore; return lore;
} }
@ -297,7 +297,7 @@ public class ItemStack implements DataContainer, PublicCloneable<ItemStack> {
* *
* @param lore the item lore, can be null to remove * @param lore the item lore, can be null to remove
*/ */
public void setLore(@Nullable ArrayList<ColoredText> lore) { public void setLore(@Nullable List<ColoredText> lore) {
this.lore = lore; this.lore = lore;
} }

View File

@ -7,10 +7,11 @@ import org.jglrxavpok.hephaistos.nbt.NBTString;
import org.jglrxavpok.hephaistos.nbt.NBTTypes; import org.jglrxavpok.hephaistos.nbt.NBTTypes;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class WritableBookMeta extends ItemMeta { public class WritableBookMeta extends ItemMeta {
private ArrayList<String> pages = new ArrayList<>(); private List<String> pages = new ArrayList<>();
/** /**
* Gets an array list containing the book pages. * 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 * @return a modifiable {@link ArrayList} containing the book pages
*/ */
@NotNull @NotNull
public ArrayList<String> getPages() { public List<String> getPages() {
return pages; return pages;
} }
@ -29,7 +30,7 @@ public class WritableBookMeta extends ItemMeta {
* *
* @param pages the pages list * @param pages the pages list
*/ */
public void setPages(@NotNull ArrayList<String> pages) { public void setPages(@NotNull List<String> pages) {
this.pages = pages; this.pages = pages;
} }

View File

@ -10,6 +10,7 @@ import org.jglrxavpok.hephaistos.nbt.NBTString;
import org.jglrxavpok.hephaistos.nbt.NBTTypes; import org.jglrxavpok.hephaistos.nbt.NBTTypes;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class WrittenBookMeta extends ItemMeta { public class WrittenBookMeta extends ItemMeta {
@ -17,7 +18,7 @@ public class WrittenBookMeta extends ItemMeta {
private WrittenBookGeneration generation; private WrittenBookGeneration generation;
private String author; private String author;
private String title; private String title;
private ArrayList<JsonMessage> pages = new ArrayList<>(); private List<JsonMessage> pages = new ArrayList<>();
/** /**
* Gets if the book is resolved. * 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 * @return a modifiable {@link ArrayList} with the pages of the book
*/ */
public ArrayList<JsonMessage> getPages() { public List<JsonMessage> getPages() {
return pages; return pages;
} }
@ -108,7 +109,7 @@ public class WrittenBookMeta extends ItemMeta {
* *
* @param pages the array list containing the book pages * @param pages the array list containing the book pages
*/ */
public void setPages(ArrayList<JsonMessage> pages) { public void setPages(List<JsonMessage> pages) {
this.pages = pages; this.pages = pages;
} }

View File

@ -8,12 +8,13 @@ import net.minestom.server.utils.binary.BinaryWriter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
public class PlayerInfoPacket implements ServerPacket { public class PlayerInfoPacket implements ServerPacket {
public Action action; public Action action;
public ArrayList<PlayerInfo> playerInfos; public List<PlayerInfo> playerInfos;
public PlayerInfoPacket(Action action) { public PlayerInfoPacket(Action action) {
this.action = action; this.action = action;
@ -71,7 +72,7 @@ public class PlayerInfoPacket implements ServerPacket {
public static class AddPlayer extends PlayerInfo { public static class AddPlayer extends PlayerInfo {
public String name; public String name;
public ArrayList<Property> properties; public List<Property> properties;
public GameMode gameMode; public GameMode gameMode;
public int ping; public int ping;
public JsonMessage displayName; // Only text public JsonMessage displayName; // Only text

View File

@ -136,7 +136,7 @@ public final class NBTUtils {
} }
if (display.containsKey("Lore")) { if (display.containsKey("Lore")) {
NBTList<NBTString> loreList = display.getList("Lore"); NBTList<NBTString> loreList = display.getList("Lore");
ArrayList<ColoredText> lore = new ArrayList<>(); List<ColoredText> lore = new ArrayList<>();
for (NBTString s : loreList) { for (NBTString s : loreList) {
lore.add(ChatParser.toColoredText(s.getValue())); lore.add(ChatParser.toColoredText(s.getValue()));
} }
@ -266,7 +266,7 @@ public final class NBTUtils {
} }
if (hasLore) { if (hasLore) {
final ArrayList<ColoredText> lore = itemStack.getLore(); final List<ColoredText> lore = itemStack.getLore();
final NBTList<NBTString> loreNBT = new NBTList<>(NBTTypes.TAG_String); final NBTList<NBTString> loreNBT = new NBTList<>(NBTTypes.TAG_String);
for (ColoredText line : lore) { for (ColoredText line : lore) {

View File

@ -5,6 +5,7 @@ import net.minestom.server.entity.EntityType;
import net.minestom.server.utils.math.IntRange; import net.minestom.server.utils.math.IntRange;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
// TODO // TODO
@ -52,7 +53,7 @@ public class EntityFinder {
* *
* @return all entities validating the conditions * @return all entities validating the conditions
*/ */
public ArrayList<Entity> find() { public List<Entity> find() {
return new ArrayList<>(); return new ArrayList<>();
} }