From 7e026c43093112e7a2267bf0a4a20201420a3e69 Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Sun, 13 Sep 2020 08:32:43 +0000
Subject: [PATCH] AntiFeedManager checks for TvT. Contributed by Trance.
---
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
.../scripts/custom/events/TeamVsTeam/TvT.java | 30 ++++++++++++++---
.../events/TeamVsTeam/registration-ip.html | 33 +++++++++++++++++++
30 files changed, 870 insertions(+), 75 deletions(-)
create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
create mode 100644 L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index d56140bc53..86a40c2761 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -139,11 +141,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -153,6 +162,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -819,6 +833,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+
TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index d56140bc53..86a40c2761 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -139,11 +141,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -153,6 +162,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -819,6 +833,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index d56140bc53..86a40c2761 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -139,11 +141,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -153,6 +162,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -819,6 +833,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index d56140bc53..86a40c2761 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -139,11 +141,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -153,6 +162,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -819,6 +833,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 443aa4ff15..3dda4bb24d 100644
--- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -137,11 +139,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -151,6 +160,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -817,6 +831,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 443aa4ff15..3dda4bb24d 100644
--- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -137,11 +139,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -151,6 +160,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -817,6 +831,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 443aa4ff15..3dda4bb24d 100644
--- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -137,11 +139,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -151,6 +160,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -817,6 +831,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 443aa4ff15..3dda4bb24d 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -137,11 +139,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -151,6 +160,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -817,6 +831,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 66c0975700..d1da901d24 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -143,11 +145,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -157,6 +166,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -821,6 +835,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 66c0975700..d1da901d24 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -143,11 +145,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -157,6 +166,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -821,6 +835,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 66c0975700..d1da901d24 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -143,11 +145,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -157,6 +166,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -821,6 +835,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 66c0975700..d1da901d24 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -143,11 +145,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -157,6 +166,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -821,6 +835,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 66c0975700..d1da901d24 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -143,11 +145,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -157,6 +166,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -821,6 +835,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 66c0975700..d1da901d24 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -143,11 +145,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -157,6 +166,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -821,6 +835,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
index 66c0975700..d1da901d24 100644
--- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.Team;
+import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.CommandChannel;
@@ -143,11 +145,18 @@ public class TvT extends Event
{
if (canRegister(player))
{
- PLAYER_LIST.add(player);
- PLAYER_SCORES.put(player, 0);
- player.setOnCustomEvent(true);
- addLogoutListener(player);
- htmltext = "registration-success.html";
+ if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
+ {
+ PLAYER_LIST.add(player);
+ PLAYER_SCORES.put(player, 0);
+ player.setOnCustomEvent(true);
+ addLogoutListener(player);
+ htmltext = "registration-success.html";
+ }
+ else
+ {
+ htmltext = "registration-ip.html";
+ }
}
else
{
@@ -157,6 +166,11 @@ public class TvT extends Event
}
case "CancelParticipation":
{
+ // Remove the player from the IP count
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player);
+ }
PLAYER_LIST.remove(player);
PLAYER_SCORES.remove(player);
removeListeners(player);
@@ -821,6 +835,12 @@ public class TvT extends Event
timer.cancel();
}
}
+ // Register the event at AntiFeedManager and clean it for just in case if the event is already registered
+ if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0)
+ {
+ AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
+ AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
+ }
// Clear player lists.
PLAYER_LIST.clear();
PLAYER_SCORES.clear();
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
new file mode 100644
index 0000000000..3495e44c3e
--- /dev/null
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
@@ -0,0 +1,33 @@
+
+ TvT Event
+
+
+
+
+
+
+
+ |
+
+
+
+ Team vs Team
+
+ |
+
+
+
+
+
+ Too many registrations. |
+
+
+
+
+
+ |
+
+
+
+
+