mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-10 01:12:52 +00:00
Improves javadoc in more than 190 classes
This commit improves and adds missing javadoc to 196 java files. Now more than 98% of the code is documented.
This commit is contained in:
@@ -39,6 +39,9 @@ public class CM_CHAR_MOVE extends AbstractClientPacket {
|
||||
*/
|
||||
public static final int OPCODE = 0x0f;
|
||||
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,9 @@ import com.l2jserver.model.world.Actor;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum BaseStats {
|
||||
/**
|
||||
* Strength multipliers
|
||||
*/
|
||||
STR(0.29, 0.3, 0.31, 0.32, 0.34, 0.35, 0.36, 0.37, 0.39, 0.4, 0.42, 0.43,
|
||||
0.45, 0.46, 0.48, 0.5, 0.51, 0.53, 0.55, 0.57, 0.59, 0.61, 0.63,
|
||||
0.66, 0.68, 0.71, 0.73, 0.76, 0.78, 0.81, 0.84, 0.87, 0.9, 0.94,
|
||||
@@ -32,6 +35,9 @@ public enum BaseStats {
|
||||
4.6, 4.77, 4.94, 5.12, 5.3, 5.49, 5.69, 5.89, 6.11, 6.33, 6.55,
|
||||
6.79, 7.03, 7.29, 7.55, 7.82, 8.1, 8.39, 8.7, 9.01, 9.33, 9.67),
|
||||
|
||||
/**
|
||||
* Intelligence multipliers
|
||||
*/
|
||||
INT(0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.61, 0.62, 0.63, 0.64, 0.65, 0.67,
|
||||
0.68, 0.69, 0.71, 0.72, 0.74, 0.75, 0.77, 0.78, 0.8, 0.81, 0.83,
|
||||
0.85, 0.86, 0.88, 0.9, 0.92, 0.94, 0.95, 0.97, 0.99, 1.01, 1.03,
|
||||
@@ -42,6 +48,9 @@ public enum BaseStats {
|
||||
2.52, 2.57, 2.62, 2.67, 2.73, 2.78, 2.84, 2.89, 2.95, 3.01, 3.07,
|
||||
3.13, 3.19, 3.26, 3.32, 3.39, 3.46, 3.53, 3.6, 3.67, 3.74, 3.82),
|
||||
|
||||
/**
|
||||
* Dexterity multipliers
|
||||
*/
|
||||
DEX(0.84, 0.85, 0.86, 0.86, 0.87, 0.88, 0.89, 0.9, 0.9, 0.91, 0.92, 0.93,
|
||||
0.94, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1, 1.01, 1.01, 1.02,
|
||||
1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13,
|
||||
@@ -52,6 +61,9 @@ public enum BaseStats {
|
||||
1.69, 1.71, 1.72, 1.74, 1.75, 1.77, 1.78, 1.8, 1.82, 1.83, 1.85,
|
||||
1.87, 1.88, 1.9, 1.92, 1.93, 1.95, 1.97, 1.99, 2, 2.02, 2.04),
|
||||
|
||||
/**
|
||||
* Witness multipliers
|
||||
*/
|
||||
WIT(0.39, 0.4, 0.42, 0.44, 0.46, 0.48, 0.51, 0.53, 0.56, 0.58, 0.61, 0.64,
|
||||
0.68, 0.71, 0.75, 0.78, 0.82, 0.86, 0.91, 0.95, 1, 1.05, 1.1, 1.16,
|
||||
1.22, 1.28, 1.34, 1.41, 1.48, 1.55, 1.63, 1.71, 1.8, 1.89, 1.98,
|
||||
@@ -63,6 +75,9 @@ public enum BaseStats {
|
||||
25.03, 26.28, 27.6, 28.98, 30.43, 31.95, 33.55, 35.22, 36.98,
|
||||
38.83, 40.77, 42.81, 44.95, 47.2),
|
||||
|
||||
/**
|
||||
* Concentration multipliers
|
||||
*/
|
||||
CON(0.45, 0.46, 0.47, 0.48, 0.5, 0.51, 0.53, 0.54, 0.56, 0.58, 0.59, 0.61,
|
||||
0.63, 0.65, 0.67, 0.69, 0.71, 0.73, 0.75, 0.77, 0.8, 0.82, 0.85,
|
||||
0.87, 0.9, 0.93, 0.95, 0.98, 1.01, 1.04, 1.07, 1.1, 1.14, 1.17,
|
||||
@@ -73,6 +88,9 @@ public enum BaseStats {
|
||||
4.56, 4.7, 4.84, 4.99, 5.14, 5.29, 5.45, 5.61, 5.78, 5.96, 6.13,
|
||||
6.32, 6.51, 6.7, 6.9, 7.11, 7.33, 7.54, 7.77, 8, 8.24),
|
||||
|
||||
/**
|
||||
* Mentality multipliers
|
||||
*/
|
||||
MEN(1, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.11, 1.12,
|
||||
1.13, 1.14, 1.15, 1.16, 1.17, 1.19, 1.2, 1.21, 1.22, 1.23, 1.25,
|
||||
1.26, 1.27, 1.28, 1.3, 1.31, 1.32, 1.34, 1.35, 1.36, 1.38, 1.39,
|
||||
@@ -89,18 +107,41 @@ public enum BaseStats {
|
||||
*/
|
||||
public final double[] bonus;
|
||||
|
||||
/**
|
||||
* @param bonus
|
||||
* the bonus multipliers
|
||||
*/
|
||||
BaseStats(double... bonus) {
|
||||
this.bonus = bonus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the bonus
|
||||
*
|
||||
* @param n
|
||||
* the level
|
||||
* @return the bonus for the given level
|
||||
*/
|
||||
public double calculateBonus(int n) {
|
||||
return bonus[n];
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the bonus
|
||||
*
|
||||
* @param actor
|
||||
* the actor
|
||||
* @return the bonus for the given actor
|
||||
*/
|
||||
public double calculateBonus(Actor actor) {
|
||||
return calculateBonus(actor.getStats());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stats
|
||||
* the actor stats
|
||||
* @return the calculated bonus
|
||||
*/
|
||||
public double calculateBonus(ActorStats<?> stats) {
|
||||
switch (this) {
|
||||
case CON:
|
||||
|
||||
@@ -65,6 +65,13 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given paperdoll has is occupied
|
||||
*
|
||||
* @param paperdoll
|
||||
* the paperdoll slot
|
||||
* @return true if has an item
|
||||
*/
|
||||
public boolean has(InventoryPaperdoll paperdoll) {
|
||||
return getItem(paperdoll) != null;
|
||||
}
|
||||
@@ -131,6 +138,10 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the slot id
|
||||
*/
|
||||
InventoryPaperdoll(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -137,8 +137,15 @@ public class CharacterShortcutContainer implements Iterable<Shortcut> {
|
||||
return character;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two shortcut slots
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public static class ShortcutSlotComparator implements Comparator<Shortcut>,
|
||||
Serializable {
|
||||
/**
|
||||
* The Java Serialization API serial
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -260,6 +260,9 @@ public class CharacterStats extends ActorStats<CharacterCalculatorContext> {
|
||||
*/
|
||||
private final L2Character character;
|
||||
|
||||
/**
|
||||
* The character calculator
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final CharacterCalculator calculator = new CharacterCalculator();
|
||||
|
||||
@@ -294,6 +297,9 @@ public class CharacterStats extends ActorStats<CharacterCalculatorContext> {
|
||||
return (int) calc(StatType.MAX_LOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setups the default formulas
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setup() {
|
||||
calculator.addNoSort(BASE_HP_FORMULA, BASE_MP_FORMULA, BASE_CP_FORMULA);
|
||||
@@ -327,12 +333,21 @@ public class CharacterStats extends ActorStats<CharacterCalculatorContext> {
|
||||
calculator.sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the calculator
|
||||
*/
|
||||
public void updateCalculator() {
|
||||
calculator.clear();
|
||||
setup();
|
||||
addItem(InventoryPaperdoll.RIGHT_HAND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the item formulas to this character calculator
|
||||
*
|
||||
* @param paperdoll
|
||||
* the paperdoll slot
|
||||
*/
|
||||
private void addItem(InventoryPaperdoll paperdoll) {
|
||||
if (!character.getInventory().has(paperdoll))
|
||||
return;
|
||||
|
||||
@@ -27,6 +27,9 @@ import com.l2jserver.util.calculator.Calculator;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterCalculator extends ActorCalculator {
|
||||
/**
|
||||
* @param calculators the calculators
|
||||
*/
|
||||
public CharacterCalculator(
|
||||
Calculator<ActorCalculatorContext, StatType>... calculators) {
|
||||
super(calculators);
|
||||
|
||||
@@ -30,6 +30,10 @@ public class CharacterCalculatorContext extends ActorCalculatorContext {
|
||||
*/
|
||||
public final L2Character character;
|
||||
|
||||
/**
|
||||
* Creates a new context
|
||||
* @param character the character
|
||||
*/
|
||||
public CharacterCalculatorContext(L2Character character) {
|
||||
super(character);
|
||||
this.character = character;
|
||||
|
||||
@@ -30,6 +30,12 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
*/
|
||||
public abstract class CharacterCalculatorFunction extends
|
||||
ActorCalculatorFunction {
|
||||
/**
|
||||
* @param order
|
||||
* the calculation order
|
||||
* @param type
|
||||
* the stat type
|
||||
*/
|
||||
public CharacterCalculatorFunction(int order, StatType type) {
|
||||
super(order, type);
|
||||
}
|
||||
@@ -41,6 +47,17 @@ public abstract class CharacterCalculatorFunction extends
|
||||
value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the calculated value
|
||||
*
|
||||
* @param c
|
||||
* the character
|
||||
* @param t
|
||||
* the template
|
||||
* @param value
|
||||
* the input value
|
||||
* @return the computed value
|
||||
*/
|
||||
protected abstract double calculate(L2Character c, CharacterTemplate t,
|
||||
double value);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class CharacterFormula extends CharacterCalculatorFunction {
|
||||
/**
|
||||
* @param order the calculation order
|
||||
* @param type the stat type
|
||||
*/
|
||||
public CharacterFormula(int order, StatType type) {
|
||||
super(order, type);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class MaximumCPAddCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public MaximumCPAddCalculator() {
|
||||
super(0x100, StatType.MAX_CP);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class MaximumCPBonusCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public MaximumCPBonusCalculator() {
|
||||
super(0x100, StatType.MAX_CP);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class MaximumHPAddCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public MaximumHPAddCalculator() {
|
||||
super(0x100, StatType.MAX_HP);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class MaximumMPAddCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public MaximumMPAddCalculator() {
|
||||
super(0x100, StatType.MAX_MP);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseAttackAccuracyCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseAttackAccuracyCalculator() {
|
||||
super(0x000, StatType.ACCURACY_COMBAT);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseAttackEvasionCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseAttackEvasionCalculator() {
|
||||
super(0x000, StatType.EVASION_RATE);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseCPCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseCPCalculator() {
|
||||
super(0x000, StatType.MAX_CP);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseConcentrationCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseConcentrationCalculator() {
|
||||
super(0x000, StatType.STAT_CON);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseDexterityCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseDexterityCalculator() {
|
||||
super(0x000, StatType.STAT_DEX);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseHPCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseHPCalculator() {
|
||||
super(0x000, StatType.MAX_HP);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseIntelligenceCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseIntelligenceCalculator() {
|
||||
super(0x000, StatType.STAT_INT);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMPCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseMPCalculator() {
|
||||
super(0x000, StatType.MAX_MP);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMagicalAttackCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseMagicalAttackCalculator() {
|
||||
super(0x000, StatType.MAGIC_ATTACK);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMagicalAttackSpeedCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseMagicalAttackSpeedCalculator() {
|
||||
super(0x000, StatType.MAGIC_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
*/
|
||||
public class CharacterBaseMagicalCriticalRateCalculator extends
|
||||
CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseMagicalCriticalRateCalculator() {
|
||||
super(0x000, StatType.MCRITICAL_RATE);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMagicalDefenseCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseMagicalDefenseCalculator() {
|
||||
super(0x000, StatType.MAGIC_DEFENSE);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMentalityCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseMentalityCalculator() {
|
||||
super(0x000, StatType.STAT_MEN);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBasePhysicalAttackCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBasePhysicalAttackCalculator() {
|
||||
super(0x000, StatType.POWER_ATTACK);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
*/
|
||||
public class CharacterBasePhysicalAttackSpeedCalculator extends
|
||||
CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBasePhysicalAttackSpeedCalculator() {
|
||||
super(0x000, StatType.POWER_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
*/
|
||||
public class CharacterBasePhysicalCriticalRateCalculator extends
|
||||
CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBasePhysicalCriticalRateCalculator() {
|
||||
super(0x000, StatType.CRITICAL_RATE);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBasePhysicalDefenseCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBasePhysicalDefenseCalculator() {
|
||||
super(0x000, StatType.POWER_DEFENSE);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseRunSpeedCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseRunSpeedCalculator() {
|
||||
super(0x000, StatType.RUN_SPEED);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseStrengthCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseStrengthCalculator() {
|
||||
super(0x000, StatType.STAT_STR);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseWalkSpeedCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseWalkSpeedCalculator() {
|
||||
super(0x000, StatType.WALK_SPEED);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.character.calculator.CharacterFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseWitnessCalculator extends CharacterFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public CharacterBaseWitnessCalculator() {
|
||||
super(0x000, StatType.STAT_WIT);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ import com.l2jserver.service.game.world.event.TypedWorldListener;
|
||||
*/
|
||||
public abstract class CharacterListener extends
|
||||
TypedWorldListener<CharacterEvent> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*/
|
||||
public CharacterListener() {
|
||||
super(CharacterEvent.class);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ import com.l2jserver.service.game.world.event.TypedWorldListener;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class ClanListener extends TypedWorldListener<ClanEvent> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*/
|
||||
public ClanListener() {
|
||||
super(ClanEvent.class);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ import com.l2jserver.service.game.world.event.TypedWorldListener;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class ItemListener extends TypedWorldListener<ItemEvent> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*/
|
||||
public ItemListener() {
|
||||
super(ItemEvent.class);
|
||||
}
|
||||
|
||||
@@ -204,6 +204,9 @@ public class NPCStats extends ActorStats<NPCCalculatorContext> {
|
||||
*/
|
||||
private final NPC npc;
|
||||
|
||||
/**
|
||||
* The NPC calculator
|
||||
*/
|
||||
private static final NPCCalculator calculator = new NPCCalculator();
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,10 @@ import com.l2jserver.model.world.actor.calculator.ActorCalculator;
|
||||
*
|
||||
*/
|
||||
public class NPCCalculator extends ActorCalculator {
|
||||
/**
|
||||
* @param calculators
|
||||
* the calculators
|
||||
*/
|
||||
public NPCCalculator(NPCCalculator... calculators) {
|
||||
super(calculators);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@ public class NPCCalculatorContext extends ActorCalculatorContext {
|
||||
*/
|
||||
public final NPC npc;
|
||||
|
||||
/**
|
||||
* Creates a new calculator context
|
||||
* @param npc the {@link NPC}
|
||||
*/
|
||||
public NPCCalculatorContext(NPC npc) {
|
||||
super(npc);
|
||||
this.npc = npc;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.l2jserver.model.world.npc.calculator;
|
||||
|
||||
import com.l2jserver.model.template.ActorTemplate;
|
||||
import com.l2jserver.model.template.NPCTemplate;
|
||||
import com.l2jserver.model.template.Template;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.model.world.actor.calculator.ActorCalculatorFunction;
|
||||
@@ -29,6 +30,14 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class NPCCalculatorFunction extends ActorCalculatorFunction {
|
||||
/**
|
||||
* Creates a new function
|
||||
*
|
||||
* @param order
|
||||
* the calculation order
|
||||
* @param type
|
||||
* the stat type
|
||||
*/
|
||||
public NPCCalculatorFunction(int order, StatType type) {
|
||||
super(order, type);
|
||||
}
|
||||
@@ -39,5 +48,16 @@ public abstract class NPCCalculatorFunction extends ActorCalculatorFunction {
|
||||
return calculate((NPC) a, (NPCTemplate) actorTemplate, value);
|
||||
}
|
||||
|
||||
protected abstract double calculate(NPC c, NPCTemplate t, double value);
|
||||
/**
|
||||
* Calculates the value
|
||||
*
|
||||
* @param n
|
||||
* the {@link NPC}
|
||||
* @param t
|
||||
* the {@link Template}
|
||||
* @param value
|
||||
* the original value
|
||||
* @return the output value (calculated)
|
||||
*/
|
||||
protected abstract double calculate(NPC n, NPCTemplate t, double value);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,14 @@ import com.l2jserver.model.world.actor.stat.StatType;
|
||||
*
|
||||
*/
|
||||
public abstract class NPCFormula extends NPCCalculatorFunction {
|
||||
/**
|
||||
* Creates a new formula
|
||||
*
|
||||
* @param order
|
||||
* the calculation order
|
||||
* @param type
|
||||
* the stat type
|
||||
*/
|
||||
public NPCFormula(int order, StatType type) {
|
||||
super(order, type);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseAttackEvasionCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseAttackEvasionCalculator() {
|
||||
super(0x000, StatType.EVASION_RATE);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseConcentrationCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseConcentrationCalculator() {
|
||||
super(0x000, StatType.STAT_CON);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseDexterityCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseDexterityCalculator() {
|
||||
super(0x000, StatType.STAT_DEX);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseHPCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseHPCalculator() {
|
||||
super(0x000, StatType.MAX_HP);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseIntelligenceCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseIntelligenceCalculator() {
|
||||
super(0x000, StatType.STAT_INT);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseMPCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseMPCalculator() {
|
||||
super(0x000, StatType.MAX_MP);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseMagicalAttackCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseMagicalAttackCalculator() {
|
||||
super(0x000, StatType.MAGIC_ATTACK);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseMagicalAttackSpeedCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseMagicalAttackSpeedCalculator() {
|
||||
super(0x000, StatType.MAGIC_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseMagicalCriticalRateCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseMagicalCriticalRateCalculator() {
|
||||
super(0x000, StatType.MCRITICAL_RATE);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseMagicalDefenseCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseMagicalDefenseCalculator() {
|
||||
super(0x000, StatType.MAGIC_DEFENSE);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseMentalityCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseMentalityCalculator() {
|
||||
super(0x000, StatType.STAT_MEN);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBasePhysicalAttackCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBasePhysicalAttackCalculator() {
|
||||
super(0x000, StatType.POWER_ATTACK);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBasePhysicalAttackSpeedCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBasePhysicalAttackSpeedCalculator() {
|
||||
super(0x000, StatType.POWER_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBasePhysicalCriticalRateCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBasePhysicalCriticalRateCalculator() {
|
||||
super(0x000, StatType.CRITICAL_RATE);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBasePhysicalDefenseCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBasePhysicalDefenseCalculator() {
|
||||
super(0x000, StatType.POWER_DEFENSE);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseRunSpeedCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseRunSpeedCalculator() {
|
||||
super(0x000, StatType.RUN_SPEED);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseStrengthCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseStrengthCalculator() {
|
||||
super(0x000, StatType.STAT_STR);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseWalkSpeedCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseWalkSpeedCalculator() {
|
||||
super(0x000, StatType.WALK_SPEED);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.l2jserver.model.world.npc.calculator.NPCFormula;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCBaseWitnessCalculator extends NPCFormula {
|
||||
/**
|
||||
* Creates a new instance of this formula
|
||||
*/
|
||||
public NPCBaseWitnessCalculator() {
|
||||
super(0x000, StatType.STAT_WIT);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ public class TeleporterController extends BaseNPCController {
|
||||
*/
|
||||
@Inject
|
||||
protected SpawnService spawnService;
|
||||
/**
|
||||
* The teleportation template id provider
|
||||
*/
|
||||
@Inject
|
||||
protected TeleportationTemplateIDProvider teleportationIdProvider;
|
||||
|
||||
|
||||
@@ -25,5 +25,8 @@ import com.l2jserver.service.game.world.event.WorldEvent;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface NPCEvent extends WorldEvent {
|
||||
/**
|
||||
* @return the NPC
|
||||
*/
|
||||
NPC getNPC();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ import com.l2jserver.service.game.world.event.TypedWorldListener;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class NPCListener extends TypedWorldListener<NPCEvent> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*/
|
||||
public NPCListener() {
|
||||
super(NPCEvent.class);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ import com.l2jserver.service.game.world.event.TypedWorldListener;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class PlayerListener extends TypedWorldListener<PlayerEvent> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*/
|
||||
public PlayerListener() {
|
||||
super(PlayerEvent.class);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,13 @@ import com.l2jserver.util.geometry.Point3D;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class PlayerTeleportingEvent implements PlayerEvent {
|
||||
/**
|
||||
* The player object
|
||||
*/
|
||||
private final Player player;
|
||||
/**
|
||||
* The teleportation point
|
||||
*/
|
||||
private final Point3D point;
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,6 +45,12 @@ public abstract class AbstractService implements Service {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the service. This method is invoked internally by {@link #start()}
|
||||
*
|
||||
* @throws ServiceStartException
|
||||
* if any error occur while starting the service
|
||||
*/
|
||||
protected void doStart() throws ServiceStartException {
|
||||
}
|
||||
|
||||
@@ -59,6 +65,12 @@ public abstract class AbstractService implements Service {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the service. This method is invoked internally by {@link #stop()}
|
||||
*
|
||||
* @throws ServiceStopException
|
||||
* if any error occur while stopping the service
|
||||
*/
|
||||
protected void doStop() throws ServiceStopException {
|
||||
}
|
||||
|
||||
@@ -86,9 +98,17 @@ public abstract class AbstractService implements Service {
|
||||
return deps.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Service dependency metadata
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Depends {
|
||||
/**
|
||||
* @return the service's dependency
|
||||
*/
|
||||
Class<? extends Service>[] value();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,20 +24,46 @@ import com.l2jserver.util.exception.L2Exception;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class ServiceException extends L2Exception {
|
||||
/**
|
||||
* The Java Serialization API serial
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*/
|
||||
public ServiceException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public ServiceException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Set;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.l2jserver.service.core.LoggingService;
|
||||
@@ -46,6 +47,10 @@ public class ServiceManager {
|
||||
*/
|
||||
private final Set<Service> knownServices = CollectionFactory.newSet();
|
||||
|
||||
/**
|
||||
* @param injector
|
||||
* the {@link Guice} {@link Injector}
|
||||
*/
|
||||
@Inject
|
||||
public ServiceManager(Injector injector) {
|
||||
this.injector = injector;
|
||||
@@ -60,10 +65,28 @@ public class ServiceManager {
|
||||
logger = LoggerFactory.getLogger(ServiceManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param <T>
|
||||
* the service type
|
||||
* @param serviceClass
|
||||
* the service interface <tt>Class<T></tt>
|
||||
* @return the service implementation
|
||||
*/
|
||||
public <T extends Service> T get(Class<T> serviceClass) {
|
||||
return injector.getInstance(serviceClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the given service implementation
|
||||
*
|
||||
* @param <T>
|
||||
* the service interface type
|
||||
* @param serviceClass
|
||||
* the service interface
|
||||
* @return the service implementation
|
||||
* @throws ServiceStartException
|
||||
* if any error occur while starting service
|
||||
*/
|
||||
public <T extends Service> T start(Class<T> serviceClass)
|
||||
throws ServiceStartException {
|
||||
final T service = injector.getInstance(serviceClass);
|
||||
@@ -90,6 +113,14 @@ public class ServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the dependencies
|
||||
*
|
||||
* @param dependencies
|
||||
* the dependencies
|
||||
* @throws ServiceStartException
|
||||
* if any error occur while starting dependencies
|
||||
*/
|
||||
private void startDependencies(Class<? extends Service>[] dependencies)
|
||||
throws ServiceStartException {
|
||||
if (dependencies == null)
|
||||
@@ -101,6 +132,14 @@ public class ServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the given service implementation
|
||||
*
|
||||
* @param serviceClass
|
||||
* the service interface
|
||||
* @throws ServiceStopException
|
||||
* if any error occur while stopping service
|
||||
*/
|
||||
public void stop(Class<? extends Service> serviceClass)
|
||||
throws ServiceStopException {
|
||||
final Service service = injector.getInstance(serviceClass);
|
||||
@@ -122,6 +161,14 @@ public class ServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the dependencies
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @throws ServiceStopException
|
||||
* if any error occur while stopping dependencies
|
||||
*/
|
||||
private void stopDependencies(Service service) throws ServiceStopException {
|
||||
final Set<Class<? extends Service>> dependencies = createStopDependencies(
|
||||
null, service);
|
||||
@@ -130,6 +177,15 @@ public class ServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Set} of all dependecies to be stopped
|
||||
*
|
||||
* @param depends
|
||||
* the service
|
||||
* @param serviceClass
|
||||
* the service class
|
||||
* @return the {@link Set} of all depedendecies to be stopped
|
||||
*/
|
||||
private Set<Class<? extends Service>> createStopDependencies(
|
||||
Set<Class<? extends Service>> depends, Service serviceClass) {
|
||||
if (depends == null)
|
||||
@@ -150,6 +206,17 @@ public class ServiceManager {
|
||||
return depends;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restarts the given service
|
||||
*
|
||||
* @param <T>
|
||||
* the service type
|
||||
* @param serviceClass
|
||||
* the service interface
|
||||
* @return the service implementation
|
||||
* @throws ServiceException
|
||||
* if any error occur while starting or stopping the service
|
||||
*/
|
||||
public <T extends Service> T restart(Class<T> serviceClass)
|
||||
throws ServiceException {
|
||||
final T service = injector.getInstance(serviceClass);
|
||||
|
||||
@@ -23,20 +23,46 @@ package com.l2jserver.service;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ServiceRestartException extends ServiceException {
|
||||
/**
|
||||
* The Java Serialization API serial
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*/
|
||||
public ServiceRestartException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceRestartException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public ServiceRestartException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceRestartException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@@ -22,20 +22,46 @@ package com.l2jserver.service;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ServiceStartException extends ServiceException {
|
||||
/**
|
||||
* The Java Serialization API serial
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*/
|
||||
public ServiceStartException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceStartException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public ServiceStartException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceStartException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@@ -22,20 +22,46 @@ package com.l2jserver.service;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ServiceStopException extends ServiceException {
|
||||
/**
|
||||
* The Java Serialization API serial
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*/
|
||||
public ServiceStopException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceStopException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public ServiceStopException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this exception
|
||||
*
|
||||
* @param cause
|
||||
* the root cause
|
||||
*/
|
||||
public ServiceStopException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ import com.l2jserver.util.factory.CollectionFactory;
|
||||
* the value type
|
||||
*/
|
||||
abstract class AbstractReferenceCache<K, V> implements Cache<K, V> {
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
@@ -93,6 +96,9 @@ abstract class AbstractReferenceCache<K, V> implements Cache<K, V> {
|
||||
return cacheMap.containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans the queue
|
||||
*/
|
||||
protected abstract void cleanQueue();
|
||||
|
||||
@Override
|
||||
@@ -131,6 +137,17 @@ abstract class AbstractReferenceCache<K, V> implements Cache<K, V> {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new reference
|
||||
*
|
||||
* @param key
|
||||
* the reference key
|
||||
* @param value
|
||||
* the reference value
|
||||
* @param queue
|
||||
* the queue
|
||||
* @return the new reference
|
||||
*/
|
||||
protected abstract Reference<V> newReference(K key, V value,
|
||||
ReferenceQueue<V> queue);
|
||||
}
|
||||
|
||||
@@ -163,9 +163,25 @@ public class EhCacheService extends AbstractService implements CacheService {
|
||||
interfaceCache = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link net.sf.ehcache.Cache EhCache} facade
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
* @param <K>
|
||||
* the key type
|
||||
* @param <V>
|
||||
* the value type
|
||||
*/
|
||||
private class EhCacheFacade<K, V> implements Cache<K, V> {
|
||||
/**
|
||||
* The backing cache
|
||||
*/
|
||||
private final net.sf.ehcache.Cache cache;
|
||||
|
||||
/**
|
||||
* @param cache the backing cache
|
||||
*/
|
||||
public EhCacheFacade(net.sf.ehcache.Cache cache) {
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ import com.l2jserver.util.factory.CollectionFactory;
|
||||
* the value type
|
||||
*/
|
||||
public class EternalCache<K, V> implements Cache<K, V> {
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,12 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicate to the proxy that this method should not be cached.
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@Documented
|
||||
/**
|
||||
* Indicate to the proxy that this method should not be cached.
|
||||
*/
|
||||
public @interface IgnoreCaching {
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ class MethodInvocation {
|
||||
*/
|
||||
private final Object[] args;
|
||||
|
||||
/**
|
||||
* @param method the method invoked
|
||||
* @param args the invocation arguments
|
||||
*/
|
||||
public MethodInvocation(Method method, Object[] args) {
|
||||
this.method = method;
|
||||
this.args = args;
|
||||
|
||||
@@ -142,18 +142,36 @@ public class SoftCacheService extends AbstractService implements CacheService {
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
private class SoftEntry extends SoftReference<V> {
|
||||
/**
|
||||
* The key
|
||||
*/
|
||||
private K key;
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* the key
|
||||
* @param referent
|
||||
* the value
|
||||
* @param q
|
||||
* the queue
|
||||
*/
|
||||
SoftEntry(K key, V referent, ReferenceQueue<? super V> q) {
|
||||
super(referent, q);
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the key
|
||||
*/
|
||||
K getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cacheName
|
||||
* the cache name
|
||||
*/
|
||||
public SoftCache(String cacheName) {
|
||||
super(cacheName);
|
||||
}
|
||||
|
||||
@@ -130,8 +130,10 @@ public class WeakCacheService extends AbstractService implements CacheService {
|
||||
* if there isn't any strong reference to the value object.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
* @param <K>
|
||||
* the key type
|
||||
* @param <V>
|
||||
* the value type
|
||||
*/
|
||||
private class WeakCache<K, V> extends AbstractReferenceCache<K, V>
|
||||
implements Cache<K, V> {
|
||||
@@ -142,18 +144,36 @@ public class WeakCacheService extends AbstractService implements CacheService {
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
private class Entry extends WeakReference<V> {
|
||||
/**
|
||||
* The key
|
||||
*/
|
||||
private K key;
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* the key
|
||||
* @param referent
|
||||
* the value
|
||||
* @param q
|
||||
* the queue
|
||||
*/
|
||||
Entry(K key, V referent, ReferenceQueue<? super V> q) {
|
||||
super(referent, q);
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the key
|
||||
*/
|
||||
K getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cacheName
|
||||
* the cache name
|
||||
*/
|
||||
WeakCache(String cacheName) {
|
||||
super(cacheName);
|
||||
}
|
||||
|
||||
@@ -103,9 +103,19 @@ public class ProxyConfigurationService extends AbstractService implements
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
private class ConfigInvocationHandler implements InvocationHandler {
|
||||
/**
|
||||
* The invocation handler properties
|
||||
*/
|
||||
private final Properties properties;
|
||||
/**
|
||||
* The invocation cache
|
||||
*/
|
||||
private Map<String, Object> cache = CollectionFactory.newWeakMap();
|
||||
|
||||
/**
|
||||
* @param properties
|
||||
* the properties
|
||||
*/
|
||||
public ConfigInvocationHandler(Properties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,17 @@ import com.l2jserver.service.ServiceStopException;
|
||||
*/
|
||||
public class Log4JLoggingService extends AbstractService implements
|
||||
LoggingService {
|
||||
/**
|
||||
* The root logger
|
||||
*/
|
||||
private Logger rootLogger;
|
||||
/**
|
||||
* The l2j logger
|
||||
*/
|
||||
private Logger l2jLogger;
|
||||
/**
|
||||
* The netty logger
|
||||
*/
|
||||
private Logger nettyLogger;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.l2jserver.service.core.threading;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -85,14 +86,16 @@ public class ThreadServiceImpl extends AbstractService implements ThreadService
|
||||
Preconditions.checkNotNull(unit, "unit");
|
||||
Preconditions.checkNotNull(task, "task");
|
||||
|
||||
log.debug("Scheduling repeating async task in {}ms each {}ms: {}", new Object[] {
|
||||
unit.toMillis(delay), unit.toMillis(repeat), task });
|
||||
log.debug("Scheduling repeating async task in {}ms each {}ms: {}",
|
||||
new Object[] { unit.toMillis(delay), unit.toMillis(repeat),
|
||||
task });
|
||||
return pool.async(delay, unit, repeat, task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreadPool createThreadPool(String name, int maxThreads) {
|
||||
log.debug("Creating new ThreadPool {} with maximum of {} threads", name, maxThreads);
|
||||
log.debug("Creating new ThreadPool {} with maximum of {} threads",
|
||||
name, maxThreads);
|
||||
return new ThreadPoolImpl(name,
|
||||
Executors.newScheduledThreadPool(maxThreads));
|
||||
}
|
||||
@@ -205,9 +208,21 @@ public class ThreadServiceImpl extends AbstractService implements ThreadService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Future implementation for asynchronous tasks
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
private class ScheduledAsyncFutureImpl implements ScheduledAsyncFuture {
|
||||
/**
|
||||
* The {@link ExecutorService} {@link ScheduledFuture}
|
||||
*/
|
||||
private final ScheduledFuture<?> future;
|
||||
|
||||
/**
|
||||
* @param future
|
||||
* the {@link ExecutorService} {@link ScheduledFuture}
|
||||
*/
|
||||
public ScheduledAsyncFutureImpl(ScheduledFuture<?> future) {
|
||||
this.future = future;
|
||||
}
|
||||
@@ -251,6 +266,11 @@ public class ThreadServiceImpl extends AbstractService implements ThreadService
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Thread pool implementation
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
private class ThreadPoolImpl implements ThreadPool {
|
||||
/**
|
||||
* This thread pool name
|
||||
@@ -261,6 +281,12 @@ public class ThreadServiceImpl extends AbstractService implements ThreadService
|
||||
*/
|
||||
private final ScheduledExecutorService executor;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the pool name
|
||||
* @param executor
|
||||
* the backing {@link ScheduledExecutorService}
|
||||
*/
|
||||
public ThreadPoolImpl(String name, ScheduledExecutorService executor) {
|
||||
this.name = name;
|
||||
this.executor = executor;
|
||||
|
||||
@@ -43,6 +43,9 @@ public class Java7VFSService extends AbstractService implements VFSService {
|
||||
*/
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* The Java 7 vfs configuration
|
||||
*/
|
||||
private final Java7VFSConfiguration config;
|
||||
|
||||
/**
|
||||
@@ -62,6 +65,10 @@ public class Java7VFSService extends AbstractService implements VFSService {
|
||||
public interface Java7VFSConfiguration extends VFSConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configService
|
||||
* the configuration service
|
||||
*/
|
||||
@Inject
|
||||
protected Java7VFSService(final ConfigurationService configService) {
|
||||
this.config = configService.get(Java7VFSConfiguration.class);
|
||||
|
||||
@@ -41,6 +41,9 @@ public abstract class AbstractDAO<T extends Model<?>, I extends ID<?>>
|
||||
*/
|
||||
protected final DatabaseService database;
|
||||
|
||||
/**
|
||||
* @param database the database service
|
||||
*/
|
||||
@Inject
|
||||
protected AbstractDAO(DatabaseService database) {
|
||||
this.database = database;
|
||||
|
||||
@@ -49,6 +49,18 @@ public interface DatabaseService extends Service {
|
||||
public interface DatabaseConfiguration extends ServiceConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link DataAccessObject} used to retrieve and save objects of
|
||||
* type <M>
|
||||
*
|
||||
* @param <M>
|
||||
* the {@link Model} type
|
||||
* @param <I>
|
||||
* the {@link ID} type
|
||||
* @param model
|
||||
* the model class
|
||||
* @return the {@link DataAccessObject} for {@link Model}
|
||||
*/
|
||||
<M extends Model<I>, I extends ID<M>> DataAccessObject<M, I> getDAO(
|
||||
Class<M> model);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.l2jserver.model.Model;
|
||||
@@ -243,6 +244,16 @@ public class JDBCDatabaseService extends AbstractService implements
|
||||
void setMinIdleConnections(int password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configService
|
||||
* the configuration service
|
||||
* @param injector
|
||||
* the {@link Guice} {@link Injector}
|
||||
* @param cacheService
|
||||
* the cache service
|
||||
* @param threadService
|
||||
* the thread service
|
||||
*/
|
||||
@Inject
|
||||
public JDBCDatabaseService(ConfigurationService configService,
|
||||
Injector injector, CacheService cacheService,
|
||||
@@ -343,29 +354,57 @@ public class JDBCDatabaseService extends AbstractService implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for the cached version of the object
|
||||
*
|
||||
* @param id
|
||||
* the object ID
|
||||
* @return the cached version, if any
|
||||
*/
|
||||
public Object getCachedObject(Object id) {
|
||||
Preconditions.checkNotNull(id, "id");
|
||||
log.debug("Fetching cached object {}", id);
|
||||
return objectCache.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for the cached version of the object
|
||||
*
|
||||
* @param id
|
||||
* the object ID
|
||||
* @return true if has an cached version,
|
||||
*/
|
||||
public boolean hasCachedObject(Object id) {
|
||||
Preconditions.checkNotNull(id, "id");
|
||||
log.debug("Locating cached object {}", id);
|
||||
return objectCache.contains(id);
|
||||
}
|
||||
|
||||
public void updateCache(ID<?> key, Model<?> value) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
/**
|
||||
* Updates an cache object
|
||||
*
|
||||
* @param id
|
||||
* the cache key
|
||||
* @param value
|
||||
* the model value
|
||||
*/
|
||||
public void updateCache(ID<?> id, Model<?> value) {
|
||||
Preconditions.checkNotNull(id, "key");
|
||||
Preconditions.checkNotNull(value, "value");
|
||||
log.debug("Updating cached object {} with {}", key, value);
|
||||
objectCache.put(key, value);
|
||||
log.debug("Updating cached object {} with {}", id, value);
|
||||
objectCache.put(id, value);
|
||||
}
|
||||
|
||||
public void removeCache(Object key) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
log.debug("Removing cached object {}", key);
|
||||
objectCache.remove(key);
|
||||
/**
|
||||
* Removes an cached object
|
||||
*
|
||||
* @param id
|
||||
* the object id
|
||||
*/
|
||||
public void removeCache(Object id) {
|
||||
Preconditions.checkNotNull(id, "key");
|
||||
log.debug("Removing cached object {}", id);
|
||||
objectCache.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -431,6 +470,9 @@ public class JDBCDatabaseService extends AbstractService implements
|
||||
private final Logger log = LoggerFactory
|
||||
.getLogger(InsertUpdateQuery.class);
|
||||
|
||||
/**
|
||||
* The iterator
|
||||
*/
|
||||
private final Iterator<T> iterator;
|
||||
|
||||
/**
|
||||
@@ -736,6 +778,9 @@ public class JDBCDatabaseService extends AbstractService implements
|
||||
*/
|
||||
private final JDBCDatabaseService database;
|
||||
|
||||
/**
|
||||
* The {@link ID} mapper
|
||||
*/
|
||||
private final Mapper<I> idMapper;
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,6 +40,9 @@ public abstract class AbstractJDBCDAO<T extends Model<?>, I extends ID<?>>
|
||||
*/
|
||||
protected final JDBCDatabaseService database;
|
||||
|
||||
/**
|
||||
* @param database the database service
|
||||
*/
|
||||
@Inject
|
||||
protected AbstractJDBCDAO(DatabaseService database) {
|
||||
super(database);
|
||||
|
||||
@@ -105,6 +105,18 @@ public abstract class JDBCCharacterDAO extends
|
||||
public static final String APPEARANCE_HAIR_COLOR = "appearance_hair_color";
|
||||
public static final String APPEARANCE_FACE = "apperance_face";
|
||||
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param idFactory
|
||||
* the character id provider
|
||||
* @param templateIdFactory
|
||||
* the template id provider
|
||||
* @param accountIdFactory
|
||||
* the account id provider
|
||||
* @param clanIdFactory
|
||||
* the clan id provider
|
||||
*/
|
||||
@Inject
|
||||
public JDBCCharacterDAO(DatabaseService database,
|
||||
final CharacterIDProvider idFactory,
|
||||
|
||||
@@ -63,6 +63,11 @@ public abstract class JDBCCharacterFriendDAO extends
|
||||
public static final String CHAR_ID_FRIEND = JDBCCharacterDAO.CHAR_ID
|
||||
+ "_friend";
|
||||
|
||||
/**
|
||||
* @param database the database service
|
||||
* @param idProvider the frind id provider
|
||||
* @param charIdProvider the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public JDBCCharacterFriendDAO(DatabaseService database,
|
||||
final FriendIDProvider idProvider,
|
||||
|
||||
@@ -67,6 +67,14 @@ public abstract class JDBCChatMessageDAO extends
|
||||
public static final String DATE = "date";
|
||||
public static final String MESSAGE = "message";
|
||||
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param idFactory
|
||||
* the chat message id provider
|
||||
* @param charIdFactory
|
||||
* the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public JDBCChatMessageDAO(DatabaseService database,
|
||||
ChatMessageIDProvider idFactory,
|
||||
|
||||
@@ -61,6 +61,14 @@ public abstract class JDBCClanDAO extends AbstractJDBCDAO<Clan, ClanID>
|
||||
public static final String CLAN_ID = "clan_id";
|
||||
public static final String CHAR_ID_LEADER = "character_id_leader";
|
||||
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param clanIdFactory
|
||||
* the clan id provider
|
||||
* @param idFactory
|
||||
* the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public JDBCClanDAO(DatabaseService database, ClanIDProvider clanIdFactory,
|
||||
final CharacterIDProvider idFactory) {
|
||||
|
||||
@@ -79,6 +79,12 @@ public abstract class JDBCItemDAO extends AbstractJDBCDAO<Item, ItemID>
|
||||
public static final String COORD_Y = "coord_y";
|
||||
public static final String COORD_Z = "coord_z";
|
||||
|
||||
/**
|
||||
* @param database the database service
|
||||
* @param idFactory the item id provider
|
||||
* @param templateIdFactory the item template id provider
|
||||
* @param charIdFactory the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public JDBCItemDAO(DatabaseService database,
|
||||
final ItemIDProvider idFactory,
|
||||
|
||||
@@ -48,6 +48,9 @@ import com.l2jserver.util.geometry.Point3D;
|
||||
*/
|
||||
public abstract class JDBCNPCDAO extends AbstractJDBCDAO<NPC, NPCID> implements
|
||||
NPCDAO {
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
@@ -77,6 +80,14 @@ public abstract class JDBCNPCDAO extends AbstractJDBCDAO<NPC, NPCID> implements
|
||||
|
||||
public static final String RESPAWN_TIME = "respawn_time";
|
||||
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param idProvider
|
||||
* the npc id provider
|
||||
* @param templateIdProvider
|
||||
* the npc template id provider
|
||||
*/
|
||||
@Inject
|
||||
public JDBCNPCDAO(DatabaseService database, final NPCIDProvider idProvider,
|
||||
NPCTemplateIDProvider templateIdProvider) {
|
||||
|
||||
@@ -31,6 +31,18 @@ import com.l2jserver.service.database.jdbc.JDBCCharacterDAO;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class H2CharacterDAO extends JDBCCharacterDAO implements CharacterDAO {
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param idFactory
|
||||
* the character id provider
|
||||
* @param templateIdFactory
|
||||
* the template id provider
|
||||
* @param accountIdFactory
|
||||
* the account id provider
|
||||
* @param clanIdFactory
|
||||
* the clan id provider
|
||||
*/
|
||||
@Inject
|
||||
public H2CharacterDAO(DatabaseService database,
|
||||
CharacterIDProvider idFactory,
|
||||
|
||||
@@ -30,6 +30,11 @@ import com.l2jserver.service.database.jdbc.JDBCCharacterFriendDAO;
|
||||
*/
|
||||
public class H2CharacterFriendDAO extends JDBCCharacterFriendDAO implements
|
||||
CharacterFriendDAO {
|
||||
/**
|
||||
* @param database the database service
|
||||
* @param idProvider the frind id provider
|
||||
* @param charIdProvider the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public H2CharacterFriendDAO(DatabaseService database,
|
||||
FriendIDProvider idProvider, CharacterIDProvider charIdProvider) {
|
||||
|
||||
@@ -30,6 +30,14 @@ import com.l2jserver.service.database.jdbc.JDBCChatMessageDAO;
|
||||
*/
|
||||
public class H2ChatMessageDAO extends JDBCChatMessageDAO implements
|
||||
ChatMessageDAO {
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param idFactory
|
||||
* the chat message id provider
|
||||
* @param charIdFactory
|
||||
* the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public H2ChatMessageDAO(DatabaseService database,
|
||||
ChatMessageIDProvider idFactory, CharacterIDProvider charIdFactory) {
|
||||
|
||||
@@ -30,6 +30,14 @@ import com.l2jserver.service.database.jdbc.JDBCClanDAO;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class H2ClanDAO extends JDBCClanDAO implements ClanDAO {
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param clanIdFactory
|
||||
* the clan id provider
|
||||
* @param idFactory
|
||||
* the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public H2ClanDAO(DatabaseService database, ClanIDProvider clanIdFactory,
|
||||
CharacterIDProvider idFactory) {
|
||||
|
||||
@@ -30,6 +30,12 @@ import com.l2jserver.service.database.jdbc.JDBCItemDAO;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class H2ItemDAO extends JDBCItemDAO implements ItemDAO {
|
||||
/**
|
||||
* @param database the database service
|
||||
* @param idFactory the item id provider
|
||||
* @param templateIdFactory the item template id provider
|
||||
* @param charIdFactory the character id provider
|
||||
*/
|
||||
@Inject
|
||||
public H2ItemDAO(DatabaseService database, ItemIDProvider idFactory,
|
||||
ItemTemplateIDProvider templateIdFactory,
|
||||
|
||||
@@ -30,6 +30,11 @@ import com.l2jserver.service.database.jdbc.JDBCNPCDAO;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class H2NPCDAO extends JDBCNPCDAO implements NPCDAO {
|
||||
/**
|
||||
* @param database the database service
|
||||
* @param idProvider the npc id provider
|
||||
* @param templateIdProvider the npc template id provider
|
||||
*/
|
||||
@Inject
|
||||
public H2NPCDAO(DatabaseService database, NPCIDProvider idProvider,
|
||||
NPCTemplateIDProvider templateIdProvider) {
|
||||
|
||||
@@ -32,6 +32,18 @@ import com.l2jserver.service.database.jdbc.JDBCCharacterDAO;
|
||||
*/
|
||||
public class MySQL5CharacterDAO extends JDBCCharacterDAO implements
|
||||
CharacterDAO {
|
||||
/**
|
||||
* @param database
|
||||
* the database service
|
||||
* @param idFactory
|
||||
* the character id provider
|
||||
* @param templateIdFactory
|
||||
* the template id provider
|
||||
* @param accountIdFactory
|
||||
* the account id provider
|
||||
* @param clanIdFactory
|
||||
* the clan id provider
|
||||
*/
|
||||
@Inject
|
||||
public MySQL5CharacterDAO(DatabaseService database,
|
||||
CharacterIDProvider idFactory,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user