> {
- /**
- * @return the object ID
- */
- T getID();
-
- /**
- * Please note that the ID can only be set one time. Once it has been set,
- * it cannot be changed and a {@link IllegalStateException} will be thrown
- * if trying to change the ID.
- *
- * @param ID
- * the object ID to set
- * @throws IllegalStateException
- * if the ID was already set
- */
- void setID(T ID) throws IllegalStateException;
-
- /**
- * Each object has an desire. Desires express what the
- * {@link DatabaseService} should do with the object. The service
- * automatically keep tracks of every database object (and release them when
- * they are garbage collected).
- *
- * @return the database object desire
- */
- ObjectDesire getObjectDesire();
-
- /**
- * Each object has an desire. Desires express what the
- * {@link DatabaseService} should do with the object. The service
- * automatically keep tracks of every database object (and release them when
- * they are garbage collected).
- *
- * @param desire
- * the database object desire to set
- */
- void setObjectDesire(ObjectDesire desire);
-
- /**
- * Indicated what the object wants to do in the database. It indicates
- * whether the object should be inserted, updated or deleted from the
- * database.
- *
- * @author Rogiel
- */
- public enum ObjectDesire {
- /**
- * Don't do anything
- */
- NONE,
- /**
- * Insert a new object into database.
- *
- * If the primary key is auto generated by the database a clone of this
- * object will be created.
- * If the primary key is not auto generated by the database, an
- * database exception will occur.
- */
- INSERT,
- /**
- * Updates the object in the database.
- *
- * If the object is not in the database nothing will happen.
- */
- UPDATE,
- /**
- * Deletes the object from the database.
- *
- * If tge object is not in the database nothing will happen.
- */
- DELETE;
- }
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/AbstractModelID.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/AbstractModelID.java
deleted file mode 100644
index 5767b7151..000000000
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/AbstractModelID.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * l2jserver2 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.
- *
- * l2jserver2 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 l2jserver2. If not, see .
- */
-package com.l2jserver.model.id;
-
-import com.l2jserver.model.Model;
-
-/**
- * This is an abstract ID for most model objects that do not extend
- * {@link ObjectID}.
- *
- * @param
- * the raw id type
- * @param
- * the model this {@link ID} provides
- *
- * @author Rogiel
- */
-public abstract class AbstractModelID>>
- extends ID {
- /**
- * @param id
- * the id
- */
- protected AbstractModelID(T id) {
- super(id);
- }
-
- /**
- * @return the {@link Model} object associated with this
- * {@link AbstractModelID}. null if {@link Model} does not
- * exists.
- */
- public abstract O getObject();
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/ID.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/ID.java
deleted file mode 100644
index b9ecf2a92..000000000
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/ID.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * l2jserver2 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.
- *
- * l2jserver2 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 l2jserver2. If not, see .
- */
-package com.l2jserver.model.id;
-
-import com.google.inject.Inject;
-
-/**
- * The ID interface. Each object must be represented by an unique ID.
- *
- * @param
- * the raw id type
- *
- * @author Rogiel
- */
-public abstract class ID {
- /**
- * The id itself
- */
- protected final T id;
-
- /**
- * @param id
- * the raw id
- */
- @Inject
- protected ID(T id) {
- this.id = id;
- }
-
- /**
- * @return the id
- */
- public T getID() {
- return id;
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName() + " [id=" + id + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + id.hashCode() + this.getClass().hashCode();
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- @SuppressWarnings("rawtypes")
- ID other = (ID) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/compound/AbstractCompoundID.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/compound/AbstractCompoundID.java
deleted file mode 100644
index 5cd65b9df..000000000
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/compound/AbstractCompoundID.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * l2jserver2 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.
- *
- * l2jserver2 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 l2jserver2. If not, see .
- */
-package com.l2jserver.model.id.compound;
-
-import com.l2jserver.model.id.ID;
-
-/**
- * The compound {@link ID} is composed of two IDs.
- *
- * @param
- * the first {@link ID} type
- * @param
- * the second {@link ID} type
- *
- * @author Rogiel
- */
-public class AbstractCompoundID extends ID> {
- /**
- * The first ID
- */
- private final T1 id1;
- /**
- * The second ID
- */
- private final T2 id2;
-
- /**
- * Creates a new compound ID
- *
- * @param id1
- * the first id
- * @param id2
- * the second id
- */
- protected AbstractCompoundID(T1 id1, T2 id2) {
- super(null);
- this.id1 = id1;
- this.id2 = id2;
- }
-
- /**
- * @return the first id
- */
- public T1 getID1() {
- return id1;
- }
-
- /**
- * @return the second id
- */
- public T2 getID2() {
- return id2;
- }
-
- @Override
- public AbstractCompoundID getID() {
- return this;
- }
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/BitSetIDAllocator.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/BitSetIDAllocator.java
deleted file mode 100644
index ed65a0d16..000000000
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/BitSetIDAllocator.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * l2jserver2 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.
- *
- * l2jserver2 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 l2jserver2. If not, see .
- */
-package com.l2jserver.model.id.object.allocator;
-
-import java.util.BitSet;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.l2jserver.util.PrimeFinder;
-
-/**
- * The {@link BitSet} id allocator allocates new IDs backed by an {@link BitSet}
- *
- * @author Rogiel
- */
-public class BitSetIDAllocator implements IDAllocator {
- /**
- * The logger
- */
- private static final Logger log = LoggerFactory
- .getLogger(BitSetIDAllocator.class);
-
- /**
- * Lock to guarantee synchronization
- */
- private Lock lock = new ReentrantLock();
-
- /**
- * Available IDs
- */
- private BitSet ids = new BitSet();
- /**
- * Amount of free ids
- */
- private AtomicInteger freeIdCount = new AtomicInteger();
- /**
- * Next free ID
- */
- private AtomicInteger nextId = new AtomicInteger();
-
- /**
- * Initializes this allocator
- */
- public void init() {
- ids = new BitSet(PrimeFinder.nextPrime(100000));
- ids.clear();
- freeIdCount = new AtomicInteger(ALLOCABLE_IDS);
-
- nextId = new AtomicInteger(ids.nextClearBit(0));
- log.info("BitSet IDAllocator initialized. Next available ID is {}",
- nextId.get());
- }
-
- @Override
- public void allocate(int id) {
- if (ids.get(id - FIRST_ID))
- throw new IDAllocatorException("ID not allocated");
- log.debug("Allocating ID {}", id);
- lock.lock();
- try {
- if (id < FIRST_ID)
- return;
- ids.set(id - FIRST_ID);
- nextId = new AtomicInteger(ids.nextClearBit(0));
- } finally {
- lock.unlock();
- }
- }
-
- @Override
- public int allocate() {
- lock.lock();
- try {
- final int newID = nextId.get();
- ids.set(newID);
- freeIdCount.decrementAndGet();
-
- if (log.isDebugEnabled())
- log.debug("Allocated a new ID {}", newID + FIRST_ID);
-
- int nextFree = ids.nextClearBit(newID);
-
- if (nextFree < 0) {
- nextFree = ids.nextClearBit(0);
- }
- if (nextFree < 0) {
- if (ids.size() < ALLOCABLE_IDS) {
- increaseBitSetCapacity();
- } else {
- log.error("ID exhaustion");
- throw new IDAllocatorException("ID exhaustion");
- }
- }
-
- nextId.set(nextFree);
- return newID + FIRST_ID;
- } finally {
- lock.unlock();
- }
- }
-
- @Override
- public void release(int id) {
- if (id < FIRST_ID)
- throw new IDAllocatorException(
- "Can't release ID, smaller then initial ID");
- if (!ids.get(id - FIRST_ID))
- throw new IDAllocatorException("ID not allocated");
-
- log.debug("Releasing allocated ID {}", id);
- lock.lock();
- try {
- ids.clear(id - FIRST_ID);
- freeIdCount.incrementAndGet();
- } finally {
- lock.unlock();
- }
- }
-
- @Override
- public void clear() {
- ids.clear();
- }
-
- /**
- * Increases the {@link BitSet} capacity
- */
- private void increaseBitSetCapacity() {
- log.debug("Increasing BitSet capacity from {}", ids.size());
- BitSet newBitSet = new BitSet(
- PrimeFinder.nextPrime((getAllocatedIDs() * 11) / 10));
- newBitSet.or(ids);
- ids = newBitSet;
- }
-
- @Override
- public int getAllocatedIDs() {
- return ALLOCABLE_IDS - getFreeIDs();
- }
-
- @Override
- public int getFreeIDs() {
- return freeIdCount.get();
- }
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/IDAllocator.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/IDAllocator.java
deleted file mode 100644
index dade608ca..000000000
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/IDAllocator.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * l2jserver2 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.
- *
- * l2jserver2 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 l2jserver2. If not, see .
- */
-package com.l2jserver.model.id.object.allocator;
-
-/**
- * The ID allocator is used to alloc new ID and to release IDs that aren't used
- * anymore.
- *
- * @author Rogiel
- */
-public interface IDAllocator {
- /**
- * The first ID ever allocated
- */
- public final static int FIRST_ID = 0x10000000;
- /**
- * The last ID ever allocated
- */
- public final static int LAST_ID = 0x7FFFFFFF;
- /**
- * Total of available IDs for allocation
- */
- public final static int ALLOCABLE_IDS = LAST_ID - FIRST_ID;
-
- /**
- * This is method is used to register IDs as used at startup time.
- *
- * @param id
- * the id
- */
- void allocate(int id);
-
- /**
- * Allocates a new ID
- *
- * @return the allocated ID value
- */
- int allocate();
-
- /**
- * Release an ID
- *
- * @param id
- * the id
- */
- void release(int id);
-
- /**
- * Release all allocated IDs
- */
- void clear();
-
- /**
- * Get the amount of already allocated IDs
- *
- * @return allocated ids count
- */
- int getAllocatedIDs();
-
- /**
- * Get the amount of IDs remaining to be allocated
- *
- * @return free ids count
- */
- int getFreeIDs();
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/IDAllocatorException.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/IDAllocatorException.java
deleted file mode 100644
index dfef4cfe3..000000000
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/object/allocator/IDAllocatorException.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * l2jserver2 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.
- *
- * l2jserver2 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 l2jserver2. If not, see .
- */
-package com.l2jserver.model.id.object.allocator;
-
-/**
- * Exception thrown by an {@link IDAllocator}.
- *
- * @author Rogiel
- */
-public class IDAllocatorException extends RuntimeException {
- /**
- * The Java Serialization Serial
- */
- private static final long serialVersionUID = 111195059766878062L;
-
- /**
- * Creates an empty instance of this exception
- */
- public IDAllocatorException() {
- super();
- }
-
- /**
- * @param message
- * the message
- * @param cause
- * the root cause
- */
- public IDAllocatorException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- * the message
- */
- public IDAllocatorException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- * the root cause
- */
- public IDAllocatorException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorEffectContainer.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorEffectContainer.java
index 5ac138f24..19a2497c3 100644
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorEffectContainer.java
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorEffectContainer.java
@@ -48,10 +48,29 @@ public class ActorEffectContainer implements Iterable {
this.actor = actor;
}
+ /**
+ * Adds a new effect to the actor's effect container.
+ *
+ * Please note that if the same effect object is already in this
+ * container, nothing no exception will be thrown and the effect will not be
+ * applied twice.
+ *
+ * @param effect
+ * the effect to be added
+ */
public void addEffect(Effect effect) {
effects.add(effect);
}
+ /**
+ * Removes an effect that is attached to the actor's effect container.
+ *
+ * Please note that if the effect is not in the container, no exception will
+ * be thrown.
+ *
+ * @param effect
+ * the effect to be removed
+ */
public void removeEffect(Effect effect) {
effects.remove(effect);
}
diff --git a/pom.xml b/pom.xml
index c66e8d7fc..253fec9e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
l2jserver2
l2jserver2
- scp:l2jserver@l2jserver.com/l2jserver2.com
+ scp:l2jserver2@l2jserver2.com/l2jserver2.com