1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-06 07:32:46 +00:00

Code formatting

This commit is contained in:
2011-08-07 22:31:55 -03:00
parent 129b527a08
commit 074f216ffc
65 changed files with 378 additions and 393 deletions

View File

@@ -41,7 +41,7 @@ public class NPCAI extends AI<NPC> {
@Override @Override
protected void handleDesire(Desire desire) { protected void handleDesire(Desire desire) {
if (desire instanceof MoveDesire) { if (desire instanceof MoveDesire) {
} }
} }
} }

View File

@@ -147,7 +147,8 @@ public abstract class JDBCCharacterDAO extends
character.setAccountID(accountIdFactory.resolveID(rs character.setAccountID(accountIdFactory.resolveID(rs
.getString(ACCOUNT_ID))); .getString(ACCOUNT_ID)));
if (rs.getString(CLAN_ID) != null) if (rs.getString(CLAN_ID) != null)
character.setClanID(clanIdFactory.resolveID(rs.getInt(CLAN_ID))); character
.setClanID(clanIdFactory.resolveID(rs.getInt(CLAN_ID)));
character.setName(rs.getString(NAME)); character.setName(rs.getString(NAME));

View File

@@ -85,7 +85,7 @@ public abstract class JDBCChatMessageDAO extends
return idFactory.resolveID(rs.getInt(MESSAGE_ID)); return idFactory.resolveID(rs.getInt(MESSAGE_ID));
} }
}; };
/** /**
* The {@link Mapper} for {@link ChatMessageID} as a PRIMARY KEY * The {@link Mapper} for {@link ChatMessageID} as a PRIMARY KEY
*/ */

View File

@@ -41,8 +41,8 @@ import com.l2jserver.service.database.JDBCDatabaseService.SelectSingleQuery;
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public abstract class JDBCClanDAO extends AbstractJDBCDAO<Clan, ClanID> implements public abstract class JDBCClanDAO extends AbstractJDBCDAO<Clan, ClanID>
ClanDAO { implements ClanDAO {
/** /**
* The {@link ClanID} factory * The {@link ClanID} factory
*/ */
@@ -62,8 +62,8 @@ public abstract class JDBCClanDAO extends AbstractJDBCDAO<Clan, ClanID> implemen
public static final String CHAR_ID_LEADER = "character_id_leader"; public static final String CHAR_ID_LEADER = "character_id_leader";
@Inject @Inject
public JDBCClanDAO(DatabaseService database, public JDBCClanDAO(DatabaseService database, ClanIDProvider clanIdFactory,
ClanIDProvider clanIdFactory, final CharacterIDProvider idFactory) { final CharacterIDProvider idFactory) {
super(database); super(database);
this.idFactory = clanIdFactory; this.idFactory = clanIdFactory;
this.charIdFactory = idFactory; this.charIdFactory = idFactory;

View File

@@ -48,8 +48,8 @@ import com.l2jserver.util.geometry.Coordinate;
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public abstract class JDBCItemDAO extends AbstractJDBCDAO<Item, ItemID> implements public abstract class JDBCItemDAO extends AbstractJDBCDAO<Item, ItemID>
ItemDAO { implements ItemDAO {
/** /**
* The {@link ItemID} factory * The {@link ItemID} factory
*/ */

View File

@@ -232,7 +232,7 @@ public abstract class JDBCNPCDAO extends AbstractJDBCDAO<NPC, NPCID> implements
st.setInt(i++, npc.getPoint().getY()); st.setInt(i++, npc.getPoint().getY());
st.setInt(i++, npc.getPoint().getZ()); st.setInt(i++, npc.getPoint().getZ());
st.setDouble(i++, npc.getPoint().getAngle()); st.setDouble(i++, npc.getPoint().getAngle());
st.setLong(i++, npc.getRespawnInterval()); st.setLong(i++, npc.getRespawnInterval());
} }
}) > 0; }) > 0;
@@ -265,7 +265,7 @@ public abstract class JDBCNPCDAO extends AbstractJDBCDAO<NPC, NPCID> implements
st.setInt(i++, npc.getPoint().getY()); st.setInt(i++, npc.getPoint().getY());
st.setInt(i++, npc.getPoint().getZ()); st.setInt(i++, npc.getPoint().getZ());
st.setDouble(i++, npc.getPoint().getAngle()); st.setDouble(i++, npc.getPoint().getAngle());
st.setLong(i++, npc.getRespawnInterval()); st.setLong(i++, npc.getRespawnInterval());
// WHERE // WHERE

View File

