Jump to content

Question

Posted

Eu usei esse código e eu tentei adptar para l2jfrozen , mas eu tenho erros no servidor run fonte original.

 

 

Obs : quero deixa claro que o mod estar corrento na parte de copiliar .

mas tem um poblema que vc so pode logar 1 char se loga outro da erro

quem conseguir aprimora o erro que da no console do gameserver por favor

compartilha aqui o erro  Agradeço .

 

Ex : o mod foi criado para loga 2 conta por pc .

so que tem algum erro no mod porque quando voce

vai loga a segunda conta da um erro.

 

esse é o erro quem conseguir acha o erro e conseguir

ajeitar compartilhe com nos .

 

XxnYpRq.png

 

 

 

Index: config/protected/other.properties
===================================================================
--- config/protected/other.properties (revision 991)
+++ config/protected/other.properties (working copy)
@@ -39,6 +39,9 @@
AllowDualBoxInOly = False
AllowDualBoxInEvent = False

+# Multbox protection based on client tracert comparison
+MultiBoxesPerPC = 2
+
#=================================#
# Bot Protection #
#=================================#
Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java (revision 991)
+++ head-src/com/l2jfrozen/Config.java (working copy)
@@ -608,7 +608,8 @@
public static String CHAT_FILTER_CHARS;
public static String CHAT_FILTER_PUNISHMENT;
public static ArrayList<String> FILTER_LIST = new ArrayList<String>();
-
+ public static int MAX_PLAYERS_FROM_ONE_PC;
+
public static int FS_TIME_ATTACK;
public static int FS_TIME_COOLDOWN;
public static int FS_TIME_ENTRY;
@@ -3445,7 +3446,7 @@
ALLOW_DUALBOX_EVENT = Boolean.parseBoolean(POtherSetting.getProperty("AllowDualBoxInEvent", "True"));
ALLOWED_BOXES = Integer.parseInt(POtherSetting.getProperty("AllowedBoxes", "99"));
ALLOW_DUALBOX = Boolean.parseBoolean(POtherSetting.getProperty("AllowDualBox", "True"));
-
+ MAX_PLAYERS_FROM_ONE_PC = Integer.parseInt(POtherSetting.getProperty("MultiboxesPerPC", "2"));
BOT_PROTECTOR = Boolean.parseBoolean(POtherSetting.getProperty("BotProtect", "False"));
BOT_PROTECTOR_FIRST_CHECK = Integer.parseInt(POtherSetting.getProperty("BotProtectFirstCheck", "15"));
BOT_PROTECTOR_NEXT_CHECK = Integer.parseInt(POtherSetting.getProperty("BotProtectNextCheck", "60"));
@@ -5323,6 +5324,7 @@
{
TVT_REVIVE_DELAY = Long.parseLong(pValue);
}
+ else if (pName.equalsIgnoreCase("MultiBoxesPerPC")) MAX_PLAYERS_FROM_ONE_PC = Integer.parseInt(pValue);
else if(pName.equalsIgnoreCase("MinKarma"))
{
KARMA_MIN_KARMA = Integer.parseInt(pValue);
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4348)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -164,6 +164,7 @@
import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;
import com.l2jserver.gameserver.network.L2GameClient;
+import com.l2jserver.gameserver.network.MultiBoxProtection;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
import com.l2jserver.gameserver.network.communityserver.writepackets.WorldInfo;
@@ -11964,6 +11965,19 @@
_log.log(Level.SEVERE, "deleteMe()", e);
}

+ try
+ {
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0 && getClient() != null
+ && getClient().getAdress() != null && getClient().getTrace() != null)
+ {
+ MultiBoxProtection.getInstance().removeConnection(getClient());
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "deleteMe()", e);
+ }
+
// Close the connection with the client
closeNetConnection(closeClient);
Index: head-src/com/l2jfrozen/gameserver/network/L2GameClient.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (working copy)
@@ -93,6 +93,7 @@

