From 7be20ca5c093ef135806dd27bbf4718fe13f6b15 Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Tue, 20 Aug 2019 10:45:48 +0000
Subject: [PATCH] Addition of separate IdFactoryType enum.
---
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/olympiad.cfg | 9 +
.../dist/game/config/protected/IdFactory.ini | 7 +-
.../java/org/l2jmobius/Config.java | 11 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 48 ++-
.../idfactory/CompactionIDFactory.java | 134 -------
.../gameserver/idfactory/IdFactory.java | 58 +--
.../gameserver/idfactory/StackIDFactory.java | 40 +-
.../gameserver/util/PrimeFinder.java | 353 ++++++++++++++++++
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
.../dist/game/config/IdFactory.ini | 9 +-
.../java/org/l2jmobius/Config.java | 9 +-
.../gameserver/enums/IdFactoryType.java | 26 ++
.../gameserver/idfactory/BitSetIDFactory.java | 6 -
.../gameserver/idfactory/IdFactory.java | 4 +-
.../gameserver/idfactory/StackIDFactory.java | 2 -
93 files changed, 924 insertions(+), 546 deletions(-)
create mode 100644 L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_C6_Interlude/dist/game/config/olympiad.cfg
create mode 100644 L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
delete mode 100644 L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/CompactionIDFactory.java
create mode 100644 L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/PrimeFinder.java
create mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/config/IdFactory.ini b/L2J_Mobius_1.0_Ertheia/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java
index bc73a0d0f1..c0a0760889 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -791,12 +792,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1827,7 +1822,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_2.5_Underground/dist/game/config/IdFactory.ini b/L2J_Mobius_2.5_Underground/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_2.5_Underground/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java
index a64ba41821..bc7cb47a00 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -798,12 +799,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1843,7 +1838,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/IdFactory.ini b/L2J_Mobius_3.0_Helios/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_3.0_Helios/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java
index 24de21b8e8..bcd6c4b837 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -799,12 +800,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1851,7 +1846,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/IdFactory.ini b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java
index b7ef4ac3d2..f876ab8695 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -786,12 +787,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1831,7 +1826,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/config/IdFactory.ini b/L2J_Mobius_5.0_Salvation/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_5.0_Salvation/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_5.0_Salvation/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java
index 00e5291cb8..a9dfdc4869 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -782,12 +783,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1907,7 +1902,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/config/IdFactory.ini b/L2J_Mobius_5.5_EtinasFate/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_5.5_EtinasFate/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java
index 00e5291cb8..a9dfdc4869 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -782,12 +783,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1907,7 +1902,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/config/IdFactory.ini b/L2J_Mobius_6.0_Fafurion/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_6.0_Fafurion/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java
index cc78124fa1..3f2bc24a2b 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -783,12 +784,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1937,7 +1932,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/olympiad.cfg b/L2J_Mobius_C6_Interlude/dist/game/config/olympiad.cfg
new file mode 100644
index 0000000000..a1e02ab4d1
--- /dev/null
+++ b/L2J_Mobius_C6_Interlude/dist/game/config/olympiad.cfg
@@ -0,0 +1,9 @@
+#Olympiad Properties
+#Tue Aug 20 13:40:12 EEST 2019
+NextWeeklyChange_DateFormat=27 \u0391\u03C5\u03B3 2019, 1\:35\:34 \u03BC.\u03BC.
+ValdationEnd=0
+NextWeeklyChange=1566902134230
+Period=0
+CurrentCycle=1
+OlympiadEnd=1567328400230
+OlympiadEnd_DateFormat=1 \u03A3\u03B5\u03C0 2019, 12\:00\:00 \u03BC.\u03BC.
diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/protected/IdFactory.ini b/L2J_Mobius_C6_Interlude/dist/game/config/protected/IdFactory.ini
index 255c9e5d5b..795d94cac9 100644
--- a/L2J_Mobius_C6_Interlude/dist/game/config/protected/IdFactory.ini
+++ b/L2J_Mobius_C6_Interlude/dist/game/config/protected/IdFactory.ini
@@ -1,9 +1,8 @@
# Tell server which IDFactory Class to use
# Options are:
-# Compaction (Original method),
-# BitSet (One non compaction method - default),
-# Stack (Another non compaction method)
-IDFactory = BitSet
+# BITSET (One non compaction method - default),
+# STACK (Another non compaction method)
+IDFactory = BITSET
# Check for bad ids in the database on server boot up
# Much faster load time without it, but may cause problems
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java
index 21bdf0b916..9f70752f46 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java
@@ -39,6 +39,7 @@ import java.util.logging.Logger;
import org.l2jmobius.commons.util.ClassMasterSettings;
import org.l2jmobius.commons.util.L2Properties;
import org.l2jmobius.commons.util.StringUtil;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.model.entity.olympiad.OlympiadPeriod;
import org.l2jmobius.gameserver.util.FloodProtectorConfig;
import org.l2jmobius.loginserver.LoginController;
@@ -1310,7 +1311,7 @@ public class Config
idSettings.load(is);
is.close();
- IDFACTORY_TYPE = IdFactoryType.valueOf(idSettings.getProperty("IDFactory", "Compaction"));
+ IDFACTORY_TYPE = IdFactoryType.valueOf(idSettings.getProperty("IDFactory", "BITSET"));
BAD_ID_CHECKING = Boolean.valueOf(idSettings.getProperty("BadIdChecking", "true"));
}
catch (Exception e)
@@ -3706,14 +3707,6 @@ public class Config
}
}
- /** Enumeration for type of ID Factory */
- public enum IdFactoryType
- {
- Compaction,
- BitSet,
- Stack
- }
-
public static void saveHexid(int serverId, String string)
{
saveHexid(serverId, string, HEXID_FILE);
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index e851ffc23c..82c78c3e1b 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -18,32 +18,31 @@ package org.l2jmobius.gameserver.idfactory;
import java.util.BitSet;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Logger;
import org.l2jmobius.commons.concurrent.ThreadPool;
-import org.l2jmobius.commons.util.PrimeFinder;
+import org.l2jmobius.gameserver.util.PrimeFinder;
/**
* This class ..
- * @author Olympic
* @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
*/
public class BitSetIDFactory extends IdFactory
{
- private static Logger LOGGER = Logger.getLogger(BitSetIDFactory.class.getName());
-
private BitSet _freeIds;
private AtomicInteger _freeIdCount;
private AtomicInteger _nextFreeId;
- public class BitSetCapacityCheck implements Runnable
+ protected class BitSetCapacityCheck implements Runnable
{
@Override
public void run()
{
- if (reachingBitSetCapacity())
+ synchronized (BitSetIDFactory.this)
{
- increaseBitSetCapacity();
+ if (reachingBitSetCapacity())
+ {
+ increaseBitSetCapacity();
+ }
}
}
}
@@ -51,12 +50,16 @@ public class BitSetIDFactory extends IdFactory
protected BitSetIDFactory()
{
super();
- ThreadPool.scheduleAtFixedRate(new BitSetCapacityCheck(), 30000, 30000);
- initialize();
- LOGGER.info("IDFactory: " + _freeIds.size() + " id's available.");
+
+ synchronized (BitSetIDFactory.class)
+ {
+ ThreadPool.scheduleAtFixedRate(new BitSetCapacityCheck(), 30000, 30000);
+ initialize();
+ }
+ LOGGER.info(getClass().getSimpleName() + ": " + _freeIds.size() + " id's available.");
}
- public synchronized void initialize()
+ public void initialize()
{
try
{
@@ -69,6 +72,7 @@ public class BitSetIDFactory extends IdFactory
final int objectID = usedObjectId - FIRST_OID;
if (objectID < 0)
{
+ LOGGER.warning(getClass().getSimpleName() + ": Object ID " + usedObjectId + " in DB is less than minimum ID of " + FIRST_OID);
continue;
}
_freeIds.set(usedObjectId - FIRST_OID);
@@ -81,8 +85,7 @@ public class BitSetIDFactory extends IdFactory
catch (Exception e)
{
_initialized = false;
- LOGGER.warning("BitSet ID Factory could not be initialized correctly " + e);
- e.printStackTrace();
+ LOGGER.severe(getClass().getSimpleName() + ": Could not be initialized properly: " + e.getMessage());
}
}
@@ -96,7 +99,7 @@ public class BitSetIDFactory extends IdFactory
}
else
{
- LOGGER.warning("BitSet ID Factory: release objectID " + objectID + " failed (< " + FIRST_OID + ")");
+ LOGGER.warning(getClass().getSimpleName() + ": Release objectID " + objectID + " failed (< " + FIRST_OID + ")");
}
}
@@ -107,22 +110,15 @@ public class BitSetIDFactory extends IdFactory
_freeIds.set(newID);
_freeIdCount.decrementAndGet();
- int nextFree = _freeIds.nextClearBit(newID);
+ final int nextFree = _freeIds.nextClearBit(newID) < 0 ? _freeIds.nextClearBit(0) : _freeIds.nextClearBit(newID);
if (nextFree < 0)
{
- nextFree = _freeIds.nextClearBit(0);
- }
- if (nextFree < 0)
- {
- if (_freeIds.size() < FREE_OBJECT_ID_SIZE)
- {
- increaseBitSetCapacity();
- }
- else
+ if (_freeIds.size() >= FREE_OBJECT_ID_SIZE)
{
throw new NullPointerException("Ran out of valid Id's.");
}
+ increaseBitSetCapacity();
}
_nextFreeId.set(nextFree);
@@ -138,7 +134,7 @@ public class BitSetIDFactory extends IdFactory
protected synchronized int usedIdCount()
{
- return (_freeIdCount.get() - FIRST_OID);
+ return _freeIdCount.get() - FIRST_OID;
}
protected synchronized boolean reachingBitSetCapacity()
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/CompactionIDFactory.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/CompactionIDFactory.java
deleted file mode 100644
index 6710e560e7..0000000000
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/CompactionIDFactory.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * 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 .
- */
-package org.l2jmobius.gameserver.idfactory;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.logging.Logger;
-
-import org.l2jmobius.Config;
-import org.l2jmobius.commons.database.DatabaseFactory;
-
-/**
- * @author Olympic
- * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
- */
-public class CompactionIDFactory extends IdFactory
-{
- private static Logger LOGGER = Logger.getLogger(CompactionIDFactory.class.getName());
- private int _curOID;
- private final int _freeSize;
-
- protected CompactionIDFactory()
- {
- super();
- _curOID = FIRST_OID;
- _freeSize = 0;
-
- try (Connection con = DatabaseFactory.getConnection())
- {
- final int[] tmp_obj_ids = extractUsedObjectIDTable();
-
- int N = tmp_obj_ids.length;
- for (int idx = 0; idx < N; idx++)
- {
- N = insertUntil(tmp_obj_ids, idx, N, con);
- }
- _curOID++;
- LOGGER.info("IdFactory: Next usable Object ID is: " + _curOID);
- _initialized = true;
- }
- catch (Exception e1)
- {
- LOGGER.warning("ID Factory could not be initialized correctly " + e1);
- }
- }
-
- private int insertUntil(int[] tmp_obj_ids, int idx, int N, Connection con) throws SQLException
- {
- int id = tmp_obj_ids[idx];
- if (id == _curOID)
- {
- _curOID++;
- return N;
- }
- // check these IDs not present in DB
- if (Config.BAD_ID_CHECKING)
- {
- for (String check : ID_CHECKS)
- {
- final PreparedStatement ps = con.prepareStatement(check);
- ps.setInt(1, _curOID);
- ps.setInt(2, id);
- final ResultSet rs = ps.executeQuery();
- while (rs.next())
- {
- final int badId = rs.getInt(1);
- LOGGER.warning("Bad ID " + badId + " in DB found by: " + check);
- throw new RuntimeException();
- }
- rs.close();
- ps.close();
- }
- }
-
- int hole = id - _curOID;
- if (hole > (N - idx))
- {
- hole = N - idx;
- }
- for (int i = 1; i <= hole; i++)
- {
- id = tmp_obj_ids[N - i];
- LOGGER.info("Compacting DB object ID=" + id + " into " + (_curOID));
- for (String update : ID_UPDATES)
- {
- final PreparedStatement ps = con.prepareStatement(update);
- ps.setInt(1, _curOID);
- ps.setInt(2, id);
- ps.execute();
- ps.close();
- }
- _curOID++;
- }
- if (hole < (N - idx))
- {
- _curOID++;
- }
- return N - hole;
- }
-
- @Override
- public synchronized int getNextId()
- {
- return _curOID++;
- }
-
- @Override
- public synchronized void releaseId(int id)
- {
- // dont release ids until we are sure it isnt messing up
- }
-
- @Override
- public int size()
- {
- return (_freeSize + LAST_OID) - FIRST_OID;
- }
-}
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index 1faece2327..64da2cae2f 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -20,47 +20,18 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.logging.Level;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.commons.database.DatabaseFactory;
/**
- * @author Olympic
* @version $Revision: 1.3.2.1.2.7 $ $Date: 2005/04/11 10:06:12 $
*/
public abstract class IdFactory
{
- private static Logger LOGGER = Logger.getLogger(IdFactory.class.getName());
-
- protected static final String[] ID_UPDATES =
- {
- "UPDATE items SET owner_id = ? WHERE owner_id = ?",
- "UPDATE items SET object_id = ? WHERE object_id = ?",
- "UPDATE character_quests SET char_id = ? WHERE char_id = ?",
- "UPDATE character_friends SET char_id = ? WHERE char_id = ?",
- "UPDATE character_friends SET friend_id = ? WHERE friend_id = ?",
- "UPDATE character_hennas SET char_obj_id = ? WHERE char_obj_id = ?",
- "UPDATE character_recipebook SET char_id = ? WHERE char_id = ?",
- "UPDATE character_shortcuts SET char_obj_id = ? WHERE char_obj_id = ?",
- "UPDATE character_shortcuts SET shortcut_id = ? WHERE shortcut_id = ? AND type = 1", // items
- "UPDATE character_macroses SET char_obj_id = ? WHERE char_obj_id = ?",
- "UPDATE character_skills SET char_obj_id = ? WHERE char_obj_id = ?",
- "UPDATE character_skills_save SET char_obj_id = ? WHERE char_obj_id = ?",
- "UPDATE character_subclasses SET char_obj_id = ? WHERE char_obj_id = ?",
- "UPDATE characters SET obj_Id = ? WHERE obj_Id = ?",
- "UPDATE characters SET clanid = ? WHERE clanid = ?",
- "UPDATE clan_data SET clan_id = ? WHERE clan_id = ?",
- "UPDATE siege_clans SET clan_id = ? WHERE clan_id = ?",
- "UPDATE clan_data SET ally_id = ? WHERE ally_id = ?",
- "UPDATE clan_data SET leader_id = ? WHERE leader_id = ?",
- "UPDATE pets SET item_obj_id = ? WHERE item_obj_id = ?",
- "UPDATE character_hennas SET char_obj_id = ? WHERE char_obj_id = ?",
- "UPDATE itemsonground SET object_id = ? WHERE object_id = ?",
- "UPDATE auction_bid SET bidderId = ? WHERE bidderId = ?",
- "UPDATE auction_watch SET charObjId = ? WHERE charObjId = ?",
- "UPDATE clanhall SET ownerId = ? WHERE ownerId = ?"
- };
+ protected final Logger LOGGER = Logger.getLogger(getClass().getName());
protected static final String[] ID_CHECKS =
{
@@ -92,7 +63,7 @@ public abstract class IdFactory
public static final int LAST_OID = 0x7FFFFFFF;
public static final int FREE_OBJECT_ID_SIZE = LAST_OID - FIRST_OID;
- protected static IdFactory _instance = null;
+ protected static final IdFactory _instance;
protected IdFactory()
{
@@ -104,21 +75,21 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case Compaction:
- {
- _instance = new CompactionIDFactory();
- break;
- }
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
}
+ default:
+ {
+ _instance = null;
+ break;
+ }
}
}
@@ -127,16 +98,15 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getConnection())
+ try (Connection con = DatabaseFactory.getConnection();
+ Statement s = con.createStatement())
{
- final Statement s2 = con.createStatement();
- s2.executeUpdate("update characters set online=0");
+ s.executeUpdate("UPDATE characters SET online = 0");
LOGGER.info("Updated characters online status.");
-
- s2.close();
}
catch (SQLException e)
{
+ LOGGER.log(Level.WARNING, "Could not update characters online status: " + e.getMessage(), e);
}
}
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 6e97be7820..f2ece465c6 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -21,19 +21,15 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Stack;
-import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.commons.database.DatabaseFactory;
/**
- * @author Olympic
* @version $Revision: 1.3.2.1.2.7 $ $Date: 2005/04/11 10:06:12 $
*/
public class StackIDFactory extends IdFactory
{
- private static Logger LOGGER = Logger.getLogger(IdFactory.class.getName());
-
private int _curOID;
private int _tempOID;
@@ -47,6 +43,8 @@ public class StackIDFactory extends IdFactory
try (Connection con = DatabaseFactory.getConnection())
{
+ // con.createStatement().execute("drop table if exists tmp_obj_id");
+
final int[] tmp_obj_ids = extractUsedObjectIDTable();
if (tmp_obj_ids.length > 0)
{
@@ -64,9 +62,9 @@ public class StackIDFactory extends IdFactory
LOGGER.info("IdFactory: Next usable Object ID is: " + _curOID);
_initialized = true;
}
- catch (Exception e1)
+ catch (Exception e)
{
- LOGGER.warning("ID Factory could not be initialized correctly " + e1);
+ LOGGER.severe(getClass().getSimpleName() + ": Could not be initialized properly:" + e.getMessage());
}
}
@@ -83,26 +81,26 @@ public class StackIDFactory extends IdFactory
{
for (String check : ID_CHECKS)
{
- final PreparedStatement ps = con.prepareStatement(check);
- ps.setInt(1, _tempOID);
- ps.setInt(2, id);
- final ResultSet rs = ps.executeQuery();
- while (rs.next())
+ try (PreparedStatement ps = con.prepareStatement(check))
{
- final int badId = rs.getInt(1);
- LOGGER.warning("Bad ID " + badId + " in DB found by: " + check);
- throw new RuntimeException();
+ ps.setInt(1, _tempOID);
+ // ps.setInt(1, _curOID);
+ ps.setInt(2, id);
+ try (ResultSet rs = ps.executeQuery())
+ {
+ if (rs.next())
+ {
+ final int badId = rs.getInt(1);
+ LOGGER.severe("Bad ID " + badId + " in DB found by: " + check);
+ throw new RuntimeException();
+ }
+ }
}
- rs.close();
- ps.close();
}
}
- int hole = id - _tempOID;
- if (hole > (N - idx))
- {
- hole = N - idx;
- }
+ // int hole = id - _curOID;
+ final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
_freeOIDStack.push(_tempOID);
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/PrimeFinder.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/PrimeFinder.java
new file mode 100644
index 0000000000..dd544762bc
--- /dev/null
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/PrimeFinder.java
@@ -0,0 +1,353 @@
+/*
+ * Copyright (c) 1999 CERN - European Organization for Nuclear Research.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation. CERN makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without expressed or implied warranty.
+ */
+package org.l2jmobius.gameserver.util;
+
+import java.util.Arrays;
+
+/**
+ * Modified for Trove to use the java.util.Arrays sort/search
+ * algorithms instead of those provided with colt.
+ * Used to keep hash table capacities prime numbers.
+ * Not of interest for users; only for implementors of hashtables.
+ *
+ * Choosing prime numbers as hash table capacities is a good idea
+ * to keep them working fast, particularly under hash table expansions.
+ *
+ * However, JDK 1.2, JGL 3.1 and many other toolkits do nothing to keep capacities prime.
+ * This class provides efficient means to choose prime capacities.
+ *
+ * Choosing a prime is O(log 300) (binary search in a list of 300 ints).
+ * Memory requirements: 1 KB static memory.
+ * @author wolfgang.hoschek@cern.ch
+ * @version 1.0, 09/24/99
+ */
+public class PrimeFinder
+{
+ /**
+ * The largest prime this class can generate; currently equal to Integer.MAX_VALUE.
+ */
+ public static final int LARGEST_PRIME = Integer.MAX_VALUE; // yes, it is prime.
+
+ /**
+ * The prime number list consists of 11 chunks.
+ * Each chunk contains prime numbers.
+ * A chunk starts with a prime P1.
+ * The next element is a prime P2.
+ * P2 is the smallest prime for which holds: P2 >= 2*P1.
+ * The next element is P3, for which the same holds with respect to P2, and so on. Chunks are chosen such that for any desired capacity >= 1000
+ * the list includes a prime number <= desired capacity * 1.11.
+ * Therefore, primes can be retrieved which are quite close to any
+ * desired capacity, which in turn avoids wasting memory.
+ * For example, the list includes
+ * 1039,1117,1201,1277,1361,1439,1523,1597,1759,1907,2081.
+ * So if you need a prime >= 1040, you will find a prime <= 1040*1.11=1154.
Chunks are chosen such that they are optimized for a hashtable growthfactor of 2.0;
+ * If your hashtable has such a growthfactor then, after initially
+ * "rounding to a prime" upon hashtable construction, it will
+ * later expand to prime capacities such that there exist no better primes.
+ * In total these are about 32*10=320 numbers -> 1 KB of static memory needed.
+ * If you are stingy, then delete every second or fourth chunk.
+ */
+
+ private static final int[] PRIME_CAPACITIES =
+ {
+ // chunk #0
+ LARGEST_PRIME,
+
+ // chunk #1
+ 5,
+ 11,
+ 23,
+ 47,
+ 97,
+ 197,
+ 397,
+ 797,
+ 1597,
+ 3203,
+ 6421,
+ 12853,
+ 25717,
+ 51437,
+ 102877,
+ 205759,
+ 411527,
+ 823117,
+ 1646237,
+ 3292489,
+ 6584983,
+ 13169977,
+ 26339969,
+ 52679969,
+ 105359939,
+ 210719881,
+ 421439783,
+ 842879579,
+ 1685759167,
+
+ // chunk #2
+ 433,
+ 877,
+ 1759,
+ 3527,
+ 7057,
+ 14143,
+ 28289,
+ 56591,
+ 113189,
+ 226379,
+ 452759,
+ 905551,
+ 1811107,
+ 3622219,
+ 7244441,
+ 14488931,
+ 28977863,
+ 57955739,
+ 115911563,
+ 231823147,
+ 463646329,
+ 927292699,
+ 1854585413,
+
+ // chunk #3
+ 953,
+ 1907,
+ 3821,
+ 7643,
+ 15287,
+ 30577,
+ 61169,
+ 122347,
+ 244703,
+ 489407,
+ 978821,
+ 1957651,
+ 3915341,
+ 7830701,
+ 15661423,
+ 31322867,
+ 62645741,
+ 125291483,
+ 250582987,
+ 501165979,
+ 1002331963,
+ 2004663929,
+
+ // chunk #4
+ 1039,
+ 2081,
+ 4177,
+ 8363,
+ 16729,
+ 33461,
+ 66923,
+ 133853,
+ 267713,
+ 535481,
+ 1070981,
+ 2141977,
+ 4283963,
+ 8567929,
+ 17135863,
+ 34271747,
+ 68543509,
+ 137087021,
+ 274174111,
+ 548348231,
+ 1096696463,
+
+ // chunk #5
+ 31,
+ 67,
+ 137,
+ 277,
+ 557,
+ 1117,
+ 2237,
+ 4481,
+ 8963,
+ 17929,
+ 35863,
+ 71741,
+ 143483,
+ 286973,
+ 573953,
+ 1147921,
+ 2295859,
+ 4591721,
+ 9183457,
+ 18366923,
+ 36733847,
+ 73467739,
+ 146935499,
+ 293871013,
+ 587742049,
+ 1175484103,
+
+ // chunk #6
+ 599,
+ 1201,
+ 2411,
+ 4831,
+ 9677,
+ 19373,
+ 38747,
+ 77509,
+ 155027,
+ 310081,
+ 620171,
+ 1240361,
+ 2480729,
+ 4961459,
+ 9922933,
+ 19845871,
+ 39691759,
+ 79383533,
+ 158767069,
+ 317534141,
+ 635068283,
+ 1270136683,
+
+ // chunk #7
+ 311,
+ 631,
+ 1277,
+ 2557,
+ 5119,
+ 10243,
+ 20507,
+ 41017,
+ 82037,
+ 164089,
+ 328213,
+ 656429,
+ 1312867,
+ 2625761,
+ 5251529,
+ 10503061,
+ 21006137,
+ 42012281,
+ 84024581,
+ 168049163,
+ 336098327,
+ 672196673,
+ 1344393353,
+
+ // chunk #8
+ 3,
+ 7,
+ 17,
+ 37,
+ 79,
+ 163,
+ 331,
+ 673,
+ 1361,
+ 2729,
+ 5471,
+ 10949,
+ 21911,
+ 43853,
+ 87719,
+ 175447,
+ 350899,
+ 701819,
+ 1403641,
+ 2807303,
+ 5614657,
+ 11229331,
+ 22458671,
+ 44917381,
+ 89834777,
+ 179669557,
+ 359339171,
+ 718678369,
+ 1437356741,
+
+ // chunk #9
+ 43,
+ 89,
+ 179,
+ 359,
+ 719,
+ 1439,
+ 2879,
+ 5779,
+ 11579,
+ 23159,
+ 46327,
+ 92657,
+ 185323,
+ 370661,
+ 741337,
+ 1482707,
+ 2965421,
+ 5930887,
+ 11861791,
+ 23723597,
+ 47447201,
+ 94894427,
+ 189788857,
+ 379577741,
+ 759155483,
+ 1518310967,
+
+ // chunk #10
+ 379,
+ 761,
+ 1523,
+ 3049,
+ 6101,
+ 12203,
+ 24407,
+ 48817,
+ 97649,
+ 195311,
+ 390647,
+ 781301,
+ 1562611,
+ 3125257,
+ 6250537,
+ 12501169,
+ 25002389,
+ 50004791,
+ 100009607,
+ 200019221,
+ 400038451,
+ 800076929,
+ 1600153859
+ };
+ static
+ { // initializer
+ // The above prime numbers are formatted for human readability.
+ // To find numbers fast, we sort them once and for all.
+
+ Arrays.sort(PRIME_CAPACITIES);
+ }
+
+ /**
+ * Returns a prime number which is >= desiredCapacity
and very close to desiredCapacity
(within 11% if desiredCapacity >= 1000
).
+ * @param desiredCapacity the capacity desired by the user.
+ * @return the capacity which should be used for a hashtable.
+ */
+ public static int nextPrime(int desiredCapacity)
+ {
+ int i = Arrays.binarySearch(PRIME_CAPACITIES, desiredCapacity);
+ if (i < 0)
+ {
+ // desired capacity not found, choose next prime greater
+ // than desired capacity
+ i = -i - 1; // remember the semantics of binarySearch...
+ }
+ return PRIME_CAPACITIES[i];
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/IdFactory.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
index 31e1b243f2..7fe04cd579 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
@@ -57,6 +57,7 @@ import org.w3c.dom.Node;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
@@ -926,12 +927,6 @@ public class Config
public static int PVP_NORMAL_TIME;
public static int PVP_PVP_TIME;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1994,7 +1989,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index c1024f0504..031c9a05ac 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index 67bfa5cd22..9dd52a1a82 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -109,12 +109,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 8cf7775901..132c69ad54 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/IdFactory.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java
index 99a5d03cac..d88e7d8d6e 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -778,12 +779,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1750,7 +1745,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/IdFactory.ini b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java
index 6bb46e49eb..a5611b626b 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -778,12 +779,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1754,7 +1749,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/IdFactory.ini b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java
index 6bb46e49eb..a5611b626b 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -778,12 +779,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1754,7 +1749,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/IdFactory.ini b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java
index 6bb46e49eb..a5611b626b 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -778,12 +779,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1754,7 +1749,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/IdFactory.ini b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java
index 6bb46e49eb..a5611b626b 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -778,12 +779,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1754,7 +1749,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/IdFactory.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/IdFactory.ini
index b3d0922c85..d668cf9be2 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/IdFactory.ini
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/IdFactory.ini
@@ -9,11 +9,10 @@
# ---------------------------------------------------------------------------
# Tell server which IDFactory Class to use:
-# Compaction = Original method
-# BitSet = One non compaction method
-# Stack = Another non compaction method
-# Default: BitSet
-IDFactory = BitSet
+# BITSET = One non compaction method
+# STACK = Another non compaction method
+# Default: BITSET
+IDFactory = BITSET
# Check for bad ids in the database on server boot up.
# Much faster load time without it, but may cause problems.
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java
index 6bb46e49eb..a5611b626b 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java
@@ -59,6 +59,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
+import org.l2jmobius.gameserver.enums.IdFactoryType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.base.ClassId;
@@ -778,12 +779,6 @@ public class Config
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
- public enum IdFactoryType
- {
- BitSet,
- Stack
- }
-
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1754,7 +1749,7 @@ public class Config
// Load IdFactory config file (if exists)
final PropertiesParser IdFactory = new PropertiesParser(IDFACTORY_CONFIG_FILE);
- IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BitSet);
+ IDFACTORY_TYPE = IdFactory.getEnum("IDFactory", IdFactoryType.class, IdFactoryType.BITSET);
BAD_ID_CHECKING = IdFactory.getBoolean("BadIdChecking", true);
// Load General config file (if exists)
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/IdFactoryType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
new file mode 100644
index 0000000000..8866c573a1
--- /dev/null
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/IdFactoryType.java
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum IdFactoryType
+{
+ BITSET,
+ STACK
+}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
index 0f7e83b4d1..82c78c3e1b 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/BitSetIDFactory.java
@@ -132,17 +132,11 @@ public class BitSetIDFactory extends IdFactory
return _freeIdCount.get();
}
- /**
- * @return
- */
protected synchronized int usedIdCount()
{
return _freeIdCount.get() - FIRST_OID;
}
- /**
- * @return
- */
protected synchronized boolean reachingBitSetCapacity()
{
return PrimeFinder.nextPrime((usedIdCount() * 11) / 10) > _freeIds.size();
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
index cd24d8a691..c287c7e8b3 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -104,12 +104,12 @@ public abstract class IdFactory
{
switch (Config.IDFACTORY_TYPE)
{
- case BitSet:
+ case BITSET:
{
_instance = new BitSetIDFactory();
break;
}
- case Stack:
+ case STACK:
{
_instance = new StackIDFactory();
break;
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 146a923fdd..2e97e577dc 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -103,10 +103,8 @@ public class StackIDFactory extends IdFactory
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
- // log.info("Free ID added " + (_tempOID));
_freeOIDStack.push(_tempOID);
_tempOID++;
- // _curOID++;
}
if (hole < (N - idx))
{