Support for builder messages through SendMessageLocalisationData.
This commit is contained in:
parent
ed7267ebac
commit
91a2ae4f93
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8985,16 +8985,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8992,16 +8992,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8994,16 +8994,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8978,16 +8978,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8964,16 +8964,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8964,16 +8964,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8965,16 +8965,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8930,16 +8930,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -9608,16 +9608,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void enterObserverMode(Location loc)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -40,7 +41,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -9488,16 +9488,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void enterObserverMode(Location loc)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -40,7 +41,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8936,16 +8936,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8937,16 +8937,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8922,16 +8922,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8949,16 +8949,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8949,16 +8949,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8853,16 +8853,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -86,52 +87,55 @@ public class SendMessageLocalisationData implements IXmlReader
|
||||
}));
|
||||
}
|
||||
|
||||
public String getLocalisation(String lang, String message)
|
||||
public static String getLocalisation(PlayerInstance player, String message)
|
||||
{
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(lang);
|
||||
if (localisations != null)
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
|
||||
if (localisations != null)
|
||||
{
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
// No pretty way of doing something like this.
|
||||
// Consider using proper SystemMessages where possible.
|
||||
String[] searchMessage;
|
||||
String[] replacementMessage;
|
||||
boolean found;
|
||||
for (Entry<String[], String[]> entry : localisations.entrySet())
|
||||
{
|
||||
if (searchMessage[0].equals(message))
|
||||
searchMessage = entry.getKey();
|
||||
replacementMessage = entry.getValue();
|
||||
|
||||
// Exact match.
|
||||
if (searchMessage.length == 1)
|
||||
{
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
if (searchMessage[0].equals(message))
|
||||
{
|
||||
found = false;
|
||||
return replacementMessage[0];
|
||||
}
|
||||
}
|
||||
else // Split match.
|
||||
{
|
||||
found = true;
|
||||
for (String part : searchMessage)
|
||||
{
|
||||
if (!message.contains(part))
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
for (int i = 0; i < searchMessage.length; i++)
|
||||
{
|
||||
message = message.replace(searchMessage[i], replacementMessage[i]);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static SendMessageLocalisationData getInstance()
|
||||
|
@ -8937,16 +8937,7 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
if (Config.MULTILANG_ENABLE)
|
||||
{
|
||||
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
|
||||
if (localisation != null)
|
||||
{
|
||||
sendPacket(new SystemMessage(localisation));
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPacket(new SystemMessage(message));
|
||||
sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
|
||||
}
|
||||
|
||||
public void setObserving(boolean state)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.util;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -41,7 +42,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", SendMessageLocalisationData.getLocalisation(player, message)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user