// Info
public String accountName;
+ private String _adress;
public SessionKey sessionId;
public L2PcInstance activeChar;
private ReentrantLock _activeCharLock = new ReentrantLock();
@@ -110,7 +111,7 @@

// Crypt
public GameCrypt crypt;
-
+ private int[][] trace;
// Flood protection
public long packetsNextSendTick = 0;

@@ -130,6 +131,8 @@
public L2GameClient(MMOConnection<L2GameClient> con)
{
super(con);
+ if (con != null)
+ _adress = con.getInetAddress().getHostAddress();
state = GameClientState.CONNECTED;
_connectionstartTime = System.currentTimeMillis();
crypt = new GameCrypt();
@@ -233,6 +236,10 @@
return accountName;
}

+ public String getAdress()
+ {
+ return _adress;
+ }
public void setSessionId(SessionKey sk)
{
sessionId = sk;
@@ -973,8 +980,15 @@
//Decrease boxes number
if(player._active_boxes!=-1)
player.decreaseBoxes();
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0)
+ {
+ MultiBoxProtection.getInstance().removeConnection(L2GameClient.this);
+ }
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0 && !isDetached())
+ {
+ MultiBoxProtection.getInstance().removeConnection(L2GameClient.this);
+ }

-
if(!player.isKicked() && !Olympiad.getInstance().isRegistered(player)
&& !player.isInOlympiadMode()
&& !player.isInFunEvent()
@@ -1211,6 +1226,14 @@
_queueLock.unlock();
}
}
+ public void setClientTracert(int[][] tracert)
+ {
+ trace = tracert;
+ }
+ public int[][] getTrace()
+ {
+ return trace;
+ }

/**
* @return the _forcedToClose
Index: head-src/com/l2jfrozen/gameserver/network/MultiBoxProtection.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/MultiBoxProtection.java (revision 0)
+++ head-src/com/l2jfrozen/gameserver/network/MultiBoxProtection.java (revision 0)
@@ -0,0 +1,155 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jfrozen.gameserver.network;
+
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.logging.Logger;
+import com.l2jfrozen.Config;
+
+import javolution.util.FastMap;
+
+
+/**
+ * @author LucasDesigner
+ *
+ */
+public class MultiBoxProtection
+{
+ protected static final Logger _log = Logger.getLogger(MultiBoxProtection.class.getName());
+ private Map<IpPack, Integer> map;
+
+ public static MultiBoxProtection getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ public MultiBoxProtection()
+ {
+ map = new FastMap<MultiBoxProtection.IpPack, Integer>();
+ }
+
+ public synchronized boolean registerNewConnection(L2GameClient client)
+ {
+ IpPack pack = new IpPack(client.getAdress(), client.getTrace());
+ Integer count = map.get(pack);
+ if (count == null)
+ {
+ count = 1;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.registerNewConnection(): Set Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count);
+ return true;
+ }
+ else if (count < Config.MAX_PLAYERS_FROM_ONE_PC)
+ {
+ count++;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.registerNewConnection(): Increase Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count);
+ return true;
+ }
+ else
+ {
+ count++;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.registerNewConnection(): Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") is " + count);
+ return false;
+ }
+
+ }
+
+ public synchronized void removeConnection(L2GameClient client)
+ {
+ if (client == null)
+ return;
+
+ IpPack pack = new IpPack(client.getAdress(), client.getTrace());
+ Integer count = map.get(pack);
+ if (count != null && count > 1)
+ {
+ count--;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.removeConnection(): Decrease Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count);
+
+ }
+ else
+ {
+ map.remove(pack);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.removeConnection(): Remove Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ")");
+ }
+ }
+
+ @SuppressWarnings("synthetic-access")
+ private static class SingletonHolder
+ {
+ protected static final MultiBoxProtection _instance = new MultiBoxProtection();
+ }
+
+ public final static class IpPack
+ {
+ String ip;
+ int[][] tracert;
+
+ public IpPack(String ip, int[][] tracert)
+ {
+ this.ip = ip;
+ this.tracert = tracert;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((ip == null) ? 0 : ip.hashCode());
+ if(tracert == null)
+ return result;
+ for (int[] array: tracert)
+ result = prime * result + Arrays.hashCode(array);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ IpPack other = (IpPack) obj;
+ if (ip == null)
+ {
+ if (other.ip != null)
+ return false;
+ }
+ else if (!ip.equals(other.ip))
+ return false;
+ for (int i = 0 ; i < tracert.length; i++)
+ for (int o = 0; o < tracert[0].length; o++)
+ if (tracert[i][o] != other.tracert[i][o])
+ return false;
+ return true;
+ }
+
+ }
+}
+
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -68,6 +68,7 @@
import com.l2jfrozen.gameserver.model.entity.siege.Siege;
import com.l2jfrozen.gameserver.model.quest.Quest;
import com.l2jfrozen.gameserver.model.quest.QuestState;
+import com.l2jfrozen.gameserver.network.MultiBoxProtection;
import com.l2jfrozen.gameserver.network.Disconnection;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.ClientSetTime;
@@ -121,7 +122,7 @@
@Override
protected void runImpl()
{
- L2PcInstance activeChar = getClient().getActiveChar();
+ final L2PcInstance activeChar = getClient().getActiveChar();

if (activeChar == null)
{
@@ -422,6 +422,23 @@
activeChar.sendMessage("I'm sorry, but multibox is not allowed here.");
activeChar.logout();
}
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0)
+ {
+ if (!MultiBoxProtection.getInstance().registerNewConnection(getClient()))
+ {
+ activeChar.sendMessage("Too many connections, please logout other characters first.");
+ if (Config.DEVELOPER)
+ _log.info("Too many conections, disconnecting " + activeChar.getName());
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ public void run()
+ {
+ activeChar.logout(false);
+ }
+ }, 400);
+ return;
+ }
+ }

