Added default capacities to some arraylists
This commit is contained in:
@@ -33,7 +33,7 @@ public abstract class CutscenePlugin extends ActivityPlugin {
|
||||
/**
|
||||
* The npcs in our cutscene.
|
||||
*/
|
||||
protected final List<NPC> npcs = new ArrayList<>();
|
||||
protected final List<NPC> npcs = new ArrayList<>(100);
|
||||
|
||||
/**
|
||||
* The start pulse used for effect.
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
package core.game.content.activity.duel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import rs09.ServerConstants;
|
||||
import core.cache.def.impl.ObjectDefinition;
|
||||
import core.game.container.Container;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.game.content.dialogue.DialogueAction;
|
||||
import core.game.node.entity.skill.summoning.familiar.Familiar;
|
||||
import core.game.interaction.Option;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
@@ -19,11 +14,11 @@ import core.game.node.entity.impl.PulseManager;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.HintIconManager;
|
||||
import core.game.node.entity.player.link.prayer.PrayerType;
|
||||
import core.game.node.entity.skill.summoning.familiar.Familiar;
|
||||
import core.game.node.item.GroundItem;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.RegionManager;
|
||||
import core.game.world.map.zone.MapZone;
|
||||
@@ -32,6 +27,11 @@ import core.game.world.map.zone.ZoneRestriction;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
import core.tools.StringUtils;
|
||||
import rs09.ServerConstants;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a dueling area.
|
||||
@@ -122,8 +122,8 @@ public class DuelArea extends MapZone {
|
||||
session.getOther().getInterfaceManager().restoreTabs();
|
||||
session.getPlayer().setAttribute("duel:icon", HintIconManager.registerHintIcon(session.getPlayer(), session.getOther()));
|
||||
session.getOther().setAttribute("duel:icon", HintIconManager.registerHintIcon(session.getOther(), session.getPlayer()));
|
||||
session.getPlayer().setAttribute("duel:ammo", new ArrayList<GroundItem>());
|
||||
session.getOther().setAttribute("duel:ammo", new ArrayList<GroundItem>());
|
||||
session.getPlayer().setAttribute("duel:ammo", new ArrayList<GroundItem>(100));
|
||||
session.getOther().setAttribute("duel:ammo", new ArrayList<GroundItem>(100));
|
||||
session.getPlayer().setAttribute("vengeance", false);
|
||||
session.getOther().setAttribute("vengeance", false);
|
||||
GameWorld.getPulser().submit(new Pulse(4, session.getPlayer(), session.getOther()) {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package core.game.content.activity.mta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import core.game.component.CloseEvent;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -12,8 +9,11 @@ import core.game.container.access.InterfaceContainer;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.plugin.Plugin;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the mage training arena shop.
|
||||
@@ -44,7 +44,7 @@ public class MTAShop {
|
||||
/**
|
||||
* The viewers.
|
||||
*/
|
||||
private final List<Player> viewers = new ArrayList<>();
|
||||
private final List<Player> viewers = new ArrayList<>(100);
|
||||
|
||||
/**
|
||||
* The shop component.
|
||||
|
||||
@@ -48,7 +48,7 @@ public final class DialogueInterpreter {
|
||||
/**
|
||||
* a List of dialogue actions.
|
||||
*/
|
||||
private final List<DialogueAction> actions = new ArrayList<>();
|
||||
private final List<DialogueAction> actions = new ArrayList<>(10);
|
||||
|
||||
/**
|
||||
* The currently opened dialogue.
|
||||
|
||||
@@ -43,8 +43,8 @@ public abstract class DialoguePlugin implements Plugin<Player> {
|
||||
|
||||
public DialogueFile file;
|
||||
|
||||
protected ArrayList<String> optionNames = new ArrayList<String>();
|
||||
protected ArrayList<DialogueFile> optionFiles = new ArrayList<DialogueFile>();
|
||||
protected ArrayList<String> optionNames = new ArrayList<String>(10);
|
||||
protected ArrayList<DialogueFile> optionFiles = new ArrayList<DialogueFile>(10);
|
||||
|
||||
/**
|
||||
* Two options interface.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import core.game.content.global.GodBook;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the dialogue for jossik.
|
||||
@@ -86,7 +86,7 @@ public class JossikDialogue extends DialoguePlugin {
|
||||
stage = 23;
|
||||
return true;
|
||||
}
|
||||
uncompleted = new ArrayList<>();
|
||||
uncompleted = new ArrayList<>(5);
|
||||
for (GodBook book : GodBook.values()) {
|
||||
if (!player.getSavedData().getGlobalData().hasCompletedGodBook(book)) {
|
||||
uncompleted.add(book);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.info.Rights;
|
||||
import core.game.node.entity.player.link.IronmanMode;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.zone.impl.ModeratorZone;
|
||||
import core.plugin.Initializable;
|
||||
import core.net.amsc.MSPacketRepository;
|
||||
import core.plugin.Initializable;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the lumbridge guide dialogue plugin.
|
||||
@@ -65,7 +65,7 @@ public final class LumbridgeGuideDialogue extends DialoguePlugin {
|
||||
stage = 103;
|
||||
return true;
|
||||
}
|
||||
options = new ArrayList<>();
|
||||
options = new ArrayList<>(5);
|
||||
options.add("Yes please.");
|
||||
if (player.getRights() == Rights.PLAYER_MODERATOR && ModeratorZone.isOpen() || player.isAdmin()) {
|
||||
options.add("I would like to access the P-Mod room.");
|
||||
|
||||
@@ -21,7 +21,7 @@ public abstract class HolidayEvent extends MapZone implements Plugin<Object> {
|
||||
/**
|
||||
* The list of holiday events.
|
||||
*/
|
||||
private static final List<HolidayEvent> EVENTS = new ArrayList<>();
|
||||
private static final List<HolidayEvent> EVENTS = new ArrayList<>(5);
|
||||
|
||||
/**
|
||||
* The current holiday event.
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package core.game.interaction.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.ChanceItem;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the herb box item.
|
||||
* @author Vexia
|
||||
@@ -49,7 +49,7 @@ public class HerbBoxPlugin extends OptionHandler {
|
||||
player.sendMessage("You don't have enough bank space to bank all those herbs.");
|
||||
break;
|
||||
}
|
||||
List<ChanceItem> herbList = new ArrayList<>();
|
||||
List<ChanceItem> herbList = new ArrayList<>(5);
|
||||
for (int i = 0; i < herbs; i++) {
|
||||
herbList.add(RandomFunction.getChanceItem(HERBS));
|
||||
}
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
package core.game.interaction.object;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import core.cache.def.impl.ObjectDefinition;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.skill.firemaking.Log;
|
||||
import core.game.node.entity.skill.gather.SkillingTool;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
@@ -16,18 +9,25 @@ import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.npc.drop.DropFrequency;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.skill.firemaking.Log;
|
||||
import core.game.node.entity.skill.gather.SkillingTool;
|
||||
import core.game.node.item.ChanceItem;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.object.GameObject;
|
||||
import core.game.node.object.ObjectBuilder;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import rs09.game.world.repository.Repository;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import rs09.plugin.PluginManager;
|
||||
import core.tools.RandomFunction;
|
||||
import rs09.game.world.GameWorld;
|
||||
import rs09.game.world.repository.Repository;
|
||||
import rs09.plugin.PluginManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the pyre site plugin.
|
||||
@@ -59,7 +59,7 @@ public final class PyreSitePlugin extends OptionHandler {
|
||||
/**
|
||||
* The list of used pyre ship locations.
|
||||
*/
|
||||
private static final List<Location> USED_LOCATIONS = new ArrayList<>();
|
||||
private static final List<Location> USED_LOCATIONS = new ArrayList<>(20);
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
package core.game.interaction.object;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import core.cache.def.impl.ObjectDefinition;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.combat.ImpactHandler.HitsplatType;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.item.ChanceItem;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.object.GameObject;
|
||||
import core.game.node.object.ObjectBuilder;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the thieving guide plugin.
|
||||
@@ -143,7 +143,7 @@ public class ThievingGuidePlugin extends OptionHandler {
|
||||
*/
|
||||
private void addItem(Player player) {
|
||||
ChanceItem[] l = RandomFunction.random(2) == 1 ? GEMS : COINS;
|
||||
List<ChanceItem> chances = new ArrayList<>();
|
||||
List<ChanceItem> chances = new ArrayList<>(20);
|
||||
for (ChanceItem c : l) {
|
||||
chances.add(c);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class GameAttributes {
|
||||
/**
|
||||
* The list of attributes to save.
|
||||
*/
|
||||
private final List<String> savedAttributes = new ArrayList<>();
|
||||
private final List<String> savedAttributes = new ArrayList<>(250);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GameAttributes} {@code Object}.
|
||||
|
||||
@@ -80,7 +80,7 @@ public final class CookingRecipePlugin extends UseWithHandler {
|
||||
* @return the allowed nodes.
|
||||
*/
|
||||
private final static int[] getAllowedNodes() {
|
||||
List<Integer> bases = new ArrayList<>();
|
||||
List<Integer> bases = new ArrayList<>(10);
|
||||
for (Recipe recipe : Recipe.RECIPES) {
|
||||
for (Item base : recipe.getParts()) {
|
||||
if (bases.contains(base.getId())) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class HunterNPC extends AbstractNPC {
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
List<Integer> ids = new ArrayList<>(10);
|
||||
for (Traps t : Traps.values()) {
|
||||
for (TrapNode node : t.getNodes()) {
|
||||
for (int id : node.getNpcIds()) {
|
||||
|
||||
@@ -166,7 +166,7 @@ public final class HunterPlugin extends OptionHandler {
|
||||
* @return the ids.
|
||||
*/
|
||||
public static int[] getIds() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
List<Integer> list = new ArrayList<>(10);
|
||||
for (Traps trap : Traps.values()) {
|
||||
for (int id : trap.getSettings().getBaitIds()) {
|
||||
list.add(id);
|
||||
|
||||
@@ -227,7 +227,7 @@ public final class NetTrapSetting extends TrapSetting {
|
||||
* @return the array.
|
||||
*/
|
||||
public static int[] getIds() {
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
List<Integer> ids = new ArrayList<>(10);
|
||||
for (NetTrap trap : NetTrap.values()) {
|
||||
ids.add(trap.getBent());
|
||||
ids.add(trap.getCaught());
|
||||
|
||||
@@ -21,7 +21,7 @@ public final class TrapWrapper {
|
||||
/**
|
||||
* The items to be recieved on trap clearing.
|
||||
*/
|
||||
private final List<Item> items = new ArrayList<>();
|
||||
private final List<Item> items = new ArrayList<>(10);
|
||||
|
||||
/**
|
||||
* The player instance.
|
||||
|
||||
@@ -58,7 +58,7 @@ public enum Traps {
|
||||
/**
|
||||
* The location hooks for this node.
|
||||
*/
|
||||
private final List<TrapHook> hooks = new ArrayList<>();
|
||||
private final List<TrapHook> hooks = new ArrayList<>(5);
|
||||
|
||||
/**
|
||||
* The trap settings.
|
||||
|
||||
@@ -29,7 +29,7 @@ public final class NechryaelNPC extends AbstractNPC {
|
||||
/**
|
||||
* The death spawn npcs.
|
||||
*/
|
||||
private List<DeathSpawnNPC> spawns = new ArrayList<>();
|
||||
private List<DeathSpawnNPC> spawns = new ArrayList<>(10);
|
||||
|
||||
/**
|
||||
* The next spawn time.
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package core.game.node.entity.skill.slayer;
|
||||
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import rs09.game.system.SystemLogger;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.tools.RandomFunction;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -165,7 +162,7 @@ public final class SlayerManager {
|
||||
* @param master the master to give the task.
|
||||
*/
|
||||
public void generate(Master master) {
|
||||
final List<Master.Task> tasks = new ArrayList<>();
|
||||
final List<Master.Task> tasks = new ArrayList<>(10);
|
||||
final int[] taskWeightSum = {0};
|
||||
master.tasks.stream().filter(task -> canBeAssigned(task.task) && task.task.combatCheck <= player.getProperties().getCurrentCombatLevel()).forEach(task -> {
|
||||
taskWeightSum[0] += task.weight;
|
||||
|
||||
@@ -150,7 +150,7 @@ public final class FurnaceOptionPlugin extends OptionHandler {
|
||||
* @return the ids.
|
||||
*/
|
||||
public static final int[] getIds() {
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
List<Integer> ids = new ArrayList<>(10);
|
||||
for (Bar bar : Bar.values()) {
|
||||
for (Item i : bar.getOres()) {
|
||||
ids.add(i.getId());
|
||||
|
||||
Reference in New Issue
Block a user