/* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package net.sf.l2j.gameserver.model.entity; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.serverpackets.PlaySound; import net.sf.l2j.gameserver.serverpackets.SystemMessage; /** * * @author Noctarius */ public class LanguageEntry { private int _id = 0; private String _description = ""; private String _sound = ""; public LanguageEntry(int id) { _id = id; } public LanguageEntry(int id, String description) { _id = id; _description = description; } public LanguageEntry(int id, String description, String sound) { _id = id; _description = description; _sound = sound; } /** * Sends actual Systemmessage depending on languagesettings * * @param activeChar * @param systemMessage */ public void send(L2PcInstance activeChar, SystemMessage systemMessage) { if (!getDescription().equalsIgnoreCase("")) { activeChar.getClient().sendPacket(systemMessage.sendLanguageString(getDescription())); if (getSound().equalsIgnoreCase("")) activeChar.sendPacket(new PlaySound(getSound())); } else { activeChar.getClient().sendPacket(systemMessage); } } /** * Returns SystemMessage Id * * @return int */ public int getId() { return _id; } /** * Returns alternative languagestring if available * * @return String */ private String getDescription() { return _description; } /** * Returns soundstring if available * * @return String */ private String getSound() { return _sound; } }