Hellows(activeChar);

Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (working copy)
@@ -25,11 +25,14 @@
import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager;
import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.model.Inventory;
import com.l2jfrozen.gameserver.model.L2Party;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSignsFestival;
import com.l2jfrozen.gameserver.network.L2GameClient;
+import com.l2jfrozen.gameserver.network.MultiBoxProtection;
import com.l2jfrozen.gameserver.network.L2GameClient.GameClientState;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
@@ -177,7 +187,11 @@
}

L2GameClient client = getClient();
-
+
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0)
+ {
+ MultiBoxProtection.getInstance().removeConnection(client);
+ }
// detach the client from the char so that the connection isnt closed in the deleteMe
player.setClient(null);

6 answers to this question

Recommended Posts

  • 0
Posted

good share but l2j have something a bit better just look into their configs to check

 

# ---------------------------------------------------------------------------

# Dualbox Check

# ---------------------------------------------------------------------------

 

# Maximum number of players per IP address allowed to enter game.

# Default: 0 (unlimited)

DualboxCheckMaxPlayersPerIP = 0

 

# Maximum number of players per IP address allowed to participate in olympiad.

# Default: 0 (unlimited)

DualboxCheckMaxOlympiadParticipantsPerIP = 0

 

# Maximum number of players per IP address allowed to participate in events using L2J Event Engine (//event).

# Default: 0 (unlimited)

DualboxCheckMaxL2EventParticipantsPerIP = 0

 

# Whitelist of the addresses for dualbox checks.

# Format: Address1,Number1;Address2,Number2...

# Network address can be number (127.0.0.1) or symbolic (localhost) formats.

# Additional connection number added to the global limits for this address.

# For example, if number of TvT event participants per IP address set to the 1 (no dualbox)

# and whitelist contains "l2jserver.com,2" then number of allowed participants from l2jserver.com

# will be 1+2=3. Use 0 or negative value for unlimited number of connections.

# Default: 127.0.0.1,0 (no limits from localhost)

DualboxCheckWhitelist = 127.0.0.1,0

 

Also please use language thanks :)

  • 0
Posted

It's not a share, he is asking for help to solve the errors from gs, I guess.

Moved to right section.

Edit your title and write in proper english, in order to receive any kind of help.

  • 0
