even more default capacities

This commit is contained in:
Ceikry 2021-03-12 21:23:46 -06:00
parent c25d85a28e
commit 4aaa1563e5
110 changed files with 147 additions and 147 deletions

File diff suppressed because one or more lines are too long

View file

@ -45,7 +45,7 @@ public class IoSession {
/**
* The currently queued writing data.
*/
private List<ByteBuffer> writingQueue = new ArrayList<>();
private List<ByteBuffer> writingQueue = new ArrayList<>(20);
/**
* The currently queued reading data.

View file

@ -38,7 +38,7 @@ public final class CommunicationInfo {
/**
* The list of blocked players.
*/
private final List<String> blocked = new ArrayList<>();
private final List<String> blocked = new ArrayList<>(20);
/**
* The player's clan name.
@ -105,7 +105,7 @@ public final class CommunicationInfo {
if (privateChatSetting != 2) {
for (GameServer server : WorldDatabase.getWorlds()) {
if (server != null && server.isActive()) {
List<String> names = new ArrayList<>();
List<String> names = new ArrayList<>(20);
for (PlayerSession p : server.getPlayers().values()) {
if (p.isActive() && p.getCommunication().contacts.containsKey(player.getUsername())) {
if (privateChatSetting == 0 || contacts.containsKey(p.getUsername())) {

View file

@ -42,7 +42,7 @@ public final class SQLTable {
* @return The columns.
*/
public List<SQLColumn> getChanged() {
List<SQLColumn> updated = new ArrayList<>();
List<SQLColumn> updated = new ArrayList<>(20);
for (int i = 0; i < columns.length; i++) {
SQLColumn column = columns[i];
if (column.isChanged()) {

View file

@ -19,7 +19,7 @@ import java.util.ArrayList;
@ScriptManifest(name = "Fetch data10", author = "b4", version = 2, logo = "", info = "info")
public class Reader extends Script {
private ArrayList<String> names = new ArrayList<>();
private ArrayList<String> names = new ArrayList<>(20);
@Override
public int onLoop() {

View file

@ -46,7 +46,7 @@ public class Container {
/**
* The container listeners.
*/
private final List<ContainerListener> listeners = new ArrayList<>();
private final List<ContainerListener> listeners = new ArrayList<>(20);
/**
* Constructs a new {@code Container} {@code Object}.

View file

@ -74,7 +74,7 @@ public final class BarrowsPuzzle extends ComponentPlugin {
*/
public BarrowsPuzzle create() {
int[] answers = Arrays.copyOf(answerModels, answerModels.length);
List<Integer> list = new ArrayList<>();
List<Integer> list = new ArrayList<>(20);
for (int answer : answers) {
list.add(answer);
}

View file

@ -78,7 +78,7 @@ public final class BountyHunterActivity extends ActivityPlugin {
/**
* The waiting room.
*/
private final List<Player> waitingRoom = new ArrayList<>();
private final List<Player> waitingRoom = new ArrayList<>(20);
/**
* The crater type.

View file

@ -54,17 +54,17 @@ public final class ClanWarsActivityPlugin extends ActivityPlugin {
/**
* The first clan's players.
*/
private List<Player> firstClanPlayers = new ArrayList<>();
private List<Player> firstClanPlayers = new ArrayList<>(20);
/**
* The second clan's players.
*/
private List<Player> secondClanPlayers = new ArrayList<>();
private List<Player> secondClanPlayers = new ArrayList<>(20);
/**
* The list of viewing players.
*/
private List<Player> viewingPlayers = new ArrayList<>();
private List<Player> viewingPlayers = new ArrayList<>(20);
/**
* The amount of ticks.

View file

@ -216,7 +216,7 @@ public final class DuelArenaActivity extends ActivityPlugin {
* @return {@code DuelArea} the area.
*/
public static DuelArea getDuelArea(boolean obstacles) {
List<DuelArea> options = new ArrayList<>();
List<DuelArea> options = new ArrayList<>(20);
for (DuelArea area : DUEL_AREAS) {
if (!obstacles && area.isObstacles() || obstacles && !area.isObstacles()) {
continue;

View file

@ -65,7 +65,7 @@ public final class GWDGraardorSwingHandler extends CombatSwingHandler {
} else {
ticks += (int) Math.ceil(entity.getLocation().getDistance(victim.getLocation()) * 0.3);
NPC npc = (NPC) entity;
List<BattleState> list = new ArrayList<>();
List<BattleState> list = new ArrayList<>(20);
for (Entity t : RegionManager.getLocalPlayers(npc, 28)) {
if (!CHAMBER.insideBorder(t.getLocation())) {
continue;

View file

@ -82,7 +82,7 @@ public final class GWDKreeArraSwingHandler extends CombatSwingHandler {
} else {
ticks += (int) Math.ceil(entity.getLocation().getDistance(victim.getLocation()) * 0.3);
NPC npc = (NPC) entity;
List<BattleState> list = new ArrayList<>();
List<BattleState> list = new ArrayList<>(20);
for (Entity t : RegionManager.getLocalPlayers(npc, 28)) {
if (!CHAMBER.insideBorder(t.getLocation())) {
continue;

View file

@ -58,7 +58,7 @@ public class GWDZilyanaSwingHandler extends CombatSwingHandler {
state.setStyle(CombatStyle.MELEE);
} else {
NPC npc = (NPC) entity;
List<BattleState> list = new ArrayList<>();
List<BattleState> list = new ArrayList<>(20);
for (Entity t : RegionManager.getLocalPlayers(npc.getCenterLocation(), (npc.size() >> 1) + 2)) {
if (t.getLocation().getX() < 2908 && t.isAttackable(npc, CombatStyle.MAGIC)) {
list.add(new BattleState(entity, t));

View file

@ -49,7 +49,7 @@ public final class GodWarsNPC extends AbstractNPC {
@Override
public List<Entity> getPossibleTargets(Entity entity, int radius) {
List<Entity> targets = new ArrayList<>();
List<Entity> targets = new ArrayList<>(20);
for (Player player : RegionManager.getLocalPlayers(entity, radius)) {
if (canSelectTarget(entity, player)) {
targets.add(player);

View file

@ -44,7 +44,7 @@ public class AlchemistZone extends MTAZone {
/**
* The players in the zone.
*/
private static final List<Player> PLAYERS = new ArrayList<>();
private static final List<Player> PLAYERS = new ArrayList<>(20);
/**
* The guardian.

View file

@ -58,7 +58,7 @@ public class EnchantingZone extends MTAZone {
/**
* The players in the zone.
*/
private static final List<Player> PLAYERS = new ArrayList<>();
private static final List<Player> PLAYERS = new ArrayList<>(20);
/**
* The guardian.

View file

@ -38,7 +38,7 @@ public class GraveyardZone extends MTAZone {
/**
* The players in the zone.
*/
private static final List<Player> PLAYERS = new ArrayList<>();
private static final List<Player> PLAYERS = new ArrayList<>(20);
/**
* The runes rewarded by a chance.
@ -69,7 +69,7 @@ public class GraveyardZone extends MTAZone {
if (PLAYERS.isEmpty()) {
return true;
}
List<Location> locs = new ArrayList<>();
List<Location> locs = new ArrayList<>(20);
for (Location l : GFX_POS) {
if (RandomFunction.random(12) >= 8) {
continue;

View file

@ -49,7 +49,7 @@ public class TelekineticZone extends MTAZone {
/**
* The mazes to choose from.
*/
private final List<Maze> mazes = new ArrayList<>();
private final List<Maze> mazes = new ArrayList<>(20);
/**
* The dynamic region.

View file

@ -31,7 +31,7 @@ public final class BalloonManager extends OptionHandler {
/**
* The list of dropped balloons.
*/
private static final List<GameObject> balloons = new ArrayList<>();
private static final List<GameObject> balloons = new ArrayList<>(20);
/**
* The count down time until droping.

View file

@ -28,7 +28,7 @@ public final class PCObjectHandler extends OptionHandler {
//public boolean pcbotsSpawned = false;
public boolean PCnBotsSpawned = false;
public boolean PCiBotsSpawned = false;
public ArrayList<String> playersJoined = new ArrayList<>();
public ArrayList<String> playersJoined = new ArrayList<>(20);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {

View file

@ -60,12 +60,12 @@ public final class PestControlActivityPlugin extends ActivityPlugin {
/**
* The waiting players.
*/
private final List<Player> waitingPlayers = new ArrayList<>();
private final List<Player> waitingPlayers = new ArrayList<>(20);
/**
* The active game sessions.
*/
private final List<PestControlSession> sessions = new ArrayList<>();
private final List<PestControlSession> sessions = new ArrayList<>(20);
/**
* The game updating pulse.

View file

@ -51,7 +51,7 @@ public final class PestControlSession {
/**
* The barricade & gate objects.
*/
private final List<GameObject> barricades = new ArrayList<>();
private final List<GameObject> barricades = new ArrayList<>(20);
/**
* The amount of ticks.
@ -66,7 +66,7 @@ public final class PestControlSession {
/**
* List of attackable portals
*/
private final List<NPC> aportals = new ArrayList<>();
private final List<NPC> aportals = new ArrayList<>(20);
/**
* The portals.
*/
@ -215,7 +215,7 @@ public final class PestControlSession {
public void startGame(List<Player> waitingPlayers) {
region.flagActive();
initBarricadesList();
List<Integer> list = new ArrayList<>();
List<Integer> list = new ArrayList<>(20);
for (int i = 0; i < 4; i++) {
list.add(i);
}

View file

@ -110,7 +110,7 @@ public final class PCShifterNPC extends AbstractNPC {
* @return The destination.
*/
private Location getDestination(Entity victim) {
List<Location> locations = new ArrayList<>();
List<Location> locations = new ArrayList<>(20);
int radius = 2;
for (int x = -radius; x < radius + 1; x++) {
for (int y = -radius; y < radius + 1; y++) {

View file

@ -671,7 +671,7 @@ public final class PCRewardInterface extends ComponentPlugin {
public Item[] constructPack() {
final int build = this == SEED_PACK || this == HERB_PACK ? RandomFunction.random(MIN_BUILD, MAX_BUILD) : RandomFunction.random(38, 43);
int left = build;
List<Item> pack = new ArrayList<>();
List<Item> pack = new ArrayList<>(20);
int amt = 0;
for (Item i : getReward()) {
amt = this == SEED_PACK || this == HERB_PACK ? RandomFunction.random(1, 5) : RandomFunction.random(16, 25);

View file

@ -45,7 +45,7 @@ public final class PuroPuroPlugin extends MapZone implements Plugin<Object> {
/**
* The moving wheat.
*/
private static final List<WheatSet> WHEAT = new ArrayList<>();
private static final List<WheatSet> WHEAT = new ArrayList<>(20);
/**
* The pulse.

View file

@ -46,7 +46,7 @@ public final class TzhaarFightCavesPlugin extends ActivityPlugin {
/**
* The currently active NPCs.
*/
public List<NPC> activeNPCs = new ArrayList<>();
public List<NPC> activeNPCs = new ArrayList<>(20);
/**
* Constructs a new {@code TzhaarFightCavesPlugin} {@code Object}.

View file

@ -47,12 +47,12 @@ public final class TzhaarFightPitsPlugin extends ActivityPlugin {
/**
* The lobby list.
*/
private static final List<Player> LOBBY_PLAYERS = new ArrayList<>();
private static final List<Player> LOBBY_PLAYERS = new ArrayList<>(20);
/**
* The players in battle list.
*/
private static final List<Player> WAR_PLAYERS = new ArrayList<>();
private static final List<Player> WAR_PLAYERS = new ArrayList<>(20);
/**
* The interface id.

View file

@ -36,7 +36,7 @@ public final class BarrelRoom extends MapZone implements Plugin<Object> {
/**
* The players list.
*/
private static List<Player> players = new ArrayList<>();
private static List<Player> players = new ArrayList<>(20);
/**
* The pulse.

View file

@ -101,7 +101,7 @@ public final class CatapultRoom extends MapZone implements Plugin<Object> {
/**
* The players in the catapult room.
*/
private static List<Player> players = new ArrayList<>();
private static List<Player> players = new ArrayList<>(20);
/**
* The current attack.

View file

@ -46,7 +46,7 @@ public final class CyclopesRoom extends MapZone implements Plugin<Object> {
/**
* The players in the room.
*/
private static final List<Player> PLAYERS = new ArrayList<>();
private static final List<Player> PLAYERS = new ArrayList<>(20);
/**
* The pulse.

View file

@ -166,7 +166,7 @@ public final class QuizMasterDialogue extends DialoguePlugin {
private void display(QuizSet[] quiz) {
QuizSet correct = quiz[0];
QuizSet wrong = quiz[1];
List<Integer> childs = new ArrayList<>();
List<Integer> childs = new ArrayList<>(20);
childs.add(1);
childs.add(2);
childs.add(3);
@ -231,7 +231,7 @@ public final class QuizMasterDialogue extends DialoguePlugin {
* @return the set.
*/
public static QuizSet[] getQuizSet() {
List<QuizSet> sets = new ArrayList<>();
List<QuizSet> sets = new ArrayList<>(20);
for (QuizSet s : values()) {
sets.add(s);
}

View file

@ -121,7 +121,7 @@ public enum Bones {
* @return the ids.
*/
public static int[] getArray() {
List<Integer> list = new ArrayList<>();
List<Integer> list = new ArrayList<>(20);
for (int i : bones.keySet()) {
list.add(i);
}

View file

@ -59,7 +59,7 @@ public class Shop {
/**
* Represents the list of shop viewers.
*/
private final List<ShopViewer> viewers = new ArrayList<>();
private final List<ShopViewer> viewers = new ArrayList<>(20);
/**
* Represents the title of the shop.

View file

@ -97,7 +97,7 @@ public final class ShipCharter {
*/
Destination.OO_GLOG, Destination.SHIPYARD, /* Destination.PORT_TYRAS, */
Destination.CRANDOR };
List<Integer> childs = new ArrayList<>();
List<Integer> childs = new ArrayList<>(20);
for (Destination destination : restrictions) {
childs.add(destination.getXChild());
childs.add(destination.getNameChild());

View file

@ -8,7 +8,7 @@ import java.util.ArrayList;
import java.util.List;
public class ScoreboardManager {
public static List<ScoreboardEntry> entries = new ArrayList<>();
public static List<ScoreboardEntry> entries = new ArrayList<>(20);
public static void submit(Player player){
if(entries.size() == 5){

View file

@ -884,7 +884,7 @@ public class DeathMansionEvent extends HolidayEvent {
public static List<GrimItem> getGrimItems(Player player) {
List<GrimItem> items = player.getAttribute("grim-items", null);
if (items == null) {
items = new ArrayList<>();
items = new ArrayList<>(20);
}
player.setAttribute("grim-items", items);
return items;

View file

@ -152,7 +152,7 @@ public class DemonSlayer extends Quest {
* @return the incantation.
*/
private final static String generateIncantation() {
List<String> incantations = new ArrayList<>();
List<String> incantations = new ArrayList<>(20);
for (String s : INCANTATIONS) {
incantations.add(s);
}

View file

@ -257,7 +257,7 @@ public final class DragonSlayerCutscene extends CutscenePlugin {
/**
* Represents the active fires.
*/
private List<Location> fires = new ArrayList<>();
private List<Location> fires = new ArrayList<>(20);
/**
* Represents if the fires are done burning.

View file

@ -741,7 +741,7 @@ public final class AvaDialogue extends DialoguePlugin {
* @param remove the remove item.
*/
private void removeAll(Player player, Item add, Item remove) {
List<Container> containers = new ArrayList<>();
List<Container> containers = new ArrayList<>(20);
containers.add(player.getInventory());
containers.add(player.getEquipment());
containers.add(player.getBank());

View file

@ -92,12 +92,12 @@ public final class WaterfallPlugin extends OptionHandler {
/**
* The swimmer swimming.
*/
private static final List<Player> SWIMMERS = new ArrayList<>();
private static final List<Player> SWIMMERS = new ArrayList<>(20);
/**
* The ropes.
*/
private static final List<GameObject> ROPES = new ArrayList<>();
private static final List<GameObject> ROPES = new ArrayList<>(20);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {

View file

@ -552,11 +552,11 @@ public enum ClueLevel {
* @return the rewar
*/
public List<Item> getLoot(Player player) {
List<ChanceItem> items = new ArrayList<>();
List<Integer> ids = new ArrayList<>();
List<ChanceItem> items = new ArrayList<>(20);
List<Integer> ids = new ArrayList<>(20);
items.addAll(Arrays.asList(DEFAULT_REWARDS));
items.addAll(Arrays.asList(this.getRewards()));
List<Item> rewards = new ArrayList<>();
List<Item> rewards = new ArrayList<>(20);
int size = RandomFunction.random(1, 6);
if (this == HARD) {
size = RandomFunction.random(4, 6);

View file

@ -143,7 +143,7 @@ public abstract class ClueScrollPlugin extends MapZone implements Plugin<Object>
}
List<ClueScrollPlugin> organized = (List<ClueScrollPlugin>) ORGANIZED.get(clue.getLevel());
if (organized == null) {
organized = new ArrayList<>();
organized = new ArrayList<>(20);
}
organized.add(clue);
ZoneBuilder.configure(clue);

View file

@ -46,7 +46,7 @@ public final class DesertZone extends MapZone implements Plugin<Object> {
/**
* The players list.
*/
private static final List<Player> PLAYERS = new ArrayList<>();
private static final List<Player> PLAYERS = new ArrayList<>(20);
/**
* The water draining pulse.

View file

@ -44,7 +44,7 @@ public class WildernessAreaZone extends MapZone implements Plugin<Object> {
/**
* The list of players in the arena.
*/
private final List<Player> players = new ArrayList<>();
private final List<Player> players = new ArrayList<>(20);
/**
* Constructs a new {@code WildernessAreaZone} {@code Object}

View file

@ -83,7 +83,7 @@ public final class WaterBirthDungeonZone extends MapZone implements Plugin<Objec
if (e instanceof Player) {
final Player p = (e.asPlayer());
if (p.getLocation().equals(new Location(2545, 10144, 0)) || p.getLocation().equals(new Location(2545, 10142, 0))) {
final List<NPC> eggs = new ArrayList<>();
final List<NPC> eggs = new ArrayList<>(20);
NPC n = Repository.findNPC(new Location(2546, 10142, 0));
if (n != null && n.getId() == 2449) {
eggs.add(n);
@ -113,7 +113,7 @@ public final class WaterBirthDungeonZone extends MapZone implements Plugin<Objec
}
break;
case 3:
final List<NPC> spawns = new ArrayList<>();
final List<NPC> spawns = new ArrayList<>(20);
for (NPC n : eggs) {
n.transform(n.getId() + 1);
NPC spawn = NPC.create(2454, n.getLocation().transform(-1, 0, 0));

View file

@ -69,7 +69,7 @@ public abstract class OptionHandler implements Plugin<Object> {
*/
public int[] getValidChildren(int wrapper) {
final ObjectDefinition definition = ObjectDefinition.forId(wrapper);
final List<Integer> list = new ArrayList<>();
final List<Integer> list = new ArrayList<>(20);
if (definition.getChildrenIds() == null) {
SystemLogger.logErr("Null child wrapper in option handler wrapperId=" + wrapper);
return new int[] { wrapper };

View file

@ -82,7 +82,7 @@ public abstract class UseWithHandler implements Plugin<Object> {
int key = id | type << 16;
List<UseWithHandler> handlers = HANDLERS.get(key);
if (handlers == null) {
HANDLERS.put(key, handlers = new ArrayList<>());
HANDLERS.put(key, handlers = new ArrayList<>(20));
}
if (type == PLAYER_TYPE) {
if (handler.allowedNodes == null) {
@ -204,7 +204,7 @@ public abstract class UseWithHandler implements Plugin<Object> {
*/
public int[] getValidChildren(int wrapper) {
final ObjectDefinition definition = ObjectDefinition.forId(wrapper);
final List<Integer> list = new ArrayList<>();
final List<Integer> list = new ArrayList<>(20);
if (definition.getChildrenIds() == null) {
SystemLogger.logErr("Null child wrapper in option handler wrapperId=" + wrapper);
return new int[]{wrapper};

View file

@ -49,7 +49,7 @@ public final class CasketPlugin extends OptionHandler {
*/
private ChanceItem getChanceItem(ChanceItem[] items) {
final int chance = RandomFunction.random(100);
final List<ChanceItem> chances = new ArrayList<>();
final List<ChanceItem> chances = new ArrayList<>(20);
for (ChanceItem c : items) {
if (chance > c.getChanceRate()) {
chances.add(c);

View file

@ -23,7 +23,7 @@ import java.util.Objects;
@Initializable
public class DiangoReclaimInterface extends ComponentPlugin {
private static final int COMPONENT_ID = 468;
public static final List<Item> ITEMS = new ArrayList<>();
public static final List<Item> ITEMS = new ArrayList<>(20);
public static final Item[] HOLIDAY_ITEMS = {YoyoPlugin.YOYO, ReindeerHatPlugin.ReindeerHat, BasketofEggsEvent.RUBBER_CHICKEN,ZombieHeadPlugin.ZOMBIE_HEAD, new Item(6857), new Item(6856), new Item(6858), new Item(6859), new Item(6860), new Item(6861), new Item(6862), new Item(6863), new Item(9920), new Item(9921),new Item(9922), new Item(9923), new Item(9924), new Item(9925), new Item(11019), new Item(11020), new Item(11021), new Item(11022), new Item(11789), new Item(11949), new Item(12634), new Item(14076), new Item(14077), new Item(14081),new Item(14595), new Item(14602), new Item(14603), new Item(14605)};
//initialize the plugin, add lists of items to the ITEMS list...

View file

@ -110,7 +110,7 @@ public abstract class CombatSpell extends MagicSpell {
* @return The list of targets.
*/
public List<Entity> getMultihitTargets(Entity entity, Entity target, int max) {
List<Entity> list = new ArrayList<>();
List<Entity> list = new ArrayList<>(20);
list.add(target);
boolean npc = target instanceof NPC;
for (Entity e : npc ? RegionManager.getLocalNpcs(target, 1) : RegionManager.getLocalPlayers(target, 1)) {

View file

@ -122,7 +122,7 @@ public abstract class DegradableEquipment implements Plugin<Object> {
public DegradableEquipment newInstance(Object arg) {
List<DegradableEquipment> equipment = EQUIPMENT[slot];
if (equipment == null) {
equipment = EQUIPMENT[slot] = new ArrayList<>();
equipment = EQUIPMENT[slot] = new ArrayList<>(20);
}
equipment.add(this);
return this;

View file

@ -92,7 +92,7 @@ public final class SweepSpecialHandler extends MeleeSwingHandler implements Plug
int x = vl.getX();
int y = vl.getY();
Direction dir = Direction.getDirection(x - entity.getLocation().getX(), y - entity.getLocation().getY());
List<BattleState> l = new ArrayList<>();
List<BattleState> l = new ArrayList<>(20);
l.add(new BattleState(entity, victim));
for (Entity n : victim instanceof NPC ? RegionManager.getSurroundingNPCs(victim, 9, entity, victim) : RegionManager.getSurroundingPlayers(victim, 9, entity, victim)) {
if (n instanceof Familiar) {

View file

@ -15,7 +15,7 @@ public class SpellBlocks {
if(blocks.get(spellId) != null){
blocks.get(spellId).add(toBlock);
} else {
List<Node> blockslist = new ArrayList<>();
List<Node> blockslist = new ArrayList<>(20);
blockslist.add(toBlock);
blocks.put(spellId,blockslist);
}

View file

@ -113,7 +113,7 @@ public class AggressiveBehavior {
* @return The list of possible targets.
*/
public List<Entity> getPossibleTargets(Entity entity, int radius) {
List<Entity> targets = new ArrayList<>();
List<Entity> targets = new ArrayList<>(20);
for (Player player : RegionManager.getLocalPlayers(entity, radius)) {
if (canSelectTarget(entity, player)) {
targets.add(player);

View file

@ -210,7 +210,7 @@ public final class KalphiteQueenNPC extends AbstractNPC {
* @return The targets array.
*/
private BattleState[] getRangeTargets(Entity e, Entity victim) {
List<BattleState> list = new ArrayList<>();
List<BattleState> list = new ArrayList<>(20);
for (Entity t : RegionManager.getLocalPlayers(victim, -1 + (int) e.getCenterLocation().getDistance(victim.getLocation()))) {
if (t.isAttackable(e, CombatStyle.RANGE)) {
list.add(new BattleState(e, t));

View file

@ -268,7 +268,7 @@ public final class CorporealBeastNPC extends AbstractNPC {
Location p = player.getLocation();
if (p.getX() >= l.getX() && p.getY() >= l.getY() && p.getX() < l.getX() + entity.size() && p.getY() < l.getY() + entity.size()) {
if (stompTargets == null) {
stompTargets = new ArrayList<>();
stompTargets = new ArrayList<>(20);
}
stompTargets.add(player);
}

View file

@ -40,17 +40,17 @@ public final class NPCDropTables {
/**
* The default drop table (holding the 100% drops).
*/
private final List<WeightedChanceItem> defaultTable = new ArrayList<>();
private final List<WeightedChanceItem> defaultTable = new ArrayList<>(20);
/**
* The charms drop table (holding the charm drops).
*/
private final List<WeightedChanceItem> charmTable = new ArrayList<>();
private final List<WeightedChanceItem> charmTable = new ArrayList<>(20);
/**
* The main drop table (holding the main drops).
*/
private final List<WeightedChanceItem> mainTable = new ArrayList<>();
private final List<WeightedChanceItem> mainTable = new ArrayList<>(20);
/**
* The NPC definitions.
@ -175,7 +175,7 @@ public final class NPCDropTables {
if (player != null && npc.getProperties().isMultiZone() && (GrandExchangeDatabase.getDatabase().get(itemId) != null || item.getName().endsWith("charm")) && player.getCommunication().getClan() != null && player.getCommunication().isLootShare() && player.getCommunication().getLootRequirement().ordinal() >= player.getCommunication().getClan().getLootRequirement().ordinal() && !player.getIronmanManager().isIronman()) {
Player looter = player;
List<Player> players = RegionManager.getLocalPlayers(npc, 16);
List<Player> looters = new ArrayList<>();
List<Player> looters = new ArrayList<>(20);
for (Player p : players) {
if (p != null && p.getCommunication().getClan() != null && p.getCommunication().getClan() == player.getCommunication().getClan() && p.getCommunication().isLootShare() && p.getCommunication().getLootRequirement().ordinal() >= p.getCommunication().getClan().getLootRequirement().ordinal() && npc.getImpactHandler().getImpactLog().containsKey(p)) {
looters.add(p);

View file

@ -32,7 +32,7 @@ public final class RareDropTable {
/**
* The rare drop table.
*/
private static final List<WeightedChanceItem> TABLE = new ArrayList<>();
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
/**

View file

@ -132,7 +132,7 @@ public final class DesertWyrmNPC extends Forager {
* @return the object.
*/
public GameObject getClosestRock(Player player) {
List<GameObject> rocks = new ArrayList<>();
List<GameObject> rocks = new ArrayList<>(20);
for (int k = 0; k < 7; k++) {
for (int i = 0; i < 4; i++) {
Direction dir = Direction.get(i);

View file

@ -64,7 +64,7 @@ public class BorkNPC extends AbstractNPC {
/**
* The list of the legion npc.
*/
private final List<NPC> legions = new ArrayList<>();
private final List<NPC> legions = new ArrayList<>(20);
/**
* If the legion is spawned.

View file

@ -39,7 +39,7 @@ public class StrayDogNPC extends AbstractNPC {
/**
* Represents the array list of players.
*/
private List<Player> players = new ArrayList<>();
private List<Player> players = new ArrayList<>(20);
/**
* Constructs a new {@code AlKharidWarriorPlugin} {@code Object}.

View file

@ -20,7 +20,7 @@ public class RevenantPlugin implements Plugin<Object> {
/**
* The revenants npc.
*/
private static final List<NPC> REVENANTS = new ArrayList<>();
private static final List<NPC> REVENANTS = new ArrayList<>(20);
/**
* The spawning locations.
@ -47,7 +47,7 @@ public class RevenantPlugin implements Plugin<Object> {
public static void spawn() {
int size = REVENANTS.size();
int left = MAX - size;
List<Location> taken = new ArrayList<>();
List<Location> taken = new ArrayList<>(20);
for (NPC n : REVENANTS) {
taken.add(n.getProperties().getSpawnLocation());
}

View file

@ -604,7 +604,7 @@ public class Player extends Entity {
boolean gravestone = graveManager.generateable() && getIronmanManager().getMode() != IronmanMode.ULTIMATE;
int seconds = graveManager.getType().getDecay() * 60;
int ticks = (1000 * seconds) / 600;
List<GroundItem> items = new ArrayList<>();
List<GroundItem> items = new ArrayList<>(20);
for (Item item : c[1].toArray()) {
if (item != null) {
GroundItem ground;
@ -1234,7 +1234,7 @@ public class Player extends Entity {
*/
public List<Plugin<Player>> getLogoutPlugins() {
if (logoutPlugins == null) {
logoutPlugins = new ArrayList<>();
logoutPlugins = new ArrayList<>(20);
}
return logoutPlugins;
}

View file

@ -35,7 +35,7 @@ public final class LoginConfiguration {
/**
* The login plugins.
*/
private static final List<Plugin<Object>> LOGIN_PLUGINS = new ArrayList<>();
private static final List<Plugin<Object>> LOGIN_PLUGINS = new ArrayList<>(20);
/**
* The lobby pane component.

View file

@ -46,7 +46,7 @@ public class BankPinManager {
/**
* The digits.
*/
private final List<Integer> digits = new ArrayList<>();
private final List<Integer> digits = new ArrayList<>(20);
/**
* The bank pin.

View file

@ -22,7 +22,7 @@ public final class WarningMessages {
/**
* Represents the warning messages.
*/
private final List<WarningMessage> messages = new ArrayList<>();
private final List<WarningMessage> messages = new ArrayList<>(20);
/**
* Method used to open the warning messages.

View file

@ -17,7 +17,7 @@ public class EmoteManager {
/**
* The list of unlocked emotes.
*/
private final List<Emotes> emotes = new ArrayList<>();
private final List<Emotes> emotes = new ArrayList<>(20);
/**
* The player.

View file

@ -26,7 +26,7 @@ public final class Prayer {
/**
* Represents the list of active prayers.
*/
private final List<PrayerType> active = new ArrayList<>();
private final List<PrayerType> active = new ArrayList<>(20);
/**
* Represents the current draining task.

View file

@ -443,7 +443,7 @@ public final class TradeModule implements RequestModule {
* @return the split item array.
*/
private Item[] splitList(Item[] items, int min, int max) {
List<Item> list = new ArrayList<>();
List<Item> list = new ArrayList<>(20);
for (int i = min; i < max; i++) {
if (items[i] == null) {
continue;

View file

@ -83,7 +83,7 @@ public enum PKTitle {
*/
public static PKTitle[] getTitles(Player player) {
int kills = player.getSavedData().getSpawnData().getKills();
List<PKTitle> titles = new ArrayList<>();
List<PKTitle> titles = new ArrayList<>(20);
for (PKTitle t : values()) {
if (kills >= t.getKills()) {
titles.add(t);

View file

@ -48,7 +48,7 @@ public final class BuildRoomDialogue extends DialoguePlugin {
/**
* The boundaries of the room to build.
*/
private List<GameObject> boundaries = new ArrayList<>();
private List<GameObject> boundaries = new ArrayList<>(20);
/**
* The room we're building.

View file

@ -284,7 +284,7 @@ public final class GatheringSkillPulse extends SkillPulse<GameObject> {
// Calculate a random gem for the player
else if (isMiningGems) {
int random = RandomFunction.random(100);
List<Integer> gems = new ArrayList<>();
List<Integer> gems = new ArrayList<>(20);
if (random < 2) {
gems.add(1617);
} else if (random < 25) {

View file

@ -437,7 +437,7 @@ public enum MiningNode{
public static List<WeightedChanceItem> gemRockGems = new ArrayList<>();
public static List<WeightedChanceItem> gemRockGems = new ArrayList<>(20);
static {
gemRockGems.add(new WeightedChanceItem(1625, 1, 60)); //uncut Opal
gemRockGems.add(new WeightedChanceItem(1627, 1, 30)); //uncut Jade

View file

@ -137,7 +137,7 @@ public final class DeadfallSetting extends TrapSetting {
* @return the locations.
*/
private List<Location> getLocations(GameObject object) {
List<Location> locs = new ArrayList<>();
List<Location> locs = new ArrayList<>(20);
if (object.getDirection() == Direction.NORTH) {
locs.add(object.getLocation().transform(1, -1, 0));
locs.add(object.getLocation().transform(1, 1, 0));

View file

@ -18,7 +18,7 @@ public final class HunterManager {
/**
* The list of active traps.
*/
private final List<TrapWrapper> traps = new ArrayList<>();
private final List<TrapWrapper> traps = new ArrayList<>(20);
/**
* The player instance.

View file

@ -37,7 +37,7 @@ public enum BNetTypes {
/**
* The implings.
*/
private static final List<ImplingNode> IMPLINGS = new ArrayList<>();
private static final List<ImplingNode> IMPLINGS = new ArrayList<>(20);
/**
* The node.

View file

@ -20,7 +20,7 @@ public enum CombinationRune {
}
public static List<CombinationRune> eligibleFor(Runes rune){
List<CombinationRune> runes = new ArrayList<>();
List<CombinationRune> runes = new ArrayList<>(20);
for(CombinationRune r : CombinationRune.values()){
for(Runes ru : r.types){
if(ru == rune){

View file

@ -229,7 +229,7 @@ public abstract class MagicSpell implements Plugin<SpellType> {
if (runes == null) {
return true;
}
List<Item> toRemove = new ArrayList<>();
List<Item> toRemove = new ArrayList<>(20);
for (Item item : runes) {
if (!hasRune(p, item, toRemove, message)) {
return false;

View file

@ -37,7 +37,7 @@ public final class SmokeDungeon extends MapZone implements Plugin<Object> {
/**
* The players list.
*/
private static final List<Player> PLAYERS = new ArrayList<>();
private static final List<Player> PLAYERS = new ArrayList<>(20);
/**
* The tick delay until the next effect.

View file

@ -105,7 +105,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
/**
* The invisible familiar boosts.
*/
protected List<SkillBonus> boosts = new ArrayList<>();
protected List<SkillBonus> boosts = new ArrayList<>(20);
/**
* The attack style.

View file

@ -65,7 +65,7 @@ public final class FamiliarManager {
/**
* The list of insured pets.
*/
private List<Pets> insuredPets = new ArrayList<>();
private List<Pets> insuredPets = new ArrayList<>(20);
/**
* Constructs a new {@code FamiliarManager} {@code Object}.

View file

@ -30,7 +30,7 @@ public class PickableDoorHandler extends OptionHandler {
*/
private static final Item LOCK_PICK = new Item(1523);
private static final List<PickableDoor> pickableDoors = new ArrayList<>();
private static final List<PickableDoor> pickableDoors = new ArrayList<>(20);
private static final int[] DOORS = new int[]{42028, 2550, 2551, 2554, 2555, 2556, 2557, 2558, 2559, 5501, 7246, 9565, 13314, 13317, 13320, 13323, 13326, 13344, 13345, 13346, 13347, 13348, 13349, 15759, 34005, 34805, 34806, 34812};

View file

@ -21,7 +21,7 @@ public final class GroundItemManager {
/**
* The list of ground items.
*/
private static final List<GroundItem> GROUND_ITEMS = new ArrayList<>();
private static final List<GroundItem> GROUND_ITEMS = new ArrayList<>(20);
/**
* Creates a ground item.

View file

@ -21,7 +21,7 @@ public class SystemConfig {
/**
* The list of beta user names.
*/
private final List<String> betaUsers = new ArrayList<>();
private final List<String> betaUsers = new ArrayList<>(20);
/**
* Constructs a new {@Code SystemConfig} {@Code Object}
@ -102,11 +102,11 @@ public class SystemConfig {
*/
public List<String> split(String data, String regex) {
if (!data.contains(regex)) {
List<String> split = new ArrayList<>();
List<String> split = new ArrayList<>(20);
split.add(data);
return split;
}
List<String> split = new ArrayList<>();
List<String> split = new ArrayList<>(20);
String[] tokens = data.trim().split(regex);
for (String s : tokens) {
split.add(s);

View file

@ -42,7 +42,7 @@ public enum CommandSet {
/**
* Represents the list of linked plugins with this command set.
*/
private final List<CommandPlugin> plugins = new ArrayList<>();
private final List<CommandPlugin> plugins = new ArrayList<>(20);
/**
* Constructs a new {@code CommandSet} {@code Object}.

View file

@ -43,7 +43,7 @@ public final class CommunicationInfo {
/**
* The list of blocked players.
*/
private final List<String> blocked = new ArrayList<>();
private final List<String> blocked = new ArrayList<>(20);
/**
* The player's clan name.

View file

@ -62,7 +62,7 @@ public class MessageLog {
*/
public MessageLog(int capacity, boolean uniqueLogging) {
this.capacity = capacity;
this.messages = new ArrayList<>();
this.messages = new ArrayList<>(20);
this.uniqueLogging = uniqueLogging;
}

View file

@ -41,7 +41,7 @@ public final class SQLTable {
* @return The columns.
*/
public List<SQLColumn> getChanged() {
List<SQLColumn> updated = new ArrayList<>();
List<SQLColumn> updated = new ArrayList<>(20);
for (int i = 0; i < columns.length; i++) {
SQLColumn column = columns[i];
if (column.isChanged()) {

View file

@ -46,7 +46,7 @@ public class PlayerLogSQLHandler extends SQLEntryHandler<PlayerMonitor> {
if (connection.prepareStatement("SELECT * FROM " + table + " WHERE username='" + value + "' LIMIT 1").executeQuery().next()) {
String b = "SET ";
int size = 0;
List<Integer> columns = new ArrayList<>();
List<Integer> columns = new ArrayList<>(20);
for (int i = 0; i < MESSAGE_COLUMNS.length; i++) {
if (!entry.getLogs()[i].getMessages().isEmpty()) {
b += MESSAGE_COLUMNS[i] + " = CONCAT(" + MESSAGE_COLUMNS[i] + ", ?)" + (i == MESSAGE_COLUMNS.length - 1 ? "" : ",");

View file

@ -53,12 +53,12 @@ public class Region {
/**
* The region zones lying in this region.
*/
private final List<RegionZone> regionZones = new ArrayList<>();
private final List<RegionZone> regionZones = new ArrayList<>(20);
/**
* The music zones lying in this region.
*/
private final List<MusicZone> musicZones = new ArrayList<>();
private final List<MusicZone> musicZones = new ArrayList<>(20);
/**
* If the region is active.

View file

@ -62,7 +62,7 @@ public class RegionChunk {
/**
* The update flags.
*/
private List<UpdateFlag<?>> flags = new ArrayList<>();
private List<UpdateFlag<?>> flags = new ArrayList<>(20);
/**
* Constructs a new {@code RegionChunk} {@code Object}.

View file

@ -412,7 +412,7 @@ public final class RegionManager {
* @return the list.
*/
public static List<Entity> getLocalEntitys(Location location, int distance){
List<Entity> entitys = new ArrayList<>();
List<Entity> entitys = new ArrayList<>(20);
entitys.addAll(getLocalNpcs(location, distance));
entitys.addAll(getLocalPlayers(location, distance));
return entitys;
@ -626,7 +626,7 @@ public final class RegionManager {
*/
public static List<Player> getRegionPlayers(int regionId) {
Region r = forId(regionId);
List<Player> players = new ArrayList<>();
List<Player> players = new ArrayList<>(20);
for (RegionPlane plane : r.getPlanes()) {
players.addAll(plane.getPlayers());
}

View file

@ -27,7 +27,7 @@ public final class DynamicRegion extends Region {
/**
* The reserved areas.
*/
private static final List<ZoneBorders> RESERVED_AREAS = new ArrayList<>();
private static final List<ZoneBorders> RESERVED_AREAS = new ArrayList<>(20);
/**
* The region id of the copied region.
@ -113,7 +113,7 @@ public final class DynamicRegion extends Region {
ZoneBorders border = findZoneBorders((copy.getNorthEastX() - copy.getSouthWestX()) >> 3, (copy.getNorthEastY() - copy.getSouthWestY()) >> 3);
RESERVED_AREAS.add(border);
Location l = Location.create(border.getSouthWestX(), border.getSouthWestY(), 0);
List<DynamicRegion> regions = new ArrayList<>();
List<DynamicRegion> regions = new ArrayList<>(20);
for (int x = copy.getSouthWestX() >> 6; x < copy.getNorthEastX() >> 6; x++) {
for (int y = copy.getSouthWestY() >> 6; y < copy.getNorthEastY() >> 6; y++) {
int regionId = x << 8 | y;

View file

@ -41,7 +41,7 @@ public final class DumbPathfinder extends Pathfinder {
z = start.getZ();
x = start.getX();
y = start.getY();
List<Point> points = new ArrayList<>();
List<Point> points = new ArrayList<>(20);
path.setSuccesful(true);
while (x != end.getX() || y != end.getY()) {
Direction[] directions = getDirection(x, y, end);

View file

@ -40,7 +40,7 @@ public final class ProjectilePathfinder extends Pathfinder {
z = start.getZ();
x = start.getX();
y = start.getY();
List<Point> points = new ArrayList<>();
List<Point> points = new ArrayList<>(20);
path.setSuccesful(true);
while (x != end.getX() || y != end.getY()) {
Direction[] directions = getDirection(x, y, end);

View file

@ -168,7 +168,7 @@ public final class ZoneBorders {
* @return The region ids.
*/
public List<Integer> getRegionIds() {
List<Integer> regionIds = new ArrayList<>();
List<Integer> regionIds = new ArrayList<>(20);
int neX = (northEastX >> 6) + 1;
int neY = (northEastY >> 6) + 1;
for (int x = southWestX >> 6; x < neX; x++) {
@ -239,7 +239,7 @@ public final class ZoneBorders {
*/
public void addException(ZoneBorders exception) {
if (exceptions == null) {
this.exceptions = new ArrayList<>();
this.exceptions = new ArrayList<>(20);
}
exceptions.add(exception);
}

View file

@ -27,12 +27,12 @@ public final class ZoneMonitor {
/**
* The currently entered zones.
*/
private final List<RegionZone> zones = new ArrayList<>();
private final List<RegionZone> zones = new ArrayList<>(20);
/**
* The currently entered music zones.
*/
private final List<MusicZone> musicZones = new ArrayList<>();
private final List<MusicZone> musicZones = new ArrayList<>(20);
/**
* Constructs a new {@code ZoneMonitor} {@code Object}.

View file

@ -121,7 +121,7 @@ public final class WildernessZone extends MapZone {
boolean gravestone = player.getGraveManager().generateable() && player.getIronmanManager().getMode() != IronmanMode.ULTIMATE && !(killer instanceof Player);
int seconds = player.getGraveManager().getType().getDecay() * 60;
int ticks = (1000 * seconds) / 600;
List<GroundItem> items = new ArrayList<>();
List<GroundItem> items = new ArrayList<>(20);
for (Item item : c[1].toArray()) {
if (item != null) {
GroundItem ground;

View file

@ -28,7 +28,7 @@ public class PlayerTab extends ConsoleTab {
/**
* The list of player names to search through.
*/
private final List<String> playerNames = new ArrayList<>();
private final List<String> playerNames = new ArrayList<>(20);
/**
* The player name text field.

View file

@ -46,7 +46,7 @@ public final class UtilityTab extends ConsoleTab {
/**
* The list of players.
*/
private final List<Player> players = new ArrayList<>();
private final List<Player> players = new ArrayList<>(20);
/**
* The mapping of ips & their users.
@ -280,7 +280,7 @@ public final class UtilityTab extends ConsoleTab {
}
}
}
List<String> formats = new ArrayList<>();
List<String> formats = new ArrayList<>(20);
for (int i = mostWealthy.length - 1; i >= 0; i--) {
Object[] info = mostWealthy[i];
if (info != null && info[0] != null) {
@ -331,7 +331,7 @@ public final class UtilityTab extends ConsoleTab {
Map<String, Integer> map = new HashMap<>();
for (Player p : players) {
p.getAnimator();
List<core.game.container.Container> containers = new ArrayList<>();
List<core.game.container.Container> containers = new ArrayList<>(20);
containers.add(p.getInventory());
containers.add(p.getBank());
containers.add(p.getEquipment());
@ -346,7 +346,7 @@ public final class UtilityTab extends ConsoleTab {
map.put(p.getName(), amount);
}
}
List<String> formats = new ArrayList<>();
List<String> formats = new ArrayList<>(20);
for (Map.Entry<String, Integer> entry : map.entrySet()) {
formats.add("Player name=" + entry.getKey() + ", contained a total of " + entry.getValue() + " " + item.getName() + ".");
}
@ -443,7 +443,7 @@ public final class UtilityTab extends ConsoleTab {
* Checks the staff.
*/
public void staffScanner() {
List<String> staff = new ArrayList<>();
List<String> staff = new ArrayList<>(20);
for (Player player : players) {
if (player.getDetails().getRights() != Rights.REGULAR_PLAYER) {
staff.add(player.getName() + " - " + StringUtils.formatDisplayName(player.getDetails().getRights().toString()));

Some files were not shown because too many files have changed in this diff Show more