/* 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.custom; import net.sf.l2j.gameserver.ThreadPoolManager; import net.sf.l2j.gameserver.clientpackets.Say2; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.serverpackets.CreatureSay; /** * * @author xAddytzu */ public class ProtectionNetwork { public static void disc(final L2PcInstance player) { player.sendPacket(new CreatureSay(1, Say2.HERO_VOICE, "SYSTEM", "You cannot play with dualbox.")); ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() { public void run() { player.closeNetConnection(); } }, 20000); } public static boolean check(L2PcInstance player) { boolean loggedz0r = false; for (L2PcInstance playerz0r : L2World.getInstance().getAllPlayers()) { String client = first(playerz0r); String client1 = second(player); if (client.equalsIgnoreCase(client1)); loggedz0r = true; } return loggedz0r; } private static String first(L2PcInstance player) { return second(player).toString(); } private static String second(L2PcInstance player) { try { return player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress(); } catch (Throwable t){} return null; } }