Posted

Eu usei esse código e eu tentei adptar para l2jfrozen , mas eu tenho erros no servidor run fonte original.

 

 

 

 

 

Index: config/protected/other.properties
===================================================================
--- config/protected/other.properties (revision 991)
+++ config/protected/other.properties (working copy)
@@ -39,6 +39,9 @@
AllowDualBoxInOly = False
AllowDualBoxInEvent = False

+# Multbox protection based on client tracert comparison
+MultiBoxesPerPC = 2
+
#=================================#
# Bot Protection #
#=================================#
Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java (revision 991)
+++ head-src/com/l2jfrozen/Config.java (working copy)
@@ -608,7 +608,8 @@
public static String CHAT_FILTER_CHARS;
public static String CHAT_FILTER_PUNISHMENT;
public static ArrayList<String> FILTER_LIST = new ArrayList<String>();
-
+ public static int MAX_PLAYERS_FROM_ONE_PC;
+
public static int FS_TIME_ATTACK;
public static int FS_TIME_COOLDOWN;
public static int FS_TIME_ENTRY;
@@ -3445,7 +3446,7 @@
ALLOW_DUALBOX_EVENT = Boolean.parseBoolean(POtherSetting.getProperty("AllowDualBoxInEvent", "True"));
ALLOWED_BOXES = Integer.parseInt(POtherSetting.getProperty("AllowedBoxes", "99"));
ALLOW_DUALBOX = Boolean.parseBoolean(POtherSetting.getProperty("AllowDualBox", "True"));
-
+ MAX_PLAYERS_FROM_ONE_PC = Integer.parseInt(POtherSetting.getProperty("MultiboxesPerPC", "2"));
BOT_PROTECTOR = Boolean.parseBoolean(POtherSetting.getProperty("BotProtect", "False"));
BOT_PROTECTOR_FIRST_CHECK = Integer.parseInt(POtherSetting.getProperty("BotProtectFirstCheck", "15"));
BOT_PROTECTOR_NEXT_CHECK = Integer.parseInt(POtherSetting.getProperty("BotProtectNextCheck", "60"));
@@ -5323,6 +5324,7 @@
{
TVT_REVIVE_DELAY = Long.parseLong(pValue);
}
+ else if (pName.equalsIgnoreCase("MultiBoxesPerPC")) MAX_PLAYERS_FROM_ONE_PC = Integer.parseInt(pValue);
else if(pName.equalsIgnoreCase("MinKarma"))
{
KARMA_MIN_KARMA = Integer.parseInt(pValue);
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4348)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -164,6 +164,7 @@
import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;
import com.l2jserver.gameserver.network.L2GameClient;
+import com.l2jserver.gameserver.network.MultiBoxProtection;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
import com.l2jserver.gameserver.network.communityserver.writepackets.WorldInfo;
@@ -11964,6 +11965,19 @@
_log.log(Level.SEVERE, "deleteMe()", e);
}

+ try
+ {
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0 && getClient() != null
+ && getClient().getAdress() != null && getClient().getTrace() != null)
+ {
+ MultiBoxProtection.getInstance().removeConnection(getClient());
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "deleteMe()", e);
+ }
+
// Close the connection with the client
closeNetConnection(closeClient);
Index: head-src/com/l2jfrozen/gameserver/network/L2GameClient.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/L2GameClient.java (working copy)
@@ -93,6 +93,7 @@

// Info
public String accountName;
+ private String _adress;
public SessionKey sessionId;
public L2PcInstance activeChar;
private ReentrantLock _activeCharLock = new ReentrantLock();
@@ -110,7 +111,7 @@

// Crypt
public GameCrypt crypt;
-
+ private int[][] trace;
// Flood protection
public long packetsNextSendTick = 0;

@@ -130,6 +131,8 @@
public L2GameClient(MMOConnection<L2GameClient> con)
{
super(con);
+ if (con != null)
+ _adress = con.getInetAddress().getHostAddress();
state = GameClientState.CONNECTED;
_connectionstartTime = System.currentTimeMillis();
crypt = new GameCrypt();
@@ -233,6 +236,10 @@
return accountName;
}