@@ -30,8 +30,7 @@ import com.l2jserver.service.database.DatabaseService;
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class H2CharacterDAO extends JDBCCharacterDAO implements public class H2CharacterDAO extends JDBCCharacterDAO implements CharacterDAO {
CharacterDAO {
@Inject @Inject
public H2CharacterDAO(DatabaseService database, public H2CharacterDAO(DatabaseService database,
CharacterIDProvider idFactory, CharacterIDProvider idFactory,

View File

@@ -31,8 +31,8 @@ import com.l2jserver.service.database.DatabaseService;
*/ */
public class H2ClanDAO extends JDBCClanDAO implements ClanDAO { public class H2ClanDAO extends JDBCClanDAO implements ClanDAO {
@Inject @Inject
public H2ClanDAO(DatabaseService database, public H2ClanDAO(DatabaseService database, ClanIDProvider clanIdFactory,
ClanIDProvider clanIdFactory, CharacterIDProvider idFactory) { CharacterIDProvider idFactory) {
super(database, clanIdFactory, idFactory); super(database, clanIdFactory, idFactory);
} }
} }

View File

@@ -35,8 +35,7 @@ import com.l2jserver.util.html.markup.MarkupTag;
/** /**
* This handler dispatches the {@link ClientPacket#process(Lineage2Client)} * This handler dispatches the {@link ClientPacket#process(Lineage2Client)}
* method and creates a new {@link Lineage2Client} once a new channel is * method and creates a new {@link Lineage2Client} once a new channel is open.
* open.
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */

View File

@@ -101,8 +101,7 @@ public class CM_ATTACK extends AbstractClientPacket {
} }
@Inject @Inject
public CM_ATTACK(CharacterService charService, public CM_ATTACK(CharacterService charService, ObjectIDResolver idResolver) {
ObjectIDResolver idResolver) {
this.charService = charService; this.charService = charService;
this.idResolver = idResolver; this.idResolver = idResolver;
} }

View File

@@ -86,8 +86,8 @@ public class CM_AUTH_LOGIN extends AbstractClientPacket {
loginKey1, loginKey2)); loginKey1, loginKey2));
final List<L2Character> chars = characterDao.selectByAccount(accountId); final List<L2Character> chars = characterDao.selectByAccount(accountId);
conn.write(SM_CHAR_LIST.fromL2Session( conn.write(SM_CHAR_LIST.fromL2Session(conn.getSession(),
conn.getSession(), chars.toArray(new L2Character[chars.size()]))); chars.toArray(new L2Character[chars.size()])));
} }
/** /**

View File

@@ -41,7 +41,7 @@ import com.l2jserver.util.BufferUtils;
*/ */
public class CM_BYPASS extends AbstractClientPacket { public class CM_BYPASS extends AbstractClientPacket {
private final Logger log = LoggerFactory.getLogger(this.getClass()); private final Logger log = LoggerFactory.getLogger(this.getClass());
/** /**
* The packet OPCODE * The packet OPCODE
*/ */
@@ -62,8 +62,7 @@ public class CM_BYPASS extends AbstractClientPacket {
private String command; private String command;
@Inject @Inject
public CM_BYPASS(ObjectIDResolver idResolver, public CM_BYPASS(ObjectIDResolver idResolver, NPCService npcService) {
NPCService npcService) {
this.idResolver = idResolver; this.idResolver = idResolver;
this.npcService = npcService; this.npcService = npcService;
} }

View File

@@ -71,8 +71,7 @@ public class CM_CHAR_ACTION extends AbstractClientPacket {
} }
@Inject @Inject
public CM_CHAR_ACTION(ObjectIDResolver idResolver, public CM_CHAR_ACTION(ObjectIDResolver idResolver, NPCService npcService) {
NPCService npcService) {
this.idResolver = idResolver; this.idResolver = idResolver;
this.npcService = npcService; this.npcService = npcService;
} }

View File

@@ -32,7 +32,7 @@ public class CM_CHAR_OPEN_MAP extends AbstractClientPacket {
* The packet OPCODE * The packet OPCODE
*/ */
public static final int OPCODE = 0x6c; public static final int OPCODE = 0x6c;
@Override @Override
public void read(Lineage2Client conn, ChannelBuffer buffer) { public void read(Lineage2Client conn, ChannelBuffer buffer) {
} }

View File

@@ -64,7 +64,7 @@ public class CM_CHAT extends AbstractClientPacket {
this.message = BufferUtils.readString(buffer); this.message = BufferUtils.readString(buffer);
this.destination = ChatMessageType.fromID(buffer.readInt()); this.destination = ChatMessageType.fromID(buffer.readInt());
if (this.destination == ChatMessageType.TELL) { // private if (this.destination == ChatMessageType.TELL) { // private
// message // message
this.target = BufferUtils.readString(buffer); this.target = BufferUtils.readString(buffer);
} }
} }

View File

@@ -83,7 +83,7 @@ public class CM_ENTER_WORLD extends AbstractClientPacket {
} catch (SpawnPointNotFoundServiceException e) { } catch (SpawnPointNotFoundServiceException e) {
conn.sendActionFailed(); conn.sendActionFailed();
} catch (AlreadySpawnedServiceException e) { } catch (AlreadySpawnedServiceException e) {
//TODO send an error message here // TODO send an error message here
} }
} }
} }

View File

@@ -43,7 +43,7 @@ public class CM_EXT_REQ_MANOR_LIST extends AbstractClientPacket {
@Override @Override
public void process(final Lineage2Client conn) { public void process(final Lineage2Client conn) {
conn.write(new SM_MANOR_LIST("gludio", "dion", "giran", "oren", conn.write(new SM_MANOR_LIST("gludio", "dion", "giran", "oren", "aden",
"aden", "innadril", "goddard", "rune", "schuttgart")); "innadril", "goddard", "rune", "schuttgart"));
} }
} }

View File

@@ -61,7 +61,7 @@ public class CM_GOTO_LOBBY extends AbstractClientPacket {
public void process(final Lineage2Client conn) { public void process(final Lineage2Client conn) {
final List<L2Character> chars = characterDao.selectByAccount(conn final List<L2Character> chars = characterDao.selectByAccount(conn
.getSession().getAccountID()); .getSession().getAccountID());
conn.write(SM_CHAR_LIST.fromL2Session( conn.write(SM_CHAR_LIST.fromL2Session(conn.getSession(),
conn.getSession(), chars.toArray(new L2Character[0]))); chars.toArray(new L2Character[0])));
} }
} }

View File

