mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
Replace all Lists with ArrayLists
This commit is contained in:
parent
49342fedbf
commit
71eeca6f0c
@ -34,14 +34,14 @@ import de.bixilon.minosoft.util.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Minosoft {
|
||||
static Configuration config;
|
||||
static List<MojangAccount> accountList;
|
||||
static ArrayList<MojangAccount> accountList;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// init log thread
|
||||
|
@ -20,7 +20,10 @@ import org.yaml.snakeyaml.Yaml;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Configuration {
|
||||
LinkedHashMap<String, Object> config;
|
||||
@ -147,8 +150,8 @@ public class Configuration {
|
||||
yaml.dump(config, writer);
|
||||
}
|
||||
|
||||
public List<MojangAccount> getMojangAccounts() {
|
||||
List<MojangAccount> accounts = new ArrayList<>();
|
||||
public ArrayList<MojangAccount> getMojangAccounts() {
|
||||
ArrayList<MojangAccount> accounts = new ArrayList<>();
|
||||
LinkedHashMap<String, Object> objects = (LinkedHashMap<String, Object>) get("account.accounts");
|
||||
if (objects == null) {
|
||||
return accounts;
|
||||
|
@ -19,7 +19,6 @@ import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TextComponent {
|
||||
JsonObject json;
|
||||
@ -39,7 +38,7 @@ public class TextComponent {
|
||||
String[] paragraphSplit = raw.split("§");
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
List<ChatAttributes> attributesList = new ArrayList<>();
|
||||
ArrayList<ChatAttributes> attributesList = new ArrayList<>();
|
||||
ChatAttributes color = ChatAttributes.WHITE;
|
||||
boolean first = true;
|
||||
for (String paragraph : paragraphSplit) {
|
||||
@ -109,7 +108,7 @@ public class TextComponent {
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
static JsonObject getExtraByAttributes(String message, ChatAttributes color, List<ChatAttributes> formatting) {
|
||||
static JsonObject getExtraByAttributes(String message, ChatAttributes color, ArrayList<ChatAttributes> formatting) {
|
||||
JsonObject ret = new JsonObject();
|
||||
ret.addProperty("text", message);
|
||||
if (color != null) {
|
||||
|
@ -19,12 +19,11 @@ import de.bixilon.minosoft.game.datatypes.objectLoader.entities.meta.EntityMetaD
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Entity implements EntityInterface {
|
||||
final int entityId;
|
||||
final HashMap<InventorySlots.EntityInventory, Slot> equipment;
|
||||
final List<StatusEffect> effectList;
|
||||
final ArrayList<StatusEffect> effectList;
|
||||
Location location;
|
||||
Velocity velocity;
|
||||
short yaw;
|
||||
@ -115,7 +114,7 @@ public abstract class Entity implements EntityInterface {
|
||||
return EntityMetaData.class;
|
||||
}
|
||||
|
||||
public List<StatusEffect> getEffectList() {
|
||||
public ArrayList<StatusEffect> getEffectList() {
|
||||
return effectList;
|
||||
}
|
||||
|
||||
|
@ -13,15 +13,15 @@
|
||||
|
||||
package de.bixilon.minosoft.game.datatypes.player.advancements;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Advancement {
|
||||
final String parentName;
|
||||
final AdvancementDisplay display;
|
||||
final List<String> criteria;
|
||||
final List<String[]> requirements;
|
||||
final ArrayList<String> criteria;
|
||||
final ArrayList<String[]> requirements;
|
||||
|
||||
public Advancement(String parentName, AdvancementDisplay display, List<String> criteria, List<String[]> requirements) {
|
||||
public Advancement(String parentName, AdvancementDisplay display, ArrayList<String> criteria, ArrayList<String[]> requirements) {
|
||||
this.parentName = parentName;
|
||||
this.display = display;
|
||||
this.criteria = criteria;
|
||||
@ -36,11 +36,11 @@ public class Advancement {
|
||||
return display;
|
||||
}
|
||||
|
||||
public List<String> getCriteria() {
|
||||
public ArrayList<String> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<String[]> getRequirements() {
|
||||
public ArrayList<String[]> getRequirements() {
|
||||
return requirements;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
public class Team {
|
||||
final String name;
|
||||
final List<String> players;
|
||||
final ArrayList<String> players;
|
||||
TextComponent displayName;
|
||||
TextComponent prefix;
|
||||
TextComponent suffix;
|
||||
@ -86,7 +86,7 @@ public class Team {
|
||||
players.remove(name);
|
||||
}
|
||||
|
||||
public List<String> getPlayers() {
|
||||
public ArrayList<String> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
}
|
||||
|
@ -18,11 +18,10 @@ import de.bixilon.minosoft.game.datatypes.TextComponent;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Log {
|
||||
final static SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
final static List<String> queue = new ArrayList<>();
|
||||
final static ArrayList<String> queue = new ArrayList<>();
|
||||
static LogLevel level = LogLevel.PROTOCOL;
|
||||
static Thread logThread;
|
||||
|
||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||
public class MojangBlockedServers {
|
||||
|
||||
|
||||
public static List<String> getBlockedServers() {
|
||||
public static ArrayList<String> getBlockedServers() {
|
||||
HttpResponse<String> response = HTTP.get(MojangURLs.BLOCKED_SERVERS.getUrl());
|
||||
if (response == null) {
|
||||
Log.mojang("Failed to fetch blocked servers");
|
||||
|
@ -17,13 +17,12 @@ import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.OutByteBuffer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ListTag implements NBTTag {
|
||||
final TagTypes type;
|
||||
final List<NBTTag> list;
|
||||
final ArrayList<NBTTag> list;
|
||||
|
||||
public ListTag(TagTypes type, List<NBTTag> list) {
|
||||
public ListTag(TagTypes type, ArrayList<NBTTag> list) {
|
||||
this.type = type;
|
||||
this.list = list;
|
||||
}
|
||||
@ -84,7 +83,7 @@ public class ListTag implements NBTTag {
|
||||
}
|
||||
}
|
||||
|
||||
public List<NBTTag> getValue() {
|
||||
public ArrayList<NBTTag> getValue() {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,10 @@ import de.bixilon.minosoft.protocol.protocol.OutByteBuffer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PluginChannelHandler {
|
||||
final HashMap<String, List<ChannelHandler>> channels = new HashMap<>();
|
||||
final HashMap<String, List<LoginChannelHandler>> loginChannels = new HashMap<>();
|
||||
final HashMap<String, ArrayList<ChannelHandler>> channels = new HashMap<>();
|
||||
final HashMap<String, ArrayList<LoginChannelHandler>> loginChannels = new HashMap<>();
|
||||
final ArrayList<String> registeredClientChannels = new ArrayList<>();
|
||||
final ArrayList<String> registeredServerChannels = new ArrayList<>();
|
||||
final Connection connection;
|
||||
@ -38,7 +37,7 @@ public class PluginChannelHandler {
|
||||
public void registerClientHandler(String name, ChannelHandler handler) {
|
||||
if (channels.get(name) == null) {
|
||||
// no channel with that name was registered yet
|
||||
List<ChannelHandler> handlerList = new ArrayList<>();
|
||||
ArrayList<ChannelHandler> handlerList = new ArrayList<>();
|
||||
handlerList.add(handler);
|
||||
channels.put(name, handlerList);
|
||||
return;
|
||||
@ -51,7 +50,7 @@ public class PluginChannelHandler {
|
||||
public void registerLoginClientHandler(String name, LoginChannelHandler handler) {
|
||||
if (loginChannels.get(name) == null) {
|
||||
// no channel with that name was registered yet
|
||||
List<LoginChannelHandler> handlerList = new ArrayList<>();
|
||||
ArrayList<LoginChannelHandler> handlerList = new ArrayList<>();
|
||||
handlerList.add(handler);
|
||||
loginChannels.put(name, handlerList);
|
||||
return;
|
||||
|
@ -33,11 +33,10 @@ import java.io.OutputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Network {
|
||||
final Connection connection;
|
||||
final List<ServerboundPacket> queue;
|
||||
final ArrayList<ServerboundPacket> queue;
|
||||
Thread socketThread;
|
||||
int compressionThreshold = -1;
|
||||
Socket socket;
|
||||
|
@ -27,7 +27,6 @@ import de.bixilon.minosoft.util.BitByte;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketAdvancements implements ClientboundPacket {
|
||||
boolean reset;
|
||||
@ -68,12 +67,12 @@ public class PacketAdvancements implements ClientboundPacket {
|
||||
display = new AdvancementDisplay(title, description, icon, frameType, flags, backgroundTexture, x, y);
|
||||
}
|
||||
int criteriaCount = buffer.readVarInt();
|
||||
List<String> criteria = new ArrayList<>();
|
||||
ArrayList<String> criteria = new ArrayList<>();
|
||||
for (int ii = 0; ii < criteriaCount; ii++) {
|
||||
criteria.add(buffer.readString());
|
||||
}
|
||||
int requirementsCount = buffer.readVarInt();
|
||||
List<String[]> requirements = new ArrayList<>();
|
||||
ArrayList<String[]> requirements = new ArrayList<>();
|
||||
for (int ii = 0; ii < requirementsCount; ii++) {
|
||||
String[] requirement = new String[buffer.readVarInt()];
|
||||
for (int iii = 0; iii < requirement.length; iii++) {
|
||||
|
@ -22,7 +22,6 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
import de.bixilon.minosoft.util.BitByte;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketMapData implements ClientboundPacket {
|
||||
int mapId;
|
||||
@ -35,7 +34,7 @@ public class PacketMapData implements ClientboundPacket {
|
||||
byte[] colors;
|
||||
|
||||
// players
|
||||
List<MapPinSet> pins;
|
||||
ArrayList<MapPinSet> pins;
|
||||
|
||||
boolean locked = false;
|
||||
//scale
|
||||
@ -169,7 +168,7 @@ public class PacketMapData implements ClientboundPacket {
|
||||
}
|
||||
|
||||
|
||||
public List<MapPinSet> getPins() {
|
||||
public ArrayList<MapPinSet> getPins() {
|
||||
return pins;
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,10 @@ import de.bixilon.minosoft.protocol.protocol.PacketHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PacketPlayerInfo implements ClientboundPacket {
|
||||
final List<PlayerInfoBulk> infos = new ArrayList<>();
|
||||
final ArrayList<PlayerInfoBulk> infos = new ArrayList<>();
|
||||
|
||||
|
||||
@Override
|
||||
@ -105,7 +104,7 @@ public class PacketPlayerInfo implements ClientboundPacket {
|
||||
h.handle(this);
|
||||
}
|
||||
|
||||
public List<PlayerInfoBulk> getInfos() {
|
||||
public ArrayList<PlayerInfoBulk> getInfos() {
|
||||
return infos;
|
||||
}
|
||||
|
||||
|
@ -22,22 +22,21 @@ import de.bixilon.minosoft.nbt.tag.CompoundTag;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class OutByteBuffer {
|
||||
final List<Byte> bytes = new ArrayList<>();
|
||||
final ArrayList<Byte> bytes = new ArrayList<>();
|
||||
final ProtocolVersion version;
|
||||
|
||||
public OutByteBuffer(ProtocolVersion version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public static void writeByte(byte b, List<Byte> write) {
|
||||
public static void writeByte(byte b, ArrayList<Byte> write) {
|
||||
write.add(b);
|
||||
}
|
||||
|
||||
public static void writeVarInt(int value, List<Byte> write) {
|
||||
public static void writeVarInt(int value, ArrayList<Byte> write) {
|
||||
// thanks https://wiki.vg/Protocol#VarInt_and_VarLong
|
||||
do {
|
||||
byte temp = (byte) (value & 0b01111111);
|
||||
@ -144,7 +143,7 @@ public class OutByteBuffer {
|
||||
writeInt((int) (d * 32.0D));
|
||||
}
|
||||
|
||||
public List<Byte> getBytes() {
|
||||
public ArrayList<Byte> getBytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
package de.bixilon.minosoft.protocol.protocol;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OutPacketBuffer extends OutByteBuffer {
|
||||
final int command;
|
||||
@ -30,8 +29,8 @@ public class OutPacketBuffer extends OutByteBuffer {
|
||||
|
||||
@Override
|
||||
public byte[] getOutBytes() {
|
||||
List<Byte> before = getBytes();
|
||||
List<Byte> after = new ArrayList<>();
|
||||
ArrayList<Byte> before = getBytes();
|
||||
ArrayList<Byte> after = new ArrayList<>();
|
||||
writeVarInt(getCommand(), after); // second: command
|
||||
after.addAll(before); // rest ist raw data
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user