+ public String getAdress()
+ {
+ return _adress;
+ }
public void setSessionId(SessionKey sk)
{
sessionId = sk;
@@ -973,8 +980,15 @@
//Decrease boxes number
if(player._active_boxes!=-1)
player.decreaseBoxes();
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0)
+ {
+ MultiBoxProtection.getInstance().removeConnection(L2GameClient.this);
+ }
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0 && !isDetached())
+ {
+ MultiBoxProtection.getInstance().removeConnection(L2GameClient.this);
+ }

-
if(!player.isKicked() && !Olympiad.getInstance().isRegistered(player)
&& !player.isInOlympiadMode()
&& !player.isInFunEvent()
@@ -1211,6 +1226,14 @@
_queueLock.unlock();
}
}
+ public void setClientTracert(int[][] tracert)
+ {
+ trace = tracert;
+ }
+ public int[][] getTrace()
+ {
+ return trace;
+ }

/**
* @return the _forcedToClose
Index: head-src/com/l2jfrozen/gameserver/network/MultiBoxProtection.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/MultiBoxProtection.java (revision 0)
+++ head-src/com/l2jfrozen/gameserver/network/MultiBoxProtection.java (revision 0)
@@ -0,0 +1,155 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jfrozen.gameserver.network;
+
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.logging.Logger;
+import com.l2jfrozen.Config;
+
+import javolution.util.FastMap;
+
+
+/**
+ * @author LucasDesigner
+ *
+ */
+public class MultiBoxProtection
+{
+ protected static final Logger _log = Logger.getLogger(MultiBoxProtection.class.getName());
+ private Map<IpPack, Integer> map;
+
+ public static MultiBoxProtection getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ public MultiBoxProtection()
+ {
+ map = new FastMap<MultiBoxProtection.IpPack, Integer>();
+ }
+
+ public synchronized boolean registerNewConnection(L2GameClient client)
+ {
+ IpPack pack = new IpPack(client.getAdress(), client.getTrace());
+ Integer count = map.get(pack);
+ if (count == null)
+ {
+ count = 1;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.registerNewConnection(): Set Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count);
+ return true;
+ }
+ else if (count < Config.MAX_PLAYERS_FROM_ONE_PC)
+ {
+ count++;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.registerNewConnection(): Increase Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count);
+ return true;
+ }
+ else
+ {
+ count++;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.registerNewConnection(): Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") is " + count);
+ return false;
+ }
+
+ }
+
+ public synchronized void removeConnection(L2GameClient client)
+ {
+ if (client == null)
+ return;
+
+ IpPack pack = new IpPack(client.getAdress(), client.getTrace());
+ Integer count = map.get(pack);
+ if (count != null && count > 1)
+ {
+ count--;
+ map.put(pack, count);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.removeConnection(): Decrease Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count);
+
+ }
+ else
+ {
+ map.remove(pack);
+ if (Config.DEVELOPER)
+ _log.info("MultiBoxProtection.removeConnection(): Remove Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ")");
+ }
+ }
+
+ @SuppressWarnings("synthetic-access")
+ private static class SingletonHolder
+ {
+ protected static final MultiBoxProtection _instance = new MultiBoxProtection();
+ }
+
+ public final static class IpPack
+ {
+ String ip;
+ int[][] tracert;
+
+ public IpPack(String ip, int[][] tracert)
+ {
+ this.ip = ip;
+ this.tracert = tracert;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((ip == null) ? 0 : ip.hashCode());
+ if(tracert == null)
+ return result;
+ for (int[] array: tracert)
+ result = prime * result + Arrays.hashCode(array);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ IpPack other = (IpPack) obj;
+ if (ip == null)
+ {
+ if (other.ip != null)
+ return false;
+ }
+ else if (!ip.equals(other.ip))
+ return false;
+ for (int i = 0 ; i < tracert.length; i++)
+ for (int o = 0; o < tracert[0].length; o++)
+ if (tracert[i][o] != other.tracert[i][o])
+ return false;
+ return true;
+ }
+
+ }
+}
+
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -68,6 +68,7 @@
import com.l2jfrozen.gameserver.model.entity.siege.Siege;
import com.l2jfrozen.gameserver.model.quest.Quest;
import com.l2jfrozen.gameserver.model.quest.QuestState;
+import com.l2jfrozen.gameserver.network.MultiBoxProtection;
import com.l2jfrozen.gameserver.network.Disconnection;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.ClientSetTime;
@@ -121,7 +122,7 @@
@Override
protected void runImpl()
{
- L2PcInstance activeChar = getClient().getActiveChar();
+ final L2PcInstance activeChar = getClient().getActiveChar();

if (activeChar == null)
{
@@ -422,6 +422,23 @@
activeChar.sendMessage("I'm sorry, but multibox is not allowed here.");
activeChar.logout();
}
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0)
+ {
+ if (!MultiBoxProtection.getInstance().registerNewConnection(getClient()))
+ {
+ activeChar.sendMessage("Too many connections, please logout other characters first.");
+ if (Config.DEVELOPER)
+ _log.info("Too many conections, disconnecting " + activeChar.getName());
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ public void run()
+ {
+ activeChar.logout(false);
+ }
+ }, 400);
+ return;
+ }
+ }

