Support for builder messages through SendMessageLocalisationData.

This commit is contained in:
MobiusDevelopment
2020-01-18 12:48:58 +00:00
parent ed7267ebac
commit 91a2ae4f93
51 changed files with 697 additions and 765 deletions
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8985,16 +8985,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8992,16 +8992,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8994,16 +8994,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8978,16 +8978,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8964,16 +8964,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8964,16 +8964,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8965,16 +8965,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8930,16 +8930,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -9608,16 +9608,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void enterObserverMode(Location loc) public void enterObserverMode(Location loc)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -40,7 +41,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -9488,16 +9488,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void enterObserverMode(Location loc) public void enterObserverMode(Location loc)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -40,7 +41,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8936,16 +8936,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8937,16 +8937,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8922,16 +8922,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8949,16 +8949,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8949,16 +8949,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8853,16 +8853,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/** /**
* @author Mobius * @author Mobius
@@ -86,9 +87,11 @@ 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 (Config.MULTILANG_ENABLE)
{
final Map<String[], String[]> localisations = SEND_MESSAGE_LOCALISATIONS.get(player.getLang());
if (localisations != null) if (localisations != null)
{ {
// No pretty way of doing something like this. // No pretty way of doing something like this.
@@ -126,13 +129,14 @@ public class SendMessageLocalisationData implements IXmlReader
{ {
message = message.replace(searchMessage[i], replacementMessage[i]); message = message.replace(searchMessage[i], replacementMessage[i]);
} }
break;
}
}
}
}
}
return message; return message;
} }
}
}
}
return null;
}
public static SendMessageLocalisationData getInstance() public static SendMessageLocalisationData getInstance()
{ {
@@ -8937,16 +8937,7 @@ public class PlayerInstance extends Playable
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
if (Config.MULTILANG_ENABLE) sendPacket(new SystemMessage(SendMessageLocalisationData.getLocalisation(this, message)));
{
final String localisation = SendMessageLocalisationData.getInstance().getLocalisation(_lang, message);
if (localisation != null)
{
sendPacket(new SystemMessage(localisation));
return;
}
}
sendPacket(new SystemMessage(message));
} }
public void setObserving(boolean state) public void setObserving(boolean state)
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.util; package org.l2jmobius.gameserver.util;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -41,7 +42,7 @@ public class BuilderUtil
{ {
if (Config.GM_STARTUP_BUILDER_HIDE) 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 else
{ {