@@ -38,8 +38,7 @@ public class CM_LOGOUT extends AbstractClientPacket {
/** /**
* The logger * The logger
*/ */
private static final Logger log = LoggerFactory private static final Logger log = LoggerFactory.getLogger(CM_LOGOUT.class);
.getLogger(CM_LOGOUT.class);
@Override @Override
public void read(Lineage2Client conn, ChannelBuffer buffer) { public void read(Lineage2Client conn, ChannelBuffer buffer) {

View File

@@ -54,16 +54,14 @@ public class SM_CHAT extends AbstractServerPacket {
*/ */
private int messageID = 0; private int messageID = 0;
public SM_CHAT(Actor character, ChatMessageType destination, public SM_CHAT(Actor character, ChatMessageType destination, String message) {
String message) {
super(OPCODE); super(OPCODE);
this.actor = character; this.actor = character;
this.destination = destination; this.destination = destination;
this.message = message; this.message = message;
} }
public SM_CHAT(Actor actor, ChatMessageType destination, public SM_CHAT(Actor actor, ChatMessageType destination, int messageID) {
int messageID) {
super(OPCODE); super(OPCODE);
this.actor = actor; this.actor = actor;
this.destination = destination; this.destination = destination;

View File

@@ -48,11 +48,11 @@ public class SM_NPC_INFO extends AbstractServerPacket {
buffer.writeInt(npc.getID().getID()); buffer.writeInt(npc.getID().getID());
buffer.writeInt(template.getID().getID() + 1000000); // npctype id buffer.writeInt(template.getID().getID() + 1000000); // npctype id
//if (npc instanceof NPC) { // if (npc instanceof NPC) {
buffer.writeInt((template.isAttackable() ? 0x01 : 0x00)); buffer.writeInt((template.isAttackable() ? 0x01 : 0x00));
//} else { // } else {
// buffer.writeInt(0x01); // buffer.writeInt(0x01);
//} // }
buffer.writeInt(npc.getPoint().getX()); buffer.writeInt(npc.getPoint().getX());
buffer.writeInt(npc.getPoint().getY()); buffer.writeInt(npc.getPoint().getY());
buffer.writeInt(npc.getPoint().getZ()); buffer.writeInt(npc.getPoint().getZ());

View File

@@ -30,7 +30,7 @@ public class CharacterFriend extends AbstractModel<FriendID> {
public CharacterFriend(FriendID id) { public CharacterFriend(FriendID id) {
this.setID(id); this.setID(id);
} }
public CharacterID getCharacterID() { public CharacterID getCharacterID() {
return id.getID1(); return id.getID1();
} }

View File

@@ -134,7 +134,7 @@ public class BitSetIDAllocator implements IDAllocator {
lock.unlock(); lock.unlock();
} }
} }
@Override @Override
public void clear() { public void clear() {
ids.clear(); ids.clear();

View File

@@ -67,7 +67,7 @@ public class ItemIDProvider implements ObjectIDProvider<ItemID> {
} }
return idObject; return idObject;
} }
@Override @Override
public void destroy(ItemID id) { public void destroy(ItemID id) {
idService.remove(id); idService.remove(id);

View File

@@ -30,8 +30,7 @@ import com.l2jserver.service.game.template.TemplateService;
*/ */
public class CharacterTemplateID extends ActorTemplateID<CharacterTemplate> { public class CharacterTemplateID extends ActorTemplateID<CharacterTemplate> {
@Inject @Inject
public CharacterTemplateID(@Assisted int id, public CharacterTemplateID(@Assisted int id, TemplateService templateService) {
TemplateService templateService) {
super(id, templateService); super(id, templateService);
} }
} }

View File

@@ -28,254 +28,256 @@ public class PhysicalAttackCalculator extends AttackCalculator {
super(new AttackCalculatorFunction(0x000, AttackCalculatorType.DAMAGE) { super(new AttackCalculatorFunction(0x000, AttackCalculatorType.DAMAGE) {
@Override @Override
public double calculate(Actor attacker, Actor target, double value) { public double calculate(Actor attacker, Actor target, double value) {
// // final boolean isPvP = (attacker instanceof L2Playable) && // // final boolean isPvP = (attacker instanceof L2Playable) &&
// // (target instanceof L2Playable); // // (target instanceof L2Playable);
// // TODO soulshot charge // // TODO soulshot charge
// boolean soulshot = false; // boolean soulshot = false;
// //
// double damage = attacker.getStats().getPhysicalAttack(); // double damage = attacker.getStats().getPhysicalAttack();
// double defense = target.getStats().getPhysicalDefense(); // double defense = target.getStats().getPhysicalDefense();
// // damage += calcValakasAttribute(attacker, target, skill); // // damage += calcValakasAttribute(attacker, target, skill);
// // if (attacker instanceof NPC) { // // if (attacker instanceof NPC) {
// // if (((NPC) attacker)._soulshotcharged) { // // if (((NPC) attacker)._soulshotcharged) {
// // ss = true; // // ss = true;
// // } else // // } else
// // ss = false; // // ss = false;
// // ((L2Npc) attacker)._soulshotcharged = false; // // ((L2Npc) attacker)._soulshotcharged = false;
// // } // // }
// // TODO implement pvp // // TODO implement pvp
// // Def bonusses in PvP fight // // Def bonusses in PvP fight
// // if (isPvP) { // // if (isPvP) {
// // if (skill == null) // // if (skill == null)
// // defence *= target.calcStat(Stats.PVP_PHYSICAL_DEF, 1, // // defence *= target.calcStat(Stats.PVP_PHYSICAL_DEF, 1,
// // null, null); // // null, null);
// // else // // else
// // defence *= target.calcStat(Stats.PVP_PHYS_SKILL_DEF, 1, // // defence *= target.calcStat(Stats.PVP_PHYS_SKILL_DEF, 1,
// // null, null); // // null, null);
// // } // // }
// //
// // TODO implement shield // // TODO implement shield
// // switch (shld) { // // switch (shld) {
// // case SHIELD_DEFENSE_SUCCEED: // // case SHIELD_DEFENSE_SUCCEED:
// // if (!Config.ALT_GAME_SHIELD_BLOCKS) // // if (!Config.ALT_GAME_SHIELD_BLOCKS)
// // defense += target.getShldDef(); // // defense += target.getShldDef();
// // break; // // break;
// // case SHIELD_DEFENSE_PERFECT_BLOCK: // perfect block // // case SHIELD_DEFENSE_PERFECT_BLOCK: // perfect block
// // return 1.; // // return 1.;
// // } // // }
// //
// if (soulshot) // if (soulshot)
// damage *= 2; // damage *= 2;
// // if (skill != null) { // // if (skill != null) {
// // double skillpower = skill.getPower(attacker, target, isPvP); // // double skillpower = skill.getPower(attacker, target,
// // float ssboost = skill.getSSBoost(); // isPvP);
// // if (ssboost <= 0) // // float ssboost = skill.getSSBoost();
// // damage += skillpower; // // if (ssboost <= 0)
// // else if (ssboost > 0) { // // damage += skillpower;
// // if (ss) { // // else if (ssboost > 0) {
// // skillpower *= ssboost; // // if (ss) {
// // damage += skillpower; // // skillpower *= ssboost;
// // } else // // damage += skillpower;
// // damage += skillpower; // // } else
// // } // // damage += skillpower;
// // } // // }
// // // }
// // defense modifier depending of the attacker weapon //
// //ItemTemplate weapon = attacker.getActiveWeaponItem(); // // defense modifier depending of the attacker weapon
// boolean isBow = false; // //ItemTemplate weapon = attacker.getActiveWeaponItem();
// if (weapon != null/* && !attacker.isTransformed() */) { // boolean isBow = false;
// switch (null) { // if (weapon != null/* && !attacker.isTransformed() */) {
// case BOW: // switch (null) {
// isBow = true; // case BOW:
// stat = StatType.BOW_WPN_VULN; // isBow = true;
// break; // stat = StatType.BOW_WPN_VULN;
// case CROSSBOW: // break;
// isBow = true; // case CROSSBOW:
// stat = StatType.CROSSBOW_WPN_VULN; // isBow = true;
// break; // stat = StatType.CROSSBOW_WPN_VULN;
// case BLUNT: // break;
// stat = StatType.BLUNT_WPN_VULN; // case BLUNT:
// break; // stat = StatType.BLUNT_WPN_VULN;
// case DAGGER: // break;
// stat = StatType.DAGGER_WPN_VULN; // case DAGGER:
// break; // stat = StatType.DAGGER_WPN_VULN;
// case DUAL: // break;
// stat = StatType.DUAL_WPN_VULN; // case DUAL:
// break; // stat = StatType.DUAL_WPN_VULN;
// case DUALFIST: // break;
// stat = StatType.DUALFIST_WPN_VULN; // case DUALFIST:
// break; // stat = StatType.DUALFIST_WPN_VULN;
// case ETC: // break;
// stat = StatType.ETC_WPN_VULN; // case ETC:
// break; // stat = StatType.ETC_WPN_VULN;
// case FIST: // break;
// stat = StatType.FIST_WPN_VULN; // case FIST:
// break; // stat = StatType.FIST_WPN_VULN;
// case POLE: // break;
// stat = StatType.POLE_WPN_VULN; // case POLE:
// break; // stat = StatType.POLE_WPN_VULN;
// case SWORD: // break;
// stat = StatType.SWORD_WPN_VULN; // case SWORD:
// break; // stat = StatType.SWORD_WPN_VULN;
// case BIGSWORD: // break;
// stat = StatType.BIGSWORD_WPN_VULN; // case BIGSWORD:
// break; // stat = StatType.BIGSWORD_WPN_VULN;
// case BIGBLUNT: // break;
// stat = StatType.BIGBLUNT_WPN_VULN; // case BIGBLUNT:
// break; // stat = StatType.BIGBLUNT_WPN_VULN;
// case DUALDAGGER: // break;
// stat = StatType.DUALDAGGER_WPN_VULN; // case DUALDAGGER:
// break; // stat = StatType.DUALDAGGER_WPN_VULN;
// case RAPIER: // break;
// stat = StatType.RAPIER_WPN_VULN; // case RAPIER:
// break; // stat = StatType.RAPIER_WPN_VULN;
// case ANCIENTSWORD: // break;
// stat = StatType.ANCIENT_WPN_VULN; // case ANCIENTSWORD:
// break; // stat = StatType.ANCIENT_WPN_VULN;
// /* // break;
// * case PET: stat = Stats.PET_WPN_VULN; break; // /*
// */ // * case PET: stat = Stats.PET_WPN_VULN; break;
// } // */
// } // }
// // }
// // for summon use pet weapon vuln, since they cant hold weapon //
// // if (attacker instanceof L2SummonInstance) // // for summon use pet weapon vuln, since they cant hold
// // stat = Stats.PET_WPN_VULN; // weapon
// // // if (attacker instanceof L2SummonInstance)
// // if (crit) { // // stat = Stats.PET_WPN_VULN;
// // // Finally retail like formula //
// // damage = 2 // // if (crit) {
// // * attacker.calcStat(Stats.CRITICAL_DAMAGE, 1, // // // Finally retail like formula
// // target, skill) // // damage = 2
// // * target.calcStat(Stats.CRIT_VULN, // // * attacker.calcStat(Stats.CRITICAL_DAMAGE, 1,
// // target.getTemplate().baseCritVuln, target, // // target, skill)
// // null) * (70 * damage / defense); // // * target.calcStat(Stats.CRIT_VULN,
// // // Crit dmg add is almost useless in normal hits... // // target.getTemplate().baseCritVuln, target,
// // damage += (attacker.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0, // // null) * (70 * damage / defense);
// // target, skill) * 70 / defense); // // // Crit dmg add is almost useless in normal hits...
// // } else // // damage += (attacker.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0,
// // damage = 70 * damage / defense; // // target, skill) * 70 / defense);
// // // } else
// if (stat != null) { // // damage = 70 * damage / defense;
// // get the vulnerability due to skills (buffs, passives, //
// // toggles, etc) // if (stat != null) {
// damage = target.calcStat(stat, damage, target, null); // // get the vulnerability due to skills (buffs, passives,
// /* // // toggles, etc)
// * if (target instanceof L2Npc) { // get the natural // damage = target.calcStat(stat, damage, target, null);
// * vulnerability for the template damage *= ((L2Npc) // /*
// * target).getTemplate().getVulnerability(stat); } // * if (target instanceof L2Npc) { // get the natural
// */ // * vulnerability for the template damage *= ((L2Npc)
// } // * target).getTemplate().getVulnerability(stat); }
// // */
// // Weapon random damage // }
// damage *= attacker.getRandomDamageMultiplier(); //
// // // Weapon random damage
// // damage += Rnd.nextDouble() * damage / 10; // damage *= attacker.getRandomDamageMultiplier();
// // damage += _rnd.nextDouble()* //
// // attacker.getRandomDamage(target); // // damage += Rnd.nextDouble() * damage / 10;
// // } // // damage += _rnd.nextDouble()*
// if (shld > 0 && Config.ALT_GAME_SHIELD_BLOCKS) { // // attacker.getRandomDamage(target);
// damage -= target.getShldDef(); // // }
// if (damage < 0) // if (shld > 0 && Config.ALT_GAME_SHIELD_BLOCKS) {
// damage = 0; // damage -= target.getShldDef();
// } // if (damage < 0)
// // damage = 0;
// if (target instanceof L2Npc) { // }
// switch (((L2Npc) target).getTemplate().getRace()) { //
// case BEAST: // if (target instanceof L2Npc) {
// damage *= attacker.getPAtkMonsters(target); // switch (((L2Npc) target).getTemplate().getRace()) {
// break; // case BEAST:
// case ANIMAL: // damage *= attacker.getPAtkMonsters(target);
// damage *= attacker.getPAtkAnimals(target); // break;
// break; // case ANIMAL:
// case PLANT: // damage *= attacker.getPAtkAnimals(target);
// damage *= attacker.getPAtkPlants(target); // break;
// break; // case PLANT:
// case DRAGON: // damage *= attacker.getPAtkPlants(target);
// damage *= attacker.getPAtkDragons(target); // break;
// break; // case DRAGON:
// case BUG: // damage *= attacker.getPAtkDragons(target);
// damage *= attacker.getPAtkInsects(target); // break;
// break; // case BUG:
// case GIANT: // damage *= attacker.getPAtkInsects(target);
// damage *= attacker.getPAtkGiants(target); // break;
// break; // case GIANT:
// case MAGICCREATURE: // damage *= attacker.getPAtkGiants(target);
// damage *= attacker.getPAtkMagicCreatures(target); // break;
// break; // case MAGICCREATURE:
// default: // damage *= attacker.getPAtkMagicCreatures(target);
// // nothing // break;
// break; // default:
// } // // nothing
// } // break;
// // }
// if (damage > 0 && damage < 1) { // }
// damage = 1; //
// } else if (damage < 0) { // if (damage > 0 && damage < 1) {
// damage = 0; // damage = 1;
// } // } else if (damage < 0) {
// // damage = 0;
// // Dmg bonusses in PvP fight // }
// if (isPvP) { //
// if (skill == null) // // Dmg bonusses in PvP fight
// damage *= attacker.calcStat(Stats.PVP_PHYSICAL_DMG, 1, // if (isPvP) {
// null, null); // if (skill == null)
// else // damage *= attacker.calcStat(Stats.PVP_PHYSICAL_DMG, 1,
// damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG, // null, null);
// 1, null, null); // else
// } // damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG,
// // 1, null, null);
// // Physical skill dmg boost // }
// if (skill != null) //
// damage *= attacker.calcStat(Stats.PHYSICAL_SKILL_POWER, 1, // // Physical skill dmg boost
// null, null); // if (skill != null)
// // damage *= attacker.calcStat(Stats.PHYSICAL_SKILL_POWER, 1,
// damage *= calcElemental(attacker, target, skill); // null, null);
// if (target instanceof L2Attackable) { //
// if (isBow) { // damage *= calcElemental(attacker, target, skill);
// if (skill != null) // if (target instanceof L2Attackable) {
// damage *= attacker.calcStat( // if (isBow) {
// Stats.PVE_BOW_SKILL_DMG, 1, null, null); // if (skill != null)
// else // damage *= attacker.calcStat(
// damage *= attacker.calcStat(Stats.PVE_BOW_DMG, 1, // Stats.PVE_BOW_SKILL_DMG, 1, null, null);
// null, null); // else
// } else // damage *= attacker.calcStat(Stats.PVE_BOW_DMG, 1,
// damage *= attacker.calcStat(Stats.PVE_PHYSICAL_DMG, 1, // null, null);
// null, null); // } else
// if (!target.isRaid() // damage *= attacker.calcStat(Stats.PVE_PHYSICAL_DMG, 1,
// && !target.isRaidMinion() // null, null);
// && target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY // if (!target.isRaid()
// && attacker.getActingPlayer() != null // && !target.isRaidMinion()
// && (target.getLevel() - attacker.getActingPlayer() // && target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY
// .getLevel()) >= 2) { // && attacker.getActingPlayer() != null
// int lvlDiff = target.getLevel() // && (target.getLevel() - attacker.getActingPlayer()
// - attacker.getActingPlayer().getLevel() - 1; // .getLevel()) >= 2) {
// if (skill != null) { // int lvlDiff = target.getLevel()
// if (lvlDiff > Config.NPC_SKILL_DMG_PENALTY.size()) // - attacker.getActingPlayer().getLevel() - 1;
// damage *= Config.NPC_SKILL_DMG_PENALTY // if (skill != null) {
// .get(Config.NPC_SKILL_DMG_PENALTY // if (lvlDiff > Config.NPC_SKILL_DMG_PENALTY.size())
// .size()); // damage *= Config.NPC_SKILL_DMG_PENALTY
// else // .get(Config.NPC_SKILL_DMG_PENALTY
// damage *= Config.NPC_SKILL_DMG_PENALTY // .size());
// .get(lvlDiff); // else
// } else if (crit) { // damage *= Config.NPC_SKILL_DMG_PENALTY
// if (lvlDiff > Config.NPC_CRIT_DMG_PENALTY.size()) // .get(lvlDiff);
// damage *= Config.NPC_CRIT_DMG_PENALTY // } else if (crit) {
// .get(Config.NPC_CRIT_DMG_PENALTY.size()); // if (lvlDiff > Config.NPC_CRIT_DMG_PENALTY.size())
// else // damage *= Config.NPC_CRIT_DMG_PENALTY
// damage *= Config.NPC_CRIT_DMG_PENALTY // .get(Config.NPC_CRIT_DMG_PENALTY.size());
// .get(lvlDiff); // else
// } else { // damage *= Config.NPC_CRIT_DMG_PENALTY
// if (lvlDiff > Config.NPC_DMG_PENALTY.size()) // .get(lvlDiff);
// damage *= Config.NPC_DMG_PENALTY // } else {
// .get(Config.NPC_DMG_PENALTY.size()); // if (lvlDiff > Config.NPC_DMG_PENALTY.size())
// else // damage *= Config.NPC_DMG_PENALTY
// damage *= Config.NPC_DMG_PENALTY.get(lvlDiff); // .get(Config.NPC_DMG_PENALTY.size());
// } // else
// } // damage *= Config.NPC_DMG_PENALTY.get(lvlDiff);
// } // }
// // }
// return damage; // }
//
// return damage;
return 10; return 10;
} }
}, new AttackCalculatorFunction(Integer.MAX_VALUE, }, new AttackCalculatorFunction(Integer.MAX_VALUE,

View File

@@ -16,7 +16,6 @@
*/ */
package com.l2jserver.model.template; package com.l2jserver.model.template;
/** /**
* Template for an Aumentation * Template for an Aumentation
* *

View File

@@ -25,5 +25,5 @@ import com.l2jserver.model.template.Template;
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public interface Dropable extends TemplateCapability { public interface Dropable extends TemplateCapability {
} }

View File

@@ -25,5 +25,5 @@ import com.l2jserver.model.template.Template;
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public interface Enchantable extends TemplateCapability { public interface Enchantable extends TemplateCapability {
} }

View File

@@ -25,5 +25,5 @@ import com.l2jserver.model.template.Template;
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public interface Sellable extends TemplateCapability { public interface Sellable extends TemplateCapability {
} }

View File

@@ -6,8 +6,7 @@ package com.l2jserver.model.template.character;
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public enum CharacterRace { public enum CharacterRace {
HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL( HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(0x05);
0x05);
/** /**
* The numeric ID representing this race * The numeric ID representing this race

View File

@@ -230,7 +230,7 @@ public class L2Character extends Player {
desireUpdate(); desireUpdate();
this.petID = petID; this.petID = petID;
} }
/** /**
* @return the race * @return the race
*/ */

View File

@@ -84,7 +84,9 @@ public class Pet extends Player {
this.itemID = itemID; this.itemID = itemID;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see com.l2jserver.model.world.Actor#getStats() * @see com.l2jserver.model.world.Actor#getStats()
*/ */
@Override @Override

View File

@@ -95,7 +95,7 @@ public class CharacterShortcutContainer implements Iterable<Shortcut> {
shortcut1.setPage(shortcut2.getPage()); shortcut1.setPage(shortcut2.getPage());
shortcut2.setSlot(slot1); shortcut2.setSlot(slot1);
shortcut2.setPage(page1); shortcut2.setPage(page1);
Collections.sort(shortcuts, new ShortcutSlotComparator()); Collections.sort(shortcuts, new ShortcutSlotComparator());
} }
@@ -137,7 +137,8 @@ public class CharacterShortcutContainer implements Iterable<Shortcut> {
return character; return character;
} }
public static class ShortcutSlotComparator implements Comparator<Shortcut>, Serializable { public static class ShortcutSlotComparator implements Comparator<Shortcut>,
Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override

View File

@@ -297,8 +297,7 @@ public class CharacterStats extends ActorStats<CharacterCalculatorContext> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void setup() { private void setup() {
calculator.addNoSort(BASE_HP_FORMULA, BASE_MP_FORMULA, calculator.addNoSort(BASE_HP_FORMULA, BASE_MP_FORMULA, BASE_CP_FORMULA);
BASE_CP_FORMULA);
calculator.addNoSort(BASE_INT_FORMULA, BASE_STR_FORMULA, calculator.addNoSort(BASE_INT_FORMULA, BASE_STR_FORMULA,
BASE_CON_FORMULA, BASE_MEN_FORMULA, BASE_DEX_FORMULA, BASE_CON_FORMULA, BASE_MEN_FORMULA, BASE_DEX_FORMULA,

View File

@@ -45,8 +45,7 @@ public class CharacterTargetSelectedEvent implements CharacterEvent {
* @param target * @param target
* the character target * the character target
*/ */
public CharacterTargetSelectedEvent(L2Character character, public CharacterTargetSelectedEvent(L2Character character, Actor target) {
Actor target) {
this.character = character; this.character = character;
this.target = target; this.target = target;
} }

View File

@@ -226,8 +226,7 @@ public class NPCStats extends ActorStats<NPCCalculatorContext> {
BASE_CON_FORMULA, BASE_MEN_FORMULA, BASE_DEX_FORMULA, BASE_CON_FORMULA, BASE_MEN_FORMULA, BASE_DEX_FORMULA,
BASE_WIT_FORMULA); BASE_WIT_FORMULA);
calculator.addNoSort(BASE_RUN_SPEED_FORMULA, calculator.addNoSort(BASE_RUN_SPEED_FORMULA, BASE_WALK_SPEED_FORMULA);
BASE_WALK_SPEED_FORMULA);
calculator.addNoSort(BASE_PHYSICAL_ATTACK_FORMULA, calculator.addNoSort(BASE_PHYSICAL_ATTACK_FORMULA,
BASE_PHYSICAL_ATTACK_SPEED_FORMULA, BASE_PHYSICAL_ATTACK_SPEED_FORMULA,

View File

@@ -80,8 +80,8 @@ public class BaseNPCController implements NPCController {
* @return true if chat message was sent * @return true if chat message was sent
* @throws L2Exception * @throws L2Exception
*/ */
protected boolean talk(NPC npc, Lineage2Client conn, protected boolean talk(NPC npc, Lineage2Client conn, L2Character character,
L2Character character, String... args) throws L2Exception { String... args) throws L2Exception {
String id = null; String id = null;
if (args.length >= 1) { if (args.length >= 1) {
id = args[0]; id = args[0];

View File

@@ -114,8 +114,7 @@ public class ServiceManager {
serviceClass.getSimpleName()); serviceClass.getSimpleName());
stopDependencies(service); stopDependencies(service);
service.stop(); service.stop();
logger.info("{0}: Service stopped!", logger.info("{0}: Service stopped!", serviceClass.getSimpleName());
serviceClass.getSimpleName());
} catch (ServiceStopException e) { } catch (ServiceStopException e) {
logger.error("{0}: Error stopping service: {1}", logger.error("{0}: Error stopping service: {1}",
serviceClass.getSimpleName(), e.getCause()); serviceClass.getSimpleName(), e.getCause());
@@ -163,8 +162,7 @@ public class ServiceManager {
logger.debug("{0}: Restaring service...", logger.debug("{0}: Restaring service...",
serviceClass.getSimpleName()); serviceClass.getSimpleName());
service.restart(); service.restart();
logger.info("{0}: Service restarted!", logger.info("{0}: Service restarted!", serviceClass.getSimpleName());
serviceClass.getSimpleName());
return service; return service;
} catch (ServiceStartException e) { } catch (ServiceStartException e) {
logger.error("{0}: Error starting service: {1}", logger.error("{0}: Error starting service: {1}",

View File

@@ -35,7 +35,8 @@ import com.l2jserver.service.ServiceStartException;
import com.l2jserver.service.ServiceStopException; import com.l2jserver.service.ServiceStopException;
/** /**
* Simple cache that stores invocation results in a EhCache {@link Cache}. * Simple cache that stores invocation results in a EhCache
* {@link net.sf.ehcache.Cache Cache}.
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
@@ -62,7 +63,7 @@ public class EhCacheService extends AbstractService implements CacheService {
Preconditions.checkNotNull(interfaceType, "interfaceType"); Preconditions.checkNotNull(interfaceType, "interfaceType");
Preconditions.checkNotNull(instance, "instance"); Preconditions.checkNotNull(instance, "instance");
Preconditions.checkArgument(interfaceType.isInterface(), Preconditions.checkArgument(interfaceType.isInterface(),
"interfaceType is not an interface"); "interfaceType is not an interface");
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final T proxy = (T) Proxy.newProxyInstance(this.getClass() final T proxy = (T) Proxy.newProxyInstance(this.getClass()

View File

@@ -252,7 +252,7 @@ public class ProxyConfigurationService extends AbstractService implements
if (config == null) { if (config == null) {
for (final Class<?> parent : clazz.getInterfaces()) { for (final Class<?> parent : clazz.getInterfaces()) {
prop = findProperties(parent); prop = findProperties(parent);
if(prop != null) if (prop != null)
return prop; return prop;
} }
return null; return null;

View File

@@ -30,8 +30,8 @@ import com.l2jserver.service.Service;
* The service does not directly provide much functionality most of its * The service does not directly provide much functionality most of its
* operations are done trough an {@link DataAccessObject}. Each service * operations are done trough an {@link DataAccessObject}. Each service
* implementation provides an custom interface that is used to link * implementation provides an custom interface that is used to link
* {@link DataAccessObject}-{@link DatabaseService Service}. See implementation specific * {@link DataAccessObject}-{@link DatabaseService Service}. See implementation
* documentation for more information. * specific documentation for more information.
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */

View File

@@ -86,7 +86,7 @@ public interface JDBCDatabaseConfiguration extends DatabaseConfiguration {
*/ */
@ConfigurationPropertySetter(name = "jdbc.active.max") @ConfigurationPropertySetter(name = "jdbc.active.max")
void setMaxActiveConnections(int password); void setMaxActiveConnections(int password);
/** /**
* @return the maximum number of idle connections * @return the maximum number of idle connections
*/ */
@@ -99,7 +99,7 @@ public interface JDBCDatabaseConfiguration extends DatabaseConfiguration {
*/ */
@ConfigurationPropertySetter(name = "jdbc.idle.max") @ConfigurationPropertySetter(name = "jdbc.idle.max")
void setMaxIdleConnections(int password); void setMaxIdleConnections(int password);
/** /**
* @return the minimum number of idle connections * @return the minimum number of idle connections
*/ */

View File

@@ -24,5 +24,5 @@ import com.l2jserver.service.Service;
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public interface PvPService extends Service { public interface PvPService extends Service {
} }

View File

@@ -38,8 +38,8 @@ public interface AdministratorService extends Service {
* @param args * @param args
* the arguments * the arguments
*/ */
void command(Lineage2Client conn, L2Character character, void command(Lineage2Client conn, L2Character character, String command,
String command, String... args); String... args);
/** /**
* The base interface for Administrator commands * The base interface for Administrator commands

View File

@@ -70,16 +70,16 @@ public class AIServiceImpl extends AbstractService implements AIService {
@Override @Override
protected void doStart() throws ServiceStartException { protected void doStart() throws ServiceStartException {
} }
@Override @Override
public void walk(Actor actor, Coordinate coordinate) { public void walk(Actor actor, Coordinate coordinate) {
} }
@Override @Override
protected void doStop() throws ServiceStopException { protected void doStop() throws ServiceStopException {
} }
} }

View File

@@ -21,7 +21,6 @@ package com.l2jserver.service.game.character;
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class CannotSetTargetServiceException extends public class CannotSetTargetServiceException extends CharacterServiceException {
CharacterServiceException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@@ -21,7 +21,6 @@ package com.l2jserver.service.game.character;
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class CharacterInJailServiceException extends public class CharacterInJailServiceException extends CharacterServiceException {
CharacterServiceException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@@ -185,8 +185,7 @@ public class CharacterServiceImpl extends AbstractService implements
}); });
// register global chat listener // register global chat listener
chatService.getGlobalChannel().addMessageListener( chatService.getGlobalChannel().addMessageListener(globalChatListener);
globalChatListener);
chatService.getTradeChannel().addMessageListener(tradeChatListener); chatService.getTradeChannel().addMessageListener(tradeChatListener);
// query client game guard -- if key is invalid, the connection will be // query client game guard -- if key is invalid, the connection will be

View File

@@ -16,14 +16,11 @@
*/ */
package com.l2jserver.service.game.chat; package com.l2jserver.service.game.chat;
/** /**
* Exception thrown if the player trying to send a message is currently * Exception thrown if the player trying to send a message is currently banned.
* banned.
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class ChatBanActiveChatServiceException extends public class ChatBanActiveChatServiceException extends ChatServiceException {
ChatServiceException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@@ -327,10 +327,11 @@ public class SimpleChatService extends AbstractService implements ChatService {
public ChatMessageType getMessageType() { public ChatMessageType getMessageType() {
return ChatMessageType.ALL; return ChatMessageType.ALL;
} }
@Override @Override
public void dispose() { public void dispose() {
throw new UnsupportedOperationException("Cannot dispose the Global Chat Channel"); throw new UnsupportedOperationException(
"Cannot dispose the Global Chat Channel");
} }
} }
@@ -345,10 +346,11 @@ public class SimpleChatService extends AbstractService implements ChatService {
public ChatMessageType getMessageType() { public ChatMessageType getMessageType() {
return ChatMessageType.TRADE; return ChatMessageType.TRADE;
} }
@Override @Override
public void dispose() { public void dispose() {
throw new UnsupportedOperationException("Cannot dispose the Trade Chat Channel"); throw new UnsupportedOperationException(
"Cannot dispose the Trade Chat Channel");
} }
} }
@@ -363,10 +365,11 @@ public class SimpleChatService extends AbstractService implements ChatService {
public ChatMessageType getMessageType() { public ChatMessageType getMessageType() {
return ChatMessageType.ANNOUNCEMENT; return ChatMessageType.ANNOUNCEMENT;
} }
@Override @Override
public void dispose() { public void dispose() {
throw new UnsupportedOperationException("Cannot dispose the Announcement Chat Channel"); throw new UnsupportedOperationException(
"Cannot dispose the Announcement Chat Channel");
} }
} }
@@ -396,7 +399,7 @@ public class SimpleChatService extends AbstractService implements ChatService {
public ChatMessageType getMessageType() { public ChatMessageType getMessageType() {
return ChatMessageType.CLAN; return ChatMessageType.CLAN;
} }
@Override @Override
public void dispose() { public void dispose() {
clanChannels.remove(clanID); clanChannels.remove(clanID);
@@ -430,7 +433,7 @@ public class SimpleChatService extends AbstractService implements ChatService {
public ChatMessageType getMessageType() { public ChatMessageType getMessageType() {
return ChatMessageType.ALL; return ChatMessageType.ALL;
} }
@Override @Override
public void dispose() { public void dispose() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View File

@@ -24,5 +24,5 @@ import com.l2jserver.service.Service;
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public interface MapService extends Service { public interface MapService extends Service {
} }

View File

@@ -142,8 +142,7 @@ public class NPCServiceImpl extends AbstractService implements NPCService {
Preconditions.checkNotNull(character, "character"); Preconditions.checkNotNull(character, "character");
Preconditions.checkNotNull(action, "action"); Preconditions.checkNotNull(action, "action");
final Lineage2Client conn = networkService.discover(character final Lineage2Client conn = networkService.discover(character.getID());
.getID());
try { try {
final NPCController controller = getController(npc); final NPCController controller = getController(npc);
controller.action(npc, conn, character, new String[0]); controller.action(npc, conn, character, new String[0]);
@@ -160,8 +159,7 @@ public class NPCServiceImpl extends AbstractService implements NPCService {
if (args == null) if (args == null)
args = new String[0]; args = new String[0];
final Lineage2Client conn = networkService.discover(character final Lineage2Client conn = networkService.discover(character.getID());
.getID());
try { try {
final NPCController controller = getController(npc); final NPCController controller = getController(npc);
controller.action(npc, conn, character, args); controller.action(npc, conn, character, args);

View File

@@ -197,8 +197,9 @@ public class ClassFileManager extends
* if something foes wrong * if something foes wrong
*/ */
@Override @Override
public synchronized Iterable<JavaFileObject> list(Location location, String packageName, public synchronized Iterable<JavaFileObject> list(Location location,
Set<Kind> kinds, boolean recurse) throws IOException { String packageName, Set<Kind> kinds, boolean recurse)
throws IOException {
Iterable<JavaFileObject> objects = super.list(location, packageName, Iterable<JavaFileObject> objects = super.list(location, packageName,
kinds, recurse); kinds, recurse);

View File

@@ -16,7 +16,6 @@
*/ */
package com.l2jserver.service.game.spawn; package com.l2jserver.service.game.spawn;
/** /**
* Exception thrown when the object is already spawned and registered in the * Exception thrown when the object is already spawned and registered in the
* world * world

View File

@@ -16,7 +16,6 @@
*/ */
package com.l2jserver.service.game.spawn; package com.l2jserver.service.game.spawn;
/** /**
* Exception thrown when trying to unspawn an object that is not spawned * Exception thrown when trying to unspawn an object that is not spawned
* *

View File

@@ -135,14 +135,13 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService {
Preconditions.checkNotNull(object, "object"); Preconditions.checkNotNull(object, "object");
Preconditions.checkArgument(time > 0, "time < 0"); Preconditions.checkArgument(time > 0, "time < 0");
Preconditions.checkNotNull(unit, "unit"); Preconditions.checkNotNull(unit, "unit");
return threadService.async(time, unit, return threadService.async(time, unit, new Callable<T>() {
new Callable<T>() { @Override
@Override public T call() throws Exception {
public T call() throws Exception { spawn(object, point);
spawn(object, point); return object;
return object; }
} });
});
} }
@Override @Override
@@ -176,19 +175,18 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService {
} }
@Override @Override
public <T extends PositionableObject> AsyncFuture<T> unspawn(final T object, long time, public <T extends PositionableObject> AsyncFuture<T> unspawn(
TimeUnit unit) { final T object, long time, TimeUnit unit) {
Preconditions.checkNotNull(object, "object"); Preconditions.checkNotNull(object, "object");
Preconditions.checkArgument(time > 0, "time <= 0"); Preconditions.checkArgument(time > 0, "time <= 0");
Preconditions.checkNotNull(unit, "unit"); Preconditions.checkNotNull(unit, "unit");
return threadService.async(time, unit, return threadService.async(time, unit, new Callable<T>() {
new Callable<T>() { @Override
@Override public T call() throws Exception {
public T call() throws Exception { unspawn(object);
unspawn(object); return object;
return object; }
} });
});
} }
@Override @Override

View File

@@ -27,10 +27,11 @@ import com.l2jserver.service.Service;
/** /**
* Service that loads {@link L2Character}, {@link NPC}, {@link Item} and * Service that loads {@link L2Character}, {@link NPC}, {@link Item} and
* {@link Skill} {@link Template templates}. The service on startup, loads from files or from the * {@link Skill} {@link Template templates}. The service on startup, loads from
* database the data and parses them into <tt>com.l2jserver.model.template</tt> * files or from the database the data and parses them into
* classes. Once they are loaded, templates can be retrieved using any * <tt>com.l2jserver.model.template</tt> classes. Once they are loaded,
* {@link TemplateID} object created from a {@link TemplateIDProvider}. * templates can be retrieved using any {@link TemplateID} object created from a
* {@link TemplateIDProvider}.
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */

View File

@@ -37,7 +37,8 @@ import com.l2jserver.service.Service;
* <li>Process incoming connections and filter them for blocked IPs (not yet * <li>Process incoming connections and filter them for blocked IPs (not yet
* implemented);</li> * implemented);</li>
* <li>Handshake with the client and enable Cryptography;</li> * <li>Handshake with the client and enable Cryptography;</li>
* <li>Read incoming packets, decrypt and parse them into a ClientPacket;</li> * <li>Read incoming packets, decrypt and parse them into a {@link ClientPacket}
* ;</li>
* <li>Write outgoing packets ServerPacket and encrypt them;</li> * <li>Write outgoing packets ServerPacket and encrypt them;</li>
* <li>(optional) Validate GameGuard responses (see GameGuardService);</li> * <li>(optional) Validate GameGuard responses (see GameGuardService);</li>
* </ul> * </ul>

View File

@@ -170,8 +170,8 @@ public class BroadcastServiceImpl extends AbstractService implements
* @param point * @param point
* the old point * the old point
*/ */
private void broadcastUpdate(Lineage2Client conn, private void broadcastUpdate(Lineage2Client conn, L2Character character,
L2Character character, Point3D point) { Point3D point) {
for (final WorldObject o : worldService for (final WorldObject o : worldService
.iterable(new KnownListUpdateFilter(character, point))) { .iterable(new KnownListUpdateFilter(character, point))) {
broadcast(conn, o); broadcast(conn, o);

View File

@@ -129,7 +129,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
} }
sort(); sort();
} }
/** /**
* Adds a new function to this calculator. Executing order for functions * Adds a new function to this calculator. Executing order for functions
* with the same order is undefined. * with the same order is undefined.
@@ -228,7 +228,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
} }
} }
} }
public void sort() { public void sort() {
for (final List<Function<T, V>> funcs : functions.values()) { for (final List<Function<T, V>> funcs : functions.values()) {
Collections.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE); Collections.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE);
@@ -267,7 +267,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
public static class FunctionOrderComparator implements public static class FunctionOrderComparator implements
Comparator<Function<?, ?>>, Serializable { Comparator<Function<?, ?>>, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final FunctionOrderComparator SHARED_INSTANCE = new FunctionOrderComparator(); public static final FunctionOrderComparator SHARED_INSTANCE = new FunctionOrderComparator();
@Override @Override

View File

@@ -39,6 +39,6 @@ public interface Function<C extends CalculatorContext, V extends Enum<V>> {
* @return the order this function will be executed * @return the order this function will be executed
*/ */
int order(); int order();
V type(); V type();
} }

View File

@@ -117,7 +117,7 @@ public abstract class HtmlTemplate {
variables.put(name, value); variables.put(name, value);
return this; return this;
} }
/** /**
* Register an variable for this template * Register an variable for this template
* *

View File

@@ -34,8 +34,8 @@ import com.l2jserver.service.game.template.TemplateService;
import com.l2jserver.service.game.world.WorldService; import com.l2jserver.service.game.world.WorldService;
public class MySQL5CharacterDAOTest { public class MySQL5CharacterDAOTest {
private final Injector injector = Guice private final Injector injector = Guice.createInjector(Stage.PRODUCTION,
.createInjector(Stage.PRODUCTION, new GameServerModule()); new GameServerModule());
@Test @Test
public void testCachedLoad() throws ServiceStartException { public void testCachedLoad() throws ServiceStartException {

View File

@@ -27,7 +27,7 @@ import com.l2jserver.service.ServiceStartException;
public class SimpleCacheServiceTest { public class SimpleCacheServiceTest {
private final EhCacheService cacheService = new EhCacheService(); private final EhCacheService cacheService = new EhCacheService();
@Before @Before
public void tearUp() throws ServiceStartException { public void tearUp() throws ServiceStartException {
cacheService.start(); cacheService.start();