Hellows(activeChar);

Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestart.java (working copy)
@@ -25,11 +25,14 @@
import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager;
import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.model.Inventory;
import com.l2jfrozen.gameserver.model.L2Party;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSignsFestival;
import com.l2jfrozen.gameserver.network.L2GameClient;
+import com.l2jfrozen.gameserver.network.MultiBoxProtection;
import com.l2jfrozen.gameserver.network.L2GameClient.GameClientState;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
@@ -177,7 +187,11 @@
}

L2GameClient client = getClient();
-
+
+ if (Config.MAX_PLAYERS_FROM_ONE_PC > 0)
+ {
+ MultiBoxProtection.getInstance().removeConnection(client);
+ }
// detach the client from the char so that the connection isnt closed in the deleteMe
player.setClient(null);

 In Frozej with com.l2jserver imports? LOL, never be run.

  • 0
Posted

good share but l2j have something a bit better just look into their configs to check

 

# ---------------------------------------------------------------------------

# Dualbox Check

# ---------------------------------------------------------------------------

 

# Maximum number of players per IP address allowed to enter game.

# Default: 0 (unlimited)

DualboxCheckMaxPlayersPerIP = 0

 

# Maximum number of players per IP address allowed to participate in olympiad.

# Default: 0 (unlimited)

DualboxCheckMaxOlympiadParticipantsPerIP = 0

 

# Maximum number of players per IP address allowed to participate in events using L2J Event Engine (//event).

# Default: 0 (unlimited)

DualboxCheckMaxL2EventParticipantsPerIP = 0

 

# Whitelist of the addresses for dualbox checks.

# Format: Address1,Number1;Address2,Number2...

# Network address can be number (127.0.0.1) or symbolic (localhost) formats.

# Additional connection number added to the global limits for this address.

# For example, if number of TvT event participants per IP address set to the 1 (no dualbox)

# and whitelist contains "l2jserver.com,2" then number of allowed participants from l2jserver.com

# will be 1+2=3. Use 0 or negative value for unlimited number of connections.

# Default: 127.0.0.1,0 (no limits from localhost)

DualboxCheckWhitelist = 127.0.0.1,0

 

Also please use language thanks :)

 

