Load all localisations together at server start.

This commit is contained in:
MobiusDevelopment
2019-07-14 18:02:00 +00:00
parent 064d0324e8
commit ea4a96abe8
65 changed files with 208 additions and 182 deletions

View File

@ -150,6 +150,8 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
import org.l2jmobius.gameserver.model.votereward.VoteSystem;
import org.l2jmobius.gameserver.network.ClientNetworkManager;
import org.l2jmobius.gameserver.network.NpcStringId;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager;
import org.l2jmobius.gameserver.network.telnet.TelnetServer;
import org.l2jmobius.gameserver.scripting.ScriptEngineManager;
@ -349,6 +351,8 @@ public class GameServer
}
if (Config.MULTILANG_ENABLE)
{
SystemMessageId.loadLocalisations();
NpcStringId.loadLocalisations();
SendMessageLocalisationData.getInstance();
NpcNameLocalisationData.getInstance();
}

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.w3c.dom.Document;
@ -67,7 +68,7 @@ public class NpcNameLocalisationData implements IXmlReader
}
else
{
LOGGER.info(getClass().getSimpleName() + ": Loaded localisations for '" + lang + "'");
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded localisations for [" + lang + "].");
}
}
}

View File

@ -20,6 +20,7 @@ import java.io.File;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.w3c.dom.Document;
@ -69,7 +70,7 @@ public class SendMessageLocalisationData implements IXmlReader
}
else
{
LOGGER.info(getClass().getSimpleName() + ": Loaded localisations for '" + lang + "'");
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded localisations for [" + lang + "].");
}
}
}

View File

@ -39,10 +39,9 @@ import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
public final class NpcStringId
{
private static final Logger LOGGER = Logger.getLogger(NpcStringId.class.getName());
private static final NSLocalisation[] EMPTY_NSL_ARRAY = new NSLocalisation[0];
public static final NpcStringId[] EMPTY_ARRAY = new NpcStringId[0];
private static Map<Integer, NpcStringId> VALUES = new HashMap<>();
private static final NSLocalisation[] EMPTY_NSL_ARRAY = new NSLocalisation[0];
private static final Map<Integer, NpcStringId> VALUES = new HashMap<>();
@ClientString(id = 1, message = "Hello! I am $s1. You are $s2, right? Hehehe")
public static NpcStringId HELLO_I_AM_S1_YOU_ARE_S2_RIGHT_HEHEHE;
@ -36245,7 +36244,6 @@ public final class NpcStringId
static
{
buildFastLookupTable();
loadLocalisations();
}
private static void buildFastLookupTable()
@ -36357,8 +36355,6 @@ public final class NpcStringId
continue;
}
LOGGER.log(Level.INFO, "NpcStringId: Loading localisation for '" + lang + "'");
try
{
doc = factory.newDocumentBuilder().parse(file);
@ -36406,6 +36402,8 @@ public final class NpcStringId
{
LOGGER.log(Level.SEVERE, "NpcStringId: Failed loading '" + file + "'", e);
}
LOGGER.log(Level.INFO, "NpcStringId: Loaded localisations for [" + lang + "].");
}
}

View File

@ -39,10 +39,9 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public final class SystemMessageId
{
private static final Logger LOGGER = Logger.getLogger(SystemMessageId.class.getName());
private static final SMLocalisation[] EMPTY_SML_ARRAY = new SMLocalisation[0];
public static final SystemMessageId[] EMPTY_ARRAY = new SystemMessageId[0];
private static Map<Integer, SystemMessageId> VALUES = new HashMap<>();
private static final SMLocalisation[] EMPTY_SML_ARRAY = new SMLocalisation[0];
private static final Map<Integer, SystemMessageId> VALUES = new HashMap<>();
@ClientString(id = 0, message = "You have been disconnected from the server.")
public static SystemMessageId YOU_HAVE_BEEN_DISCONNECTED_FROM_THE_SERVER;
@ -15620,7 +15619,6 @@ public final class SystemMessageId
static
{
buildFastLookupTable();
loadLocalisations();
}
private static void buildFastLookupTable()
@ -15726,8 +15724,6 @@ public final class SystemMessageId
continue;
}
LOGGER.log(Level.INFO, "SystemMessageId: Loading localisation for '" + lang + "'");
try
{
doc = factory.newDocumentBuilder().parse(file);
@ -15775,6 +15771,8 @@ public final class SystemMessageId
{
LOGGER.log(Level.SEVERE, "SystemMessageId: Failed loading '" + file + "'", e);
}
LOGGER.log(Level.INFO, "SystemMessageId: Loaded localisations for [" + lang + "].");
}
}