|
@@ -21,9 +21,10 @@ package com.l2jserver.gameserver.network;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Modifier;
|
|
import java.lang.reflect.Modifier;
|
|
-import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import java.util.logging.Logger;
|
|
|
|
|
|
@@ -21606,10 +21607,9 @@ public final class NpcStringId
|
|
public static final NpcStringId IT_TELEPORTS_THE_GUARD_MEMBERS_OF_THE_ELMORE_IMPERIAL_CASTLE_TO_THE_INSIDE_OF_THE_CASTLE;
|
|
public static final NpcStringId IT_TELEPORTS_THE_GUARD_MEMBERS_OF_THE_ELMORE_IMPERIAL_CASTLE_TO_THE_INSIDE_OF_THE_CASTLE;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Array containing all NpcStringId<br>
|
|
|
|
- * Important: Always initialize with a length of the highest NpcStringId + 1!!!
|
|
|
|
|
|
+ * Map containing all NpcStringId<br>
|
|
*/
|
|
*/
|
|
- private static NpcStringId[] VALUES;
|
|
|
|
|
|
+ private static Map<Integer, NpcStringId> VALUES = new HashMap<>();
|
|
|
|
|
|
static
|
|
static
|
|
{
|
|
{
|
|
@@ -25213,9 +25213,8 @@ public final class NpcStringId
|
|
private static final void buildFastLookupTable()
|
|
private static final void buildFastLookupTable()
|
|
{
|
|
{
|
|
final Field[] fields = NpcStringId.class.getDeclaredFields();
|
|
final Field[] fields = NpcStringId.class.getDeclaredFields();
|
|
- final ArrayList<NpcStringId> nsIds = new ArrayList<>(fields.length);
|
|
|
|
|
|
|
|
- int maxId = 0, mod;
|
|
|
|
|
|
+ int mod;
|
|
NpcStringId nsId;
|
|
NpcStringId nsId;
|
|
for (final Field field : fields)
|
|
for (final Field field : fields)
|
|
{
|
|
{
|
|
@@ -25227,8 +25226,8 @@ public final class NpcStringId
|
|
nsId = (NpcStringId) field.get(null);
|
|
nsId = (NpcStringId) field.get(null);
|
|
nsId.setName(field.getName());
|
|
nsId.setName(field.getName());
|
|
nsId.setParamCount(parseMessageParameters(field.getName()));
|
|
nsId.setParamCount(parseMessageParameters(field.getName()));
|
|
- maxId = Math.max(maxId, nsId.getId());
|
|
|
|
- nsIds.add(nsId);
|
|
|
|
|
|
+
|
|
|
|
+ VALUES.put(nsId.getId(), nsId);
|
|
}
|
|
}
|
|
catch (final Exception e)
|
|
catch (final Exception e)
|
|
{
|
|
{
|
|
@@ -25236,13 +25235,6 @@ public final class NpcStringId
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- VALUES = new NpcStringId[maxId + 1];
|
|
|
|
- for (int i = nsIds.size(); i-- > 0;)
|
|
|
|
- {
|
|
|
|
- nsId = nsIds.get(i);
|
|
|
|
- VALUES[nsId.getId()] = nsId;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private static final int parseMessageParameters(final String name)
|
|
private static final int parseMessageParameters(final String name)
|
|
@@ -25273,12 +25265,7 @@ public final class NpcStringId
|
|
|
|
|
|
private static final NpcStringId getNpcStringIdInternal(final int id)
|
|
private static final NpcStringId getNpcStringIdInternal(final int id)
|
|
{
|
|
{
|
|
- if ((id < 0) || (id >= VALUES.length))
|
|
|
|
- {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return VALUES[id];
|
|
|
|
|
|
+ return VALUES.get(id);
|
|
}
|
|
}
|
|
|
|
|
|
public static final NpcStringId getNpcStringId(final String name)
|
|
public static final NpcStringId getNpcStringId(final String name)
|
|
@@ -25295,7 +25282,7 @@ public final class NpcStringId
|
|
|
|
|
|
public static final void reloadLocalisations()
|
|
public static final void reloadLocalisations()
|
|
{
|
|
{
|
|
- for (final NpcStringId nsId : VALUES)
|
|
|
|
|
|
+ for (final NpcStringId nsId : VALUES.values())
|
|
{
|
|
{
|
|
if (nsId != null)
|
|
if (nsId != null)
|
|
{
|
|
{
|