This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 5th, 2010  |  syntax: None  |  size: 2.21 KB  |  views: 555  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* This program is free software; you can redistribute it and/or modify
  2.  * it under the terms of the GNU General Public License as published by
  3.  * the Free Software Foundation; either version 2, or (at your option)
  4.  * any later version.
  5.  *
  6.  * This program is distributed in the hope that it will be useful,
  7.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9.  * GNU General Public License for more details.
  10.  *
  11.  * You should have received a copy of the GNU General Public License
  12.  * along with this program; if not, write to the Free Software
  13.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  14.  * 02111-1307, USA.
  15.  *
  16.  * http://www.gnu.org/copyleft/gpl.html
  17.  */
  18. package net.sf.l2j.gameserver.model.custom;
  19.  
  20. import net.sf.l2j.gameserver.ThreadPoolManager;
  21. import net.sf.l2j.gameserver.clientpackets.Say2;
  22. import net.sf.l2j.gameserver.model.L2World;
  23. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  24. import net.sf.l2j.gameserver.serverpackets.CreatureSay;
  25.  
  26. /**
  27.  *
  28.  * @author xAddytzu
  29.  */
  30. public class ProtectionNetwork
  31. {
  32.    public static void disc(final L2PcInstance player)
  33.    {
  34.       player.sendPacket(new CreatureSay(1, Say2.HERO_VOICE, "SYSTEM", "You cannot play with dualbox."));
  35.       ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
  36.       {
  37.          public void run()
  38.          {
  39.             player.closeNetConnection();
  40.          }
  41.       }, 20000);
  42.    }
  43.    public static boolean check(L2PcInstance player)
  44.    {
  45.       boolean loggedz0r = false;
  46.       for (L2PcInstance playerz0r : L2World.getInstance().getAllPlayers())
  47.       {
  48.          String client = first(playerz0r);
  49.          String client1 = second(player);
  50.          if (client.equalsIgnoreCase(client1));
  51.             loggedz0r = true;
  52.       }
  53.       return loggedz0r;
  54.    }
  55.    private static String first(L2PcInstance player)
  56.    {
  57.       return second(player).toString();
  58.    }
  59.    private static String second(L2PcInstance player)
  60.    {
  61.       try
  62.       {
  63.          return player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress();
  64.       } catch (Throwable t){}
  65.       return null;
  66.    }
  67. }
clone this paste RAW Paste Data