Merge pull request #87 from mworzala/list_typing

Minor list typing changes
This commit is contained in:
TheMode 2020-12-28 21:19:58 +01:00 committed by GitHub
commit 70c9068365
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 17 deletions

View File

@ -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<ArrayList<Entity>> {
public class ArgumentEntities extends Argument<List<Entity>> {
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<ArrayList<Entity>> {
@NotNull
@Override
public ArrayList<Entity> parse(@NotNull String value) {
public List<Entity> parse(@NotNull String value) {
return null;
}
@Override
public int getConditionResult(@NotNull ArrayList<Entity> value) {
public int getConditionResult(@NotNull List<Entity> value) {
return SUCCESS;
}

View File

@ -54,7 +54,7 @@ public class ItemStack implements DataContainer, PublicCloneable<ItemStack> {
private ColoredText displayName;
private boolean unbreakable;
private ArrayList<ColoredText> lore;
private List<ColoredText> lore;
private Map<Enchantment, Short> enchantmentMap;
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
*/
@Nullable
public ArrayList<ColoredText> getLore() {
public List<ColoredText> getLore() {
return lore;
}
@ -297,7 +297,7 @@ public class ItemStack implements DataContainer, PublicCloneable<ItemStack> {
*
* @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;
}

View File

@ -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<String> pages = new ArrayList<>();
private List<String> 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<String> getPages() {
public List<String> getPages() {
return pages;
}
@ -29,7 +30,7 @@ public class WritableBookMeta extends ItemMeta {
*
* @param pages the pages list
*/
public void setPages(@NotNull ArrayList<String> pages) {
public void setPages(@NotNull List<String> pages) {
this.pages = pages;
}

View File

@ -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<JsonMessage> pages = new ArrayList<>();
private List<JsonMessage> 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<JsonMessage> getPages() {
public List<JsonMessage> 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<JsonMessage> pages) {
public void setPages(List<JsonMessage> pages) {
this.pages = pages;
}

View File

@ -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<PlayerInfo> playerInfos;
public List<PlayerInfo> 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<Property> properties;
public List<Property> properties;
public GameMode gameMode;
public int ping;
public JsonMessage displayName; // Only text

View File

@ -136,7 +136,7 @@ public final class NBTUtils {
}
if (display.containsKey("Lore")) {
NBTList<NBTString> loreList = display.getList("Lore");
ArrayList<ColoredText> lore = new ArrayList<>();
List<ColoredText> 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<ColoredText> lore = itemStack.getLore();
final List<ColoredText> lore = itemStack.getLore();
final NBTList<NBTString> loreNBT = new NBTList<>(NBTTypes.TAG_String);
for (ColoredText line : lore) {

View File

@ -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<Entity> find() {
public List<Entity> find() {
return new ArrayList<>();
}