L2Jserver dualbox checker is PER IP! , and this code is PER PC.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Don't cry, it's a game. If it makes you cum on your monitor, of course, enjoy it. My business has been running for years and will continue to do so. No matter what happens here, the dogs bark, the caravan moves on. Start developing game engines - post them too - after all, I create them too) Salvation:Arena (MOBA) Unreal Engine RED-TEAM REVERSECODE Аліса займається розробкою ще з часів створення денді та сеги-діти які створюють шум для мене просто діти) За ці роки роботи я бачила багато різних людей у цій сфері все що я думаю про це не плачте та насолоджуйтесь життям слава ураїне - котись на свій бразильський форум)   If you'd simply asked me in a private message on the forum to be reinstated, you'd have been unblocked without a problem. I have no enemies—it's just business. I can make any product on the market, models and effects, copyrights—complex tools—at my age, people run large companies. I'm pleased that our beloved MXC* forum will now have a lot of free products. I earn a maximum of $200-$300 a year from this industry. If that excites you, well, have fun with us.       I moderate many gaming communities, here's one of them  if I hated you, you'd be out of here in a minute, brother  so don't get carried away with your wet dreams. On the topic of free work, start doing it yourself—the forum needs good free stuff. Someone will definitely like you here and throw a flower on your grave. Besides, you're forgetting that half the forum is involved in this interface development business and for many developers, it's a good income. So, you want to make life sweeter for them all, not just for me it's actually nice that you're such a noble young man.   Besides, I usually work from behind the scenes and don't move anywhere in the market but nothing stops me from doing what others do - working from the shadows  you won't even see that I'm doing it, it's so funny.   Start doing free work. You promised to do it well and post it to communities on time. Good luck! We'll have fun, that's great!🥰   завжди приємно поспілкуватися з веселими людьми              
    • Complete development packages for Lineage 2 UI development, across all chronicles and an automated tool to update and patch Interface.u & Interface.xdat What I Offer Clean Sources: 100% clean, retail-based interface source code with zero unwanted custom modifications. Interface.u Update Tool: A standalone tool designed to patch, rebuild, and update Interface.u efficiently. Custom Modifications: Custom UI features and tailoring can be implemented upon request. Turnaround Time: Most major versions and protocols are ready for immediate delivery; other versions take up to 1 week. How It Works Let me know the specific chronicle or protocol version you are targeting. I will provide the tool, which is HWID-bound to your machine, for your setup. Once satisfied with the results, we finalize the deal. Pricing & Notes Both products are priced separately based on the target protocol and requirements. Package deals are negotiable if purchasing both. DM for inquiries, demos, and pricing quotes.    
    • Well u need to change when sm1 press exit it keeps it in game..  
    • That’s just part of buying and selling; if your service didn't appeal to me at the time, there's no reason for me to force myself to buy it. After all, I regularly buy other interfaces and clients from other users mostly Russians using USDT. But *I'm* the child here, even though *you're* the incredibly arrogant one.   The payment method or the amounts were never the problem you were. But life goes on; you’d rather stay caught up in your delusions, thinking you’re the protagonist of some anime. Princess Alice 😂   I have all the interfaces for the 474/506/509/520/542/563/557. and olds too.  Some were created by me, including the ARENA P140 interface, which will soon be released for free. This includes everything you make available. It will no longer be a monopoly held by just a few people.   Including your clients with system. like  
    • NEW: Ryzen 9 9950X VPS now Available! Our most Powerful VPS plans now available with dedicated Zen 5 cores clocked up to 5.7 GHz, DDR5 ECC, blazing NVMe Gen4 storage (~7 GB/s), 10 Gbit/s uplink with up to 50 TB traffic, and premium Anti-DDoS included on every plan. No KYC, crypto payments accepted, deployed in minutes. ⭐ RYZEN 9 9950X VPS: [ 9.99 ] 2vCore | 6GB DDR5 | 30GB NVMe - DEPLOY [ 19.99 ] 4vCore | 12GB DDR5 | 50GB NVMe - DEPLOY [ 39.99 ] 8vCore | 24GB DDR5 | 80GB NVMe - DEPLOY [ 69.99 ] 12vCore | 48GB DDR5 | 120GB NVMe - DEPLOY - 10 Gbit/s Port included in ALL Plans - Premium Anti-DDoS included in ALL Plans - No-KYC signup, crypto payments accepted ✅ Ryzen 9 9950X VPS ( vpslab.cloud )
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..