From 92c72ff1550e2992269c1bf1cd7f8f900fdaf081 Mon Sep 17 00:00:00 2001 From: Rogiel Date: Tue, 27 Dec 2011 16:42:05 -0200 Subject: [PATCH] Greatly improves source code documentation --- .../com/l2jserver/model/AbstractModel.java | 11 +- .../service/database/AbstractDAO.java | 2 +- .../service/database/DAOResolver.java | 6 + .../service/database/DatabaseException.java | 6 + .../database/DatabaseMappingException.java | 6 + .../database/dao/SelectPrimaryKeyMapper.java | 6 + .../service/database/ddl/QueryFactory.java | 76 ++++ .../service/database/ddl/QueryTemplate.java | 46 +++ .../service/database/ddl/TableFactory.java | 24 ++ .../ddl/annotation/ColumnDefault.java | 3 + .../database/ddl/annotation/ColumnSize.java | 3 + .../service/database/ddl/struct/Column.java | 52 ++- .../database/ddl/struct/ForeignKey.java | 6 + .../database/ddl/struct/PrimaryKey.java | 3 + .../service/database/ddl/struct/Table.java | 26 ++ .../database/ddl/template/DerbyTemplate.java | 12 + .../database/ddl/template/H2Template.java | 3 + .../database/ddl/template/MySQLTemplate.java | 3 + .../AbstractOrientDatabaseService.java | 223 ++++++++++- .../orientdb/DocumentDatabaseRow.java | 6 + .../sql/AbstractSQLDatabaseService.java | 205 +++++++++- .../database/sql/DerbyDatabaseEngine.java | 19 +- .../database/sql/H2DatabaseEngine.java | 6 + .../database/sql/MySQLDatabaseEngine.java | 6 + .../service/database/sql/SQLDatabaseRow.java | 19 +- .../java/com/l2jserver/util/ArrayUtils.java | 11 + .../java/com/l2jserver/util/CSVUtils.java | 5 + .../util/transformer/TransformException.java | 6 + .../id/allocator/BitSetIDAllocatorTest.java | 29 ++ .../service/cache/SimpleCacheServiceTest.java | 50 +++ .../XMLConfigurationServiceTest.java | 50 ++- .../com/l2jserver/util/ArrayUtilsTest.java | 19 +- .../java/com/l2jserver/L2JGameServerMain.java | 3 + .../net/packet/client/CM_CHAR_ACTION.java | 29 +- .../net/packet/client/CM_CHAR_APPEARING.java | 3 + .../game/net/packet/client/CM_CHAR_CHAT.java | 13 +- .../net/packet/client/CM_CHAR_CREATE.java | 3 + .../game/net/packet/client/CM_CHAR_MOVE.java | 35 +- .../net/packet/client/CM_CHAR_POSITION.java | 9 + .../net/packet/client/CM_CHAR_SELECT.java | 3 + .../net/packet/client/CM_ENTER_WORLD.java | 6 + .../client/CM_EXT_REQ_SHORTCUT_REGISTRY.java | 76 ---- .../game/net/packet/client/CM_GG_KEY.java | 3 + .../game/net/packet/client/CM_GOTO_LOBBY.java | 3 + .../net/packet/client/CM_ITEM_DESTROY.java | 3 + .../game/net/packet/client/CM_ITEM_DROP.java | 3 + .../packet/client/CM_PROTOCOL_VERSION.java | 7 +- .../client/CM_REQUEST_CHAR_TEMPLATE.java | 3 + .../game/net/packet/client/CM_RESTART.java | 4 + .../net/packet/server/SM_ACTOR_ATTACK.java | 17 + .../game/net/packet/server/SM_ACTOR_CHAT.java | 10 + .../game/net/packet/server/SM_ACTOR_DIE.java | 4 + .../game/net/packet/server/SM_ACTOR_MOVE.java | 4 + .../net/packet/server/SM_ACTOR_POSITION.java | 3 + .../packet/server/SM_ACTOR_STATUS_UPDATE.java | 145 ++++++- .../packet/server/SM_CHAR_CREATE_FAIL.java | 6 + .../net/packet/server/SM_CHAR_CREATE_OK.java | 3 + .../game/net/packet/server/SM_CHAR_INFO.java | 33 ++ .../packet/server/SM_CHAR_INFO_BROADCAST.java | 27 ++ .../net/packet/server/SM_CHAR_INFO_EXTRA.java | 3 + .../net/packet/server/SM_CHAR_INVENTORY.java | 3 + .../game/net/packet/server/SM_CHAR_LIST.java | 34 ++ .../net/packet/server/SM_CHAR_MOVE_TYPE.java | 3 + .../net/packet/server/SM_CHAR_OPEN_MAP.java | 3 + .../net/packet/server/SM_CHAR_RESTART.java | 10 + .../net/packet/server/SM_CHAR_SELECTED.java | 3 + .../packet/server/SM_CHAR_SHORTCUT_LIST.java | 4 + .../server/SM_CHAR_SHORTCUT_REGISTER.java | 4 + .../game/net/packet/server/SM_CHAR_STOP.java | 6 + .../net/packet/server/SM_CHAR_TARGET.java | 13 + .../server/SM_CHAR_TARGET_UNSELECT.java | 3 + .../net/packet/server/SM_CHAR_TELEPORT.java | 4 + .../net/packet/server/SM_CHAR_TEMPLATE.java | 3 + .../net/packet/server/SM_COMMUNITY_HTML.java | 9 + .../game/net/packet/server/SM_FORT_INFO.java | 3 + .../game/net/packet/server/SM_GG_QUERY.java | 18 +- .../game/net/packet/server/SM_HTML.java | 30 ++ .../net/packet/server/SM_ITEM_GROUND.java | 7 +- .../game/net/packet/server/SM_KEY.java | 6 + .../game/net/packet/server/SM_MANOR_LIST.java | 3 + .../game/net/packet/server/SM_NPC_INFO.java | 7 +- .../net/packet/server/SM_OBJECT_REMOVE.java | 4 + .../net/packet/server/SM_SERVER_OBJECT.java | 8 +- .../net/packet/server/SM_SYSTEM_MESSAGE.java | 115 ++++++ .../model/id/CharacterShortcutID.java | 3 + .../model/template/SkillTemplate.java | 15 + .../template/character/CharacterClass.java | 1 + .../template/character/CharacterRace.java | 1 + .../template/character/CharacterTemplate.java | 162 ++++++++ .../model/template/effect/EffectTemplate.java | 6 + .../effect/TeleportEffectTemplate.java | 24 +- .../model/template/item/ArmorType.java | 21 +- .../model/template/item/ItemMaterial.java | 6 + .../model/template/item/ItemTemplate.java | 85 +++++ .../model/template/item/ItemType.java | 27 +- .../l2jserver/model/template/npc/NPCRace.java | 1 + .../model/template/npc/NPCTemplate.java | 354 ++++++++++++++++++ .../template/npc/TeleportationTemplate.java | 26 ++ .../model/world/actor/ActorExperience.java | 1 + .../world/actor/effect/AbstractEffect.java | 12 + .../actor/effect/AbstractTemporalEffect.java | 9 + .../world/actor/effect/TemporalEffect.java | 9 +- .../model/world/actor/stat/StatType.java | 1 + .../world/character/CharacterAppearance.java | 82 +++- .../world/character/CharacterInventory.java | 124 +++++- .../model/world/npc/NPCController.java | 3 + .../model/world/npc/event/NPCTalkEvent.java | 9 + .../database/GameServerDAOResolver.java | 8 + .../GameServerOrientDatabaseService.java | 5 + .../dao/orientdb/OrientDBCharacterDAO.java | 4 +- .../orientdb/OrientDBCharacterFriendDAO.java | 4 +- .../OrientDBCharacterShortcutDAO.java | 7 +- .../dao/orientdb/OrientDBChatMessageDAO.java | 6 +- .../dao/orientdb/OrientDBClanDAO.java | 11 +- .../dao/orientdb/OrientDBItemDAO.java | 7 +- .../database/dao/orientdb/OrientDBNPCDAO.java | 7 +- .../database/dao/sql/SQLCharacterDAO.java | 4 +- .../dao/sql/SQLCharacterFriendDAO.java | 4 +- .../dao/sql/SQLCharacterShortcutDAO.java | 7 +- .../database/dao/sql/SQLChatMessageDAO.java | 5 +- .../service/database/dao/sql/SQLClanDAO.java | 7 +- .../service/database/dao/sql/SQLItemDAO.java | 7 +- .../service/database/dao/sql/SQLNPCDAO.java | 7 +- .../database/mapper/CharacterMapper.java | 3 + .../mapper/CharacterShortcutMapper.java | 3 + .../database/mapper/ChatMessageMapper.java | 3 + .../service/database/mapper/ClanMapper.java | 3 + .../service/database/mapper/ItemMapper.java | 3 + .../service/database/mapper/NPCMapper.java | 3 + .../service/database/model/QActorSkill.java | 38 +- .../service/database/model/QCharacter.java | 92 ++++- .../database/model/QCharacterFriend.java | 33 +- .../database/model/QCharacterShortcut.java | 53 ++- .../service/database/model/QClan.java | 35 +- .../service/database/model/QItem.java | 56 ++- .../service/database/model/QLogChat.java | 48 ++- .../service/database/model/QNPC.java | 54 ++- .../service/game/chat/ChatMessageType.java | 44 ++- .../game/effect/SimpleEffectService.java | 3 + .../l2jserver/util/calculator/Calculator.java | 26 +- .../util/calculator/ComplexCalculator.java | 30 ++ .../l2jserver/util/calculator/Function.java | 3 + .../util/calculator/SimpleCalculator.java | 19 +- .../db/dao/mysql5/MySQL5CharacterDAOTest.java | 16 +- .../id/provider/CharacterIDProviderTest.java | 25 ++ .../scripting/ScriptingServiceImplTest.java | 19 + .../template/StaticTemplateServiceTest.java | 41 -- .../world/WorldEventDispatcherImplTest.java | 30 ++ .../service/world/WorldServiceImplTest.java | 39 ++ 149 files changed, 3260 insertions(+), 256 deletions(-) delete mode 100644 l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_EXT_REQ_SHORTCUT_REGISTRY.java delete mode 100644 l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/template/StaticTemplateServiceTest.java diff --git a/l2jserver2-common/src/main/java/com/l2jserver/model/AbstractModel.java b/l2jserver2-common/src/main/java/com/l2jserver/model/AbstractModel.java index ba4d98ff6..53b477e5a 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/model/AbstractModel.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/model/AbstractModel.java @@ -16,7 +16,6 @@ */ package com.l2jserver.model; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,9 +71,9 @@ public abstract class AbstractModel> implements Model { } /** - * Set this object desire to {@link ObjectDesire#UPDATE}. If the desire is - * {@link ObjectDesire#INSERT} or {@link ObjectDesire#DELETE} the desire - * will not be changed. + * Set this object desire to {@link Model.ObjectDesire#UPDATE}. If the + * desire is {@link Model.ObjectDesire#INSERT} or + * {@link Model.ObjectDesire#DELETE} the desire will not be changed. */ protected void desireUpdate() { if (this.desire != ObjectDesire.INSERT @@ -85,8 +84,8 @@ public abstract class AbstractModel> implements Model { } /** - * Set this object desire to {@link ObjectDesire#INSERT}. If the desire is - * {@link ObjectDesire#DELETE} the desire will not be changed. + * Set this object desire to {@link Model.ObjectDesire#INSERT}. If the desire is + * {@link Model.ObjectDesire#DELETE} the desire will not be changed. */ protected void desireInsert() { if (this.desire != ObjectDesire.DELETE) { diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/AbstractDAO.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/AbstractDAO.java index 116da18a1..69b50ca1e 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/AbstractDAO.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/AbstractDAO.java @@ -45,10 +45,10 @@ public abstract class AbstractDAO, I extends ID> */ protected final DatabaseService database; - @Inject /** * The ThreadService used to execute operations asynchronously. */ + @Inject protected ThreadService threadService; /** diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DAOResolver.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DAOResolver.java index edf8e2007..75e963893 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DAOResolver.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DAOResolver.java @@ -3,6 +3,12 @@ package com.l2jserver.service.database; import com.l2jserver.model.Model; import com.l2jserver.model.id.ID; +/** + * The {@link DAOResolver} resolves the {@link DataAccessObject} that provides + * database operations for an given {@link Model} instance + * + * @author Rogiel + */ public interface DAOResolver { /** * Returns the {@link DataAccessObject} used to retrieve and save objects of diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseException.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseException.java index 68f85cb85..6bf97f921 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseException.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseException.java @@ -20,8 +20,14 @@ package com.l2jserver.service.database; * @author Rogiel */ public class DatabaseException extends RuntimeException { + /** + * The Java Serialization API ID + */ private static final long serialVersionUID = 1L; + /** + * Creates a new instane + */ public DatabaseException() { super(); } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseMappingException.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseMappingException.java index 46d02cf82..db6f19ef1 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseMappingException.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseMappingException.java @@ -20,8 +20,14 @@ package com.l2jserver.service.database; * @author Rogiel */ public class DatabaseMappingException extends DatabaseException { + /** + * The Java Serialization API ID + */ private static final long serialVersionUID = 1L; + /** + * Creates a new instane + */ public DatabaseMappingException() { super(); } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/dao/SelectPrimaryKeyMapper.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/dao/SelectPrimaryKeyMapper.java index e0d70878e..425a7b53f 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/dao/SelectPrimaryKeyMapper.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/dao/SelectPrimaryKeyMapper.java @@ -31,7 +31,13 @@ import com.mysema.query.types.Path; */ public class SelectPrimaryKeyMapper, E extends RelationalPathBase> implements SelectMapper { + /** + * The primary key mapper + */ private final PrimaryKeyMapper mapper; + /** + * The primary key path + */ private final Path path; /** diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryFactory.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryFactory.java index 17b16b7a1..155d9b0af 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryFactory.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryFactory.java @@ -30,6 +30,15 @@ import com.l2jserver.util.factory.CollectionFactory; * */ public class QueryFactory { + /** + * Creates an CREATE TABLE query from an {@link Table} object + * + * @param table + * the table object + * @param template + * the query template + * @return the CREATE TABLE query as string + */ public static String createTableQuery(Table table, QueryTemplate template) { final StringBuilder builder = new StringBuilder(); builder.append(template.getCreateTable()) @@ -59,6 +68,18 @@ public class QueryFactory { return builder.toString(); } + /** + * Creates an ALTER TABLE query from the difference between two + * {@link Table} objects + * + * @param expected + * the desired table model + * @param current + * the current table model + * @param template + * the query template + * @return the ALTER TABLE query as string + */ public static String alterTableQueryDelta(Table expected, Table current, QueryTemplate template) { // detect missing columns @@ -108,6 +129,20 @@ public class QueryFactory { return builder.toString(); } + /** + * Creates an ALTER TABLE query from the difference between two + * {@link Table} objects. + *

+ * This method does not delete any column. + * + * @param expected + * the desired table model + * @param current + * the current table model + * @param template + * the query template + * @return the ALTER TABLE query as string + */ public static String alterTableQueryUpdate(Table expected, Table current, QueryTemplate template) { // detect missing columns @@ -144,6 +179,19 @@ public class QueryFactory { return builder.toString(); } + /** + * Creates an ALTER TABLE query from the difference between two + * {@link Table} objects. Note that this method will only add missing + * columns, but won't update their types. + * + * @param expected + * the desired table model + * @param current + * the current table model + * @param template + * the query template + * @return the ALTER TABLE query as string + */ public static String alterTableQueryMissing(Table expected, Table current, QueryTemplate template) { // detect missing columns @@ -172,6 +220,16 @@ public class QueryFactory { return builder.toString(); } + /** + * @param builder + * the {@link StringBuilder} + * @param template + * the query template + * @param column + * the column + * @param alter + * whether it is an alter table or create table + */ private static void createColumnDefinition(StringBuilder builder, QueryTemplate template, Column column, boolean alter) { builder.append(template.quoteIdentifier(column.getName())).append(" "); @@ -215,6 +273,16 @@ public class QueryFactory { } } + /** + * @param builder + * the {@link StringBuilder} + * @param template + * the query template + * @param table + * the table + * @param pk + * the primary key + */ private static void generatePrimaryKeyDefinition(StringBuilder builder, QueryTemplate template, Table table, PrimaryKey pk) { builder.append("CONSTRAINT ") @@ -227,6 +295,14 @@ public class QueryFactory { // .append(")"); } + /** + * @param builder + * the {@link StringBuilder} + * @param template + * the query template + * @param fk + * the foreign key + */ private static void generateForeignKeyDefinition(StringBuilder builder, QueryTemplate template, ForeignKey fk) { builder.append("CONSTRAINT ") diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryTemplate.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryTemplate.java index eded8ea9c..798c1f09d 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryTemplate.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/QueryTemplate.java @@ -44,39 +44,85 @@ public abstract class QueryTemplate extends SQLTemplates { // String getColumnDefinition(String name, ColumnType type, int size, // boolean nullable); + /** + * @param type + * the column type + * @return the database specific type + */ public abstract String getDatabaseType(ColumnType type); + /** + * @param type + * the column type + * @return true if the database requires an size parameter for the column + * type + */ public abstract boolean getTypeSizeRequirement(ColumnType type); + /** + * @return true if the database supports enums + */ public abstract boolean supportsEnum(); + /** + * @return true if the database supports auto increment + */ public abstract boolean supportsAutoIncrement(); + /** + * @return true if the database supports foreign keys + */ public abstract boolean supportsForeignKeys(); + /** + * @return true if the database supports changing column types + */ public abstract boolean supportsColumnChangeTypes(); + /** + * @return true if the database supports renaming columns + */ public abstract boolean supportsColumnRename(); + /** + * @return true if the database supports altering tables + */ public abstract boolean supportsAlterTable(); + /** + * @param defaultValue + * the value + * @return the quoted value + */ public String quoteValue(String defaultValue) { return new StringBuilder("'").append(defaultValue).append("'") .toString(); } + /** + * @return the ALTER TABLE statement + */ public String getAlterTable() { return "alter table "; } + /** + * @return the ADD COLUMN statement + */ public String getAddColumn() { return "add column "; } + /** + * @return the DROP COLUMN statement + */ public String getDropColumn() { return "drop column "; } + /** + * @return the ALTER COLUMN statement + */ public String getAlterColumn() { return "alter column "; } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/TableFactory.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/TableFactory.java index a1c35863b..2ddd20f63 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/TableFactory.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/TableFactory.java @@ -131,6 +131,13 @@ public class TableFactory { return fks; } + /** + * @param tablePath + * the query entity + * @param columns + * the columns + * @return the primary key object + */ private static PrimaryKey createPK(RelationalPath tablePath, Map columns) { return new PrimaryKey(columns.get(tablePath.getPrimaryKey() @@ -138,6 +145,13 @@ public class TableFactory { .toString())); } + /** + * @param tablePath + * the query entity + * @param path + * the path + * @return the column object + */ private static Column createColumn(RelationalPath tablePath, Path path) { final String columnName = path.getMetadata().getExpression().toString(); final ColumnType columnType = getColumnType(path.getType()); @@ -197,6 +211,11 @@ public class TableFactory { hasDefaultValue, defaultValue); } + /** + * @param type + * the java type + * @return the database column type + */ private static ColumnType getColumnType(Class type) { if (ClassUtils.isSubclass(type, String.class)) return ColumnType.STRING; @@ -215,6 +234,11 @@ public class TableFactory { return null; } + /** + * @param jdbcType + * the JDBC type + * @return the database column type + */ private static ColumnType getColumnType(int jdbcType) { switch (jdbcType) { case Types.INTEGER: diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnDefault.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnDefault.java index f01385a5d..ce3c1327a 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnDefault.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnDefault.java @@ -33,5 +33,8 @@ import com.mysema.query.sql.RelationalPath; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ColumnDefault { + /** + * @return the default column value + */ String value() default "NULL"; } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnSize.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnSize.java index 579010992..a8bb34862 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnSize.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/annotation/ColumnSize.java @@ -33,5 +33,8 @@ import com.mysema.query.sql.RelationalPath; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ColumnSize { + /** + * @return the maximum column value + */ int value(); } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Column.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Column.java index 404b759f1..88976bfa9 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Column.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Column.java @@ -16,6 +16,7 @@ */ package com.l2jserver.service.database.ddl.struct; +import java.sql.Date; import java.util.List; import com.l2jserver.util.factory.CollectionFactory; @@ -24,18 +25,67 @@ import com.l2jserver.util.factory.CollectionFactory; * @author Rogiel */ public class Column { + /** + * The column name + */ private final String name; + /** + * The column type + */ private final ColumnType type; + /** + * Define the supported column types + * + * @author Rogiel + * + */ public enum ColumnType { - STRING, ENUM, INTEGER, DOUBLE, TIMESTAMP; + /** + * {@link String} type + */ + STRING, + /** + * {@link Enum} type + */ + ENUM, + /** + * {@link Integer} type + */ + INTEGER, + /** + * {@link Double} type + */ + DOUBLE, + /** + * {@link Date} type + */ + TIMESTAMP; } + /** + * Whether the column is nullable or not + */ private boolean nullable = true; + /** + * The maximum size of the column + */ private int size = 0; + /** + * Whether the column has a default value + */ private boolean hasDefaultValue = false; + /** + * The column default value + */ private String defaultValue = null; + /** + * The enum values + */ private List enumValues = CollectionFactory.newList(); + /** + * Whether the column requires ID generation + */ private boolean autoIncrement; /** diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/ForeignKey.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/ForeignKey.java index cf0244757..4d8ee643b 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/ForeignKey.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/ForeignKey.java @@ -24,7 +24,13 @@ import java.util.List; * */ public class ForeignKey { + /** + * The key name + */ private final String name; + /** + * The key columns + */ private final List columns; /** diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/PrimaryKey.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/PrimaryKey.java index a4ef3e667..de483788e 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/PrimaryKey.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/PrimaryKey.java @@ -20,6 +20,9 @@ package com.l2jserver.service.database.ddl.struct; * @author Rogiel */ public class PrimaryKey { + /** + * The primary key column + */ private final Column column; /** diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Table.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Table.java index 71f64d7a9..23dac1101 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Table.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/struct/Table.java @@ -28,12 +28,30 @@ import com.l2jserver.util.factory.CollectionFactory; * */ public class Table { + /** + * The table name + */ private final String name; + /** + * The columns + */ private final Map columns = CollectionFactory.newMap(); + /** + * The primary key + */ private final PrimaryKey primaryKey; + /** + * The foreign keys + */ private final List foreignKeys = CollectionFactory.newList(); + /** + * @param name the table name + * @param columns the column + * @param primaryKey the primary key + * @param foreignKeys the foreign keys + */ public Table(String name, Map columns, PrimaryKey primaryKey, List foreignKeys) { this.name = name; @@ -43,6 +61,10 @@ public class Table { this.foreignKeys.addAll(foreignKeys); } + /** + * @param name the table name + * @param primaryKey the primary key + */ public Table(String name, PrimaryKey primaryKey) { this.name = name; this.primaryKey = primaryKey; @@ -81,6 +103,10 @@ public class Table { return column; } + /** + * @param name the column name + * @return the column represented by name + */ public Column getColumn(String name) { for (final Column column : columns.values()) { if (name.equals(column.getName())) diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/DerbyTemplate.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/DerbyTemplate.java index 1a600b2d2..88569b913 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/DerbyTemplate.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/DerbyTemplate.java @@ -27,12 +27,24 @@ import com.mysema.query.types.Ops; * @author Rogiel */ public class DerbyTemplate extends QueryTemplate { + /** + * The limit offset template string + */ private String limitOffsetTemplate = "\noffset {1s} rows fetch next {0s} rows only"; + /** + * The limit template string + */ private String limitTemplate = "\nfetch first {0s} rows only"; + /** + * The offset template string + */ private String offsetTemplate = "\noffset {0s} rows"; + /** + * Creates a new instance + */ public DerbyTemplate() { super("\"", '\\', true); addClass2TypeMappings("smallint", Byte.class); diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/H2Template.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/H2Template.java index f8d10e7aa..776959ce5 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/H2Template.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/H2Template.java @@ -24,6 +24,9 @@ import com.mysema.query.types.Ops; * @author Rogiel */ public class H2Template extends QueryTemplate { + /** + * Creates a new instance + */ public H2Template() { super("\"", '\\', true); setNativeMerge(true); diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/MySQLTemplate.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/MySQLTemplate.java index d70c9ea39..21c6a924d 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/MySQLTemplate.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/ddl/template/MySQLTemplate.java @@ -26,6 +26,9 @@ import com.mysema.query.types.Ops; * @author Rogiel */ public class MySQLTemplate extends QueryTemplate { + /** + * Creates a new instance + */ public MySQLTemplate() { super("`", '\\', true); addClass2TypeMappings("bool", Boolean.class); diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java index 95bcc76c2..53e5c9711 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java @@ -496,7 +496,24 @@ public abstract class AbstractOrientDatabaseService extends AbstractService R query(ODatabaseDocumentTx database, DatabaseService service); } - public static abstract class AbstractQuery implements Query { + /** + * An base abstract query. For internal use only. + * + * @author Rogiel + * + * @param + * the query return type + */ + private static abstract class AbstractQuery implements Query { + /** + * Tries to update the object desire if it currently is equal to + * expected + * + * @param object + * the object to update desire + * @param expected + * the expected desire + */ protected void updateDesire(Object object, ObjectDesire expected) { if (object instanceof Model) { if (((Model) object).getObjectDesire() == expected) { @@ -505,18 +522,53 @@ public abstract class AbstractOrientDatabaseService extends AbstractService } } + /** + * Returns the parameter name for the given path + * + * @param path + * the path + * @return the parameter name + */ protected String name(Path path) { return path.getMetadata().getExpression().toString(); } } + /** + * An query implementation designed to insert new objects into the database. + * Optionally, it can use an pseudo primary key generator that maps the + * OrientDB document id as the generated ID. + * + * @author Rogiel + * + * @param + * the object type used in this query + * @param + * the raw ID type + * @param + * the ID type + * @param + * the entity type + */ public static class InsertQuery, E extends RelationalPathBase> extends AbstractQuery { + /** + * The row mapper + */ private final InsertMapper mapper; + /** + * The query object iterator + */ private final Iterator iterator; + /** + * The query primary key column. Only set if want auto generated IDs + */ private final Path primaryKey; - protected final E e; + /** + * The query entity + */ + protected final E entity; /** * @param entity @@ -533,7 +585,7 @@ public abstract class AbstractOrientDatabaseService extends AbstractService Path primaryKey, Iterator iterator) { this.iterator = iterator; this.mapper = mapper; - this.e = entity; + this.entity = entity; this.primaryKey = primaryKey; } @@ -589,9 +641,9 @@ public abstract class AbstractOrientDatabaseService extends AbstractService final DocumentDatabaseRow row = new DocumentDatabaseRow(); while (iterator.hasNext()) { final O object = iterator.next(); - row.setDocument(new ODocument(database, e.getTableName())); + row.setDocument(new ODocument(database, entity.getTableName())); - mapper.insert(e, object, row); + mapper.insert(entity, object, row); row.getDocument().save(); if (primaryKey != null && object instanceof Model) { @@ -614,11 +666,30 @@ public abstract class AbstractOrientDatabaseService extends AbstractService } } + /** + * An query implementation designed to update objects in the database + * + * @author Rogiel + * + * @param + * the query object type + * @param + * the query entity type + */ public static abstract class UpdateQuery> extends AbstractQuery { + /** + * The row mapper + */ private final UpdateMapper mapper; + /** + * The object iterator for this query + */ private final Iterator iterator; - protected final E e; + /** + * The query entity + */ + protected final E entity; /** * @param entity @@ -632,7 +703,7 @@ public abstract class AbstractOrientDatabaseService extends AbstractService Iterator iterator) { this.iterator = iterator; this.mapper = mapper; - this.e = entity; + this.entity = entity; } /** @@ -658,7 +729,7 @@ public abstract class AbstractOrientDatabaseService extends AbstractService List documents = database .query(new ONativeSynchQuery( - database, e.getTableName(), + database, entity.getTableName(), new OQueryContextNative()) { private static final long serialVersionUID = 1L; @@ -670,7 +741,7 @@ public abstract class AbstractOrientDatabaseService extends AbstractService if (documents.size() < 1) continue; row.setDocument(documents.get(0)); - mapper.update(e, object, row); + mapper.update(entity, object, row); row.getDocument().save(); rows++; @@ -680,14 +751,40 @@ public abstract class AbstractOrientDatabaseService extends AbstractService return rows; } + /** + * Performs the OrientDB document filtering. If all results are wanted, + * null should be returned. + * + * @param record + * the document record + * @param o + * the object instance + * @return the record instance or null + */ protected abstract OQueryContextNative query( OQueryContextNative record, O o); } + /** + * An query implementation designed for deleting objects in the database. + * + * @author Rogiel + * + * @param + * the query object type + * @param + * the query entity type + */ public static abstract class DeleteQuery> extends AbstractQuery { + /** + * The object iterator for this query + */ private final Iterator iterator; - protected final E e; + /** + * This query entity + */ + protected final E entity; /** * @param entity @@ -697,7 +794,7 @@ public abstract class AbstractOrientDatabaseService extends AbstractService */ public DeleteQuery(E entity, Iterator iterator) { this.iterator = iterator; - this.e = entity; + this.entity = entity; } /** @@ -720,7 +817,7 @@ public abstract class AbstractOrientDatabaseService extends AbstractService List documents = database .query(new ONativeSynchQuery( - database, e.getTableName(), + database, entity.getTableName(), new OQueryContextNative()) { private static final long serialVersionUID = 1L; @@ -739,13 +836,46 @@ public abstract class AbstractOrientDatabaseService extends AbstractService return rows; } + /** + * Performs the OrientDB document filtering. If all results are wanted, + * null should be returned. + * + * @param record + * the document record + * @param o + * the object instance + * @return the record instance or null + */ protected abstract OQueryContextNative query( OQueryContextNative record, O o); } - public static abstract class AbstractSelectQuery, E extends RelationalPathBase> + /** + * Abstract query implementation designed for selecting database objects. + * Internal use only. + * + * @author Rogiel + * + * @param + * the query return type + * @param + * the query object type + * @param + * the raw ID type + * @param + * the ID type + * @param + * the query entity type + */ + private static abstract class AbstractSelectQuery, E extends RelationalPathBase> extends AbstractQuery { + /** + * This query entity type + */ protected final E entity; + /** + * The row mapper + */ protected final SelectMapper mapper; /** @@ -778,12 +908,41 @@ public abstract class AbstractOrientDatabaseService extends AbstractService return perform(documents, service); } + /** + * Performs the OrientDB document filtering. If all results are wanted, + * null should be returned. + * + * @param record + * the document record + * @param e + * the query entity + * @return the record instance or null + */ protected abstract OQueryContextNative query( OQueryContextNative record, E e); + /** + * Effectively performs the query executing and mapping process + * + * @param documents + * the list of documens returned + * @param service + * the database service + * @return the query result, returned directly to the user + */ protected abstract R perform(List documents, DatabaseService service); + /** + * Checks if the object is on the cache. Returns it if available, + * null otherwise. + * + * @param row + * the row + * @param database + * the database service + * @return the object on cache, if exists. + */ @SuppressWarnings("unchecked") protected O lookupCache(DatabaseRow row, DatabaseService database) { final I id = mapper.getPrimaryKeyMapper().createID( @@ -797,6 +956,14 @@ public abstract class AbstractOrientDatabaseService extends AbstractService return null; } + /** + * Updates the cache instance + * + * @param instance + * the object instance + * @param database + * the database service + */ protected void updateCache(O instance, DatabaseService database) { if (instance == null) return; @@ -806,6 +973,21 @@ public abstract class AbstractOrientDatabaseService extends AbstractService } } + /** + * An query implementation designed for selecting a single object in the + * database + * + * @author Rogiel + * + * @param + * the object type + * @param + * the raw ID type + * @param + * the ID type + * @param + * the query entity type + */ public static abstract class SelectSingleQuery, E extends RelationalPathBase> extends AbstractSelectQuery { /** @@ -838,6 +1020,21 @@ public abstract class AbstractOrientDatabaseService extends AbstractService } } + /** + * An query implementation designed for selecting several objects in the + * database + * + * @author Rogiel + * + * @param + * the object type + * @param + * the raw ID type + * @param + * the ID type + * @param + * the query entity type + */ public static abstract class SelectListQuery, E extends RelationalPathBase> extends AbstractSelectQuery, O, RI, I, E> { /** diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/DocumentDatabaseRow.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/DocumentDatabaseRow.java index 71b067936..1e50b0a08 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/DocumentDatabaseRow.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/DocumentDatabaseRow.java @@ -26,6 +26,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; * */ public class DocumentDatabaseRow implements DatabaseRow, WritableDatabaseRow { + /** + * The OrientDB {@link ODocument} instance + */ private ODocument document; /** @@ -36,6 +39,9 @@ public class DocumentDatabaseRow implements DatabaseRow, WritableDatabaseRow { this.document = document; } + /** + * Creates a new instance + */ public DocumentDatabaseRow() { } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java index 2d9a7f9e0..171af5ebc 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java @@ -649,7 +649,24 @@ public abstract class AbstractSQLDatabaseService extends AbstractService DatabaseService database); } + /** + * An base abstract query. For internal use only. + * + * @author Rogiel + * + * @param + * the query return type + */ public static abstract class AbstractQuery implements Query { + /** + * Tries to update the object desire if it currently is equal to + * expected + * + * @param object + * the object to update desire + * @param expected + * the expected desire + */ protected void updateDesire(Object object, ObjectDesire expected) { if (object instanceof Model) { if (((Model) object).getObjectDesire() == expected) { @@ -659,13 +676,39 @@ public abstract class AbstractSQLDatabaseService extends AbstractService } } + /** + * An query implementation designed to insert new objects into the database. + * + * @author Rogiel + * + * @param + * the object type used in this query + * @param + * the raw ID type + * @param + * the ID type + * @param + * the entity type + */ public static class InsertQuery, E extends RelationalPathBase> extends AbstractQuery { + /** + * The row mapper + */ private final InsertMapper mapper; + /** + * The query object iterator + */ private final Iterator iterator; + /** + * The query primary key column. Only set if want auto generated IDs + */ private final Path primaryKey; - protected final E e; + /** + * The query entity + */ + protected final E entity; /** * @param entity @@ -682,7 +725,7 @@ public abstract class AbstractSQLDatabaseService extends AbstractService Path primaryKey, Iterator iterator) { this.iterator = iterator; this.mapper = mapper; - this.e = entity; + this.entity = entity; this.primaryKey = primaryKey; } @@ -739,8 +782,8 @@ public abstract class AbstractSQLDatabaseService extends AbstractService while (iterator.hasNext()) { final O object = iterator.next(); final SQLInsertWritableDatabaseRow row = new SQLInsertWritableDatabaseRow( - factory.insert(e)); - mapper.insert(e, object, row); + factory.insert(entity)); + mapper.insert(entity, object, row); if (primaryKey == null) { row.getClause().execute(); @@ -759,11 +802,30 @@ public abstract class AbstractSQLDatabaseService extends AbstractService } } + /** + * An query implementation designed to update objects in the database + * + * @author Rogiel + * + * @param + * the query object type + * @param + * the query entity type + */ public static abstract class UpdateQuery> extends AbstractQuery { + /** + * The row mapper + */ private final UpdateMapper mapper; + /** + * The object iterator for this query + */ private final Iterator iterator; - protected final E e; + /** + * The query entity + */ + protected final E entity; /** * @param entity @@ -777,7 +839,7 @@ public abstract class AbstractSQLDatabaseService extends AbstractService Iterator iterator) { this.iterator = iterator; this.mapper = mapper; - this.e = entity; + this.entity = entity; } /** @@ -801,10 +863,10 @@ public abstract class AbstractSQLDatabaseService extends AbstractService while (iterator.hasNext()) { final O object = iterator.next(); final SQLUpdateWritableDatabaseRow row = new SQLUpdateWritableDatabaseRow( - factory.update(e)); + factory.update(entity)); // maps query to the values query(row.getClause(), object); - mapper.update(e, object, row); + mapper.update(entity, object, row); rows += row.getClause().execute(); @@ -813,13 +875,37 @@ public abstract class AbstractSQLDatabaseService extends AbstractService return rows; } + /** + * Performs the query filtering + * + * @param q + * the query clause + * @param o + * the object + */ protected abstract void query(SQLUpdateClause q, O o); } + /** + * An query implementation designed for deleting objects in the database. + * + * @author Rogiel + * + * @param + * the query object type + * @param + * the query entity type + */ public static abstract class DeleteQuery> extends AbstractQuery { + /** + * The object iterator for this query + */ private final Iterator iterator; - protected final E e; + /** + * This query entity + */ + protected final E entity; /** * @param entity @@ -829,7 +915,7 @@ public abstract class AbstractSQLDatabaseService extends AbstractService */ public DeleteQuery(E entity, Iterator iterator) { this.iterator = iterator; - this.e = entity; + this.entity = entity; } /** @@ -850,7 +936,7 @@ public abstract class AbstractSQLDatabaseService extends AbstractService int rows = 0; while (iterator.hasNext()) { final O object = iterator.next(); - final SQLDeleteClause delete = factory.delete(e); + final SQLDeleteClause delete = factory.delete(entity); // maps query to the values query(delete, object); @@ -861,12 +947,43 @@ public abstract class AbstractSQLDatabaseService extends AbstractService return rows; } + /** + * Performs the query filtering + * + * @param q + * the query clause + * @param o + * the object + */ protected abstract void query(SQLDeleteClause q, O o); } + /** + * Abstract query implementation designed for selecting database objects. + * Internal use only. + * + * @author Rogiel + * + * @param + * the query return type + * @param + * the query object type + * @param + * the raw ID type + * @param + * the ID type + * @param + * the query entity type + */ public static abstract class AbstractSelectQuery, E extends RelationalPathBase> extends AbstractQuery { + /** + * This query entity type + */ protected final E entity; + /** + * The row mapper + */ protected final SelectMapper mapper; /** @@ -891,11 +1008,39 @@ public abstract class AbstractSQLDatabaseService extends AbstractService return perform(select, database); } + /** + * Performs the query filtering + * + * @param q + * the query clause + * @param e + * the query entity + */ protected abstract void query(AbstractSQLQuery q, E e); + /** + * Effectively performs the query executing and mapping process + * + * @param select + * the query clause ready to be executed (can be modified if + * needed) + * @param database + * the database service + * @return the query result, returned directly to the user + */ protected abstract R perform(AbstractSQLQuery select, DatabaseService database); + /** + * Checks if the object is on the cache. Returns it if available, + * null otherwise. + * + * @param row + * the row + * @param database + * the database service + * @return the object on cache, if exists. + */ @SuppressWarnings("unchecked") protected O lookupCache(DatabaseRow row, DatabaseService database) { final I id = mapper.getPrimaryKeyMapper().createID( @@ -909,6 +1054,14 @@ public abstract class AbstractSQLDatabaseService extends AbstractService return null; } + /** + * Updates the cache instance + * + * @param instance + * the object instance + * @param database + * the database service + */ protected void updateCache(O instance, DatabaseService database) { if (instance == null) return; @@ -918,6 +1071,21 @@ public abstract class AbstractSQLDatabaseService extends AbstractService } } + /** + * An query implementation designed for selecting a single object in the + * database + * + * @author Rogiel + * + * @param + * the object type + * @param + * the raw ID type + * @param + * the ID type + * @param + * the query entity type + */ public static abstract class SelectSingleQuery, E extends RelationalPathBase> extends AbstractSelectQuery { /** @@ -950,6 +1118,21 @@ public abstract class AbstractSQLDatabaseService extends AbstractService } } + /** + * An query implementation designed for selecting several objects in the + * database + * + * @author Rogiel + * + * @param + * the object type + * @param + * the raw ID type + * @param + * the ID type + * @param + * the query entity type + */ public static abstract class SelectListQuery, E extends RelationalPathBase> extends AbstractSelectQuery, O, RI, I, E> { /** diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/DerbyDatabaseEngine.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/DerbyDatabaseEngine.java index c4b782d54..de29bb353 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/DerbyDatabaseEngine.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/DerbyDatabaseEngine.java @@ -38,18 +38,25 @@ import com.mysema.query.sql.types.Type; * @author Rogiel */ public class DerbyDatabaseEngine implements DatabaseEngine { + /** + * The {@link DerbyTemplate} instance + */ private final DerbyTemplate template = new DerbyTemplate(); + /** + * The querydsl configuration + */ private final Configuration configuration = new Configuration(template); @Override public SQLQueryFactory, ?, ?, ?, ?, ?> createSQLQueryFactory( final Connection conn) { - return new SQLQueryFactoryImpl(configuration, new Provider() { - @Override - public Connection get() { - return conn; - } - }); + return new SQLQueryFactoryImpl(configuration, + new Provider() { + @Override + public Connection get() { + return conn; + } + }); } @Override diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/H2DatabaseEngine.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/H2DatabaseEngine.java index 96ac8a014..1de68be45 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/H2DatabaseEngine.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/H2DatabaseEngine.java @@ -37,7 +37,13 @@ import com.mysema.query.sql.types.Type; * @author Rogiel */ public class H2DatabaseEngine implements DatabaseEngine { + /** + * The {@link H2Template} instance + */ private final H2Template template = new H2Template(); + /** + * The querydsl configuration + */ private final Configuration configuration = new Configuration(template); @Override diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/MySQLDatabaseEngine.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/MySQLDatabaseEngine.java index 1be076a91..38eb26349 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/MySQLDatabaseEngine.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/MySQLDatabaseEngine.java @@ -36,7 +36,13 @@ import com.mysema.query.sql.types.Type; * @author Rogiel */ public class MySQLDatabaseEngine implements DatabaseEngine { + /** + * The {@link MySQLTemplate} instance + */ private final QueryTemplate template = new MySQLTemplate(); + /** + * The querydsl configuration + */ private final Configuration configuration = new Configuration(template); @Override diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/SQLDatabaseRow.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/SQLDatabaseRow.java index 5cc7f231c..f56e83531 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/SQLDatabaseRow.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/SQLDatabaseRow.java @@ -27,10 +27,18 @@ import com.mysema.query.types.Path; * */ public class SQLDatabaseRow implements DatabaseRow { + /** + * The query entity + */ @SuppressWarnings("unused") private final RelationalPathBase entity; + /** + * The cached list of paths + */ private final List> paths; - + /** + * The database data row + */ private Object[] row; /** @@ -66,10 +74,19 @@ public class SQLDatabaseRow implements DatabaseRow { return row[indexOf(path)] == null; } + /** + * @param path + * the path + * @return the index of path + */ private int indexOf(Path path) { return paths.indexOf(path); } + /** + * @param row + * the new row data + */ public void setRow(Object[] row) { this.row = row; } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/util/ArrayUtils.java b/l2jserver2-common/src/main/java/com/l2jserver/util/ArrayUtils.java index 2d1f8e420..430607c0d 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/util/ArrayUtils.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/util/ArrayUtils.java @@ -27,6 +27,17 @@ import com.l2jserver.util.factory.CollectionFactory; * */ public class ArrayUtils { + /** + * Copy an entire array except objects in except array. + * + * @param type + * the array type + * @param array + * the source array + * @param except + * the objects to not be copied + * @return the copied array + */ @SafeVarargs public final static T[] copyArrayExcept(Class type, T[] array, T... except) { diff --git a/l2jserver2-common/src/main/java/com/l2jserver/util/CSVUtils.java b/l2jserver2-common/src/main/java/com/l2jserver/util/CSVUtils.java index 67b603f38..a9634c09f 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/util/CSVUtils.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/util/CSVUtils.java @@ -197,6 +197,11 @@ public class CSVUtils { return process(map); } + /** + * @param map + * the CSV row mapped into an {@link Map} + * @return the row processed object + */ public abstract R process(Map map); } } diff --git a/l2jserver2-common/src/main/java/com/l2jserver/util/transformer/TransformException.java b/l2jserver2-common/src/main/java/com/l2jserver/util/transformer/TransformException.java index c691742b9..1a3eae445 100644 --- a/l2jserver2-common/src/main/java/com/l2jserver/util/transformer/TransformException.java +++ b/l2jserver2-common/src/main/java/com/l2jserver/util/transformer/TransformException.java @@ -21,8 +21,14 @@ package com.l2jserver.util.transformer; * */ public class TransformException extends RuntimeException { + /** + * The Java Serialization API ID + */ private static final long serialVersionUID = 1L; + /** + * Creates a new instane + */ public TransformException() { } diff --git a/l2jserver2-common/src/test/java/com/l2jserver/model/id/allocator/BitSetIDAllocatorTest.java b/l2jserver2-common/src/test/java/com/l2jserver/model/id/allocator/BitSetIDAllocatorTest.java index 36061c321..70916cd78 100644 --- a/l2jserver2-common/src/test/java/com/l2jserver/model/id/allocator/BitSetIDAllocatorTest.java +++ b/l2jserver2-common/src/test/java/com/l2jserver/model/id/allocator/BitSetIDAllocatorTest.java @@ -26,14 +26,28 @@ import com.l2jserver.model.id.object.allocator.BitSetIDAllocator; import com.l2jserver.model.id.object.allocator.IDAllocator; import com.l2jserver.model.id.object.allocator.IDAllocatorException; +/** + * Tests for {@link BitSetIDAllocator} + * + * @author Rogiel + */ public class BitSetIDAllocatorTest { + /** + * The allocator + */ private final BitSetIDAllocator allocator = new BitSetIDAllocator(); + /** + * Preparation for tests + */ @Before public void tearUp() { allocator.init(); } + /** + * Test id allocation + */ @Test public void testAllocate() { final int id1 = allocator.allocate(); @@ -43,6 +57,9 @@ public class BitSetIDAllocatorTest { assertEquals(IDAllocator.FIRST_ID + 1, id2); } + /** + * Test restoring ID allocation + */ @Test public void testAllocateRestore() { final int id1 = IDAllocator.FIRST_ID; @@ -57,6 +74,9 @@ public class BitSetIDAllocatorTest { assertFalse(id2 == id3); } + /** + * Tests allocation of several ids + */ @Test public void testAllocateMany() { for (int i = 0; i < 100 * 1000; i++) { @@ -65,12 +85,18 @@ public class BitSetIDAllocatorTest { assertEquals(100000, allocator.getAllocatedIDs()); } + /** + * Tests allocation of an used id + */ @Test(expected = IDAllocatorException.class) public void testAllocateAlreadyAllocated() { final int id1 = allocator.allocate(); allocator.allocate(id1); } + /** + * Tests id release + */ @Test public void testRelease() { final int id = allocator.allocate(); @@ -78,6 +104,9 @@ public class BitSetIDAllocatorTest { assertEquals(0, allocator.getAllocatedIDs()); } + /** + * Tests releasing unallocated id + */ @Test(expected = IDAllocatorException.class) public void testReleaseUnalloc() { allocator.release(IDAllocator.FIRST_ID); diff --git a/l2jserver2-common/src/test/java/com/l2jserver/service/cache/SimpleCacheServiceTest.java b/l2jserver2-common/src/test/java/com/l2jserver/service/cache/SimpleCacheServiceTest.java index b333f14a5..d7df8a1d6 100644 --- a/l2jserver2-common/src/test/java/com/l2jserver/service/cache/SimpleCacheServiceTest.java +++ b/l2jserver2-common/src/test/java/com/l2jserver/service/cache/SimpleCacheServiceTest.java @@ -25,14 +25,30 @@ import org.junit.Test; import com.l2jserver.service.ServiceStartException; +/** + * Tests for {@link EhCacheService} + * + * @author Rogiel + */ public class SimpleCacheServiceTest { + /** + * The cache service + */ private final EhCacheService cacheService = new EhCacheService(); + /** + * Prepation for tests + * + * @throws ServiceStartException + */ @Before public void tearUp() throws ServiceStartException { cacheService.start(); } + /** + * Test proxy cache without arguments + */ @Test public void testNoArgs() { final TestCacheable cached = cacheService.decorate(TestCacheable.class, @@ -42,6 +58,9 @@ public class SimpleCacheServiceTest { Assert.assertEquals(output1, output2); } + /** + * Test proxy cache with same arguments + */ @Test public void testSameArgs() { final TestCacheable cached = cacheService.decorate(TestCacheable.class, @@ -51,6 +70,9 @@ public class SimpleCacheServiceTest { Assert.assertEquals(output1, output2); } + /** + * Test proxy cache with different arguments + */ @Test public void testDifferentArgs() { final TestCacheable cached = cacheService.decorate(TestCacheable.class, @@ -60,6 +82,9 @@ public class SimpleCacheServiceTest { Assert.assertFalse(output1 == output2); } + /** + * Test proxy cache with ignore caching + */ @Test public void testIgnoreCaching() { final TestCacheable cached = cacheService.decorate(TestCacheable.class, @@ -69,16 +94,41 @@ public class SimpleCacheServiceTest { Assert.assertFalse(output1 == output2); } + /** + * Simple cache interface + * + * @author Rogiel + * + */ public interface TestCacheable extends Cacheable { + /** + * @return a random number + */ public int random(); + /** + * @param arg + * any argument + * @return an random number + */ public int random(int arg); + /** + * @return an random number + */ @IgnoreCaching public int notCached(); } + /** + * Simple {@link TestCacheable} implementation + * + * @author Rogiel + */ public static class TestCacheableInstance implements TestCacheable { + /** + * Random number generator + */ private final Random random = new Random(); @Override diff --git a/l2jserver2-common/src/test/java/com/l2jserver/service/configuration/XMLConfigurationServiceTest.java b/l2jserver2-common/src/test/java/com/l2jserver/service/configuration/XMLConfigurationServiceTest.java index 16d1efac7..840659984 100644 --- a/l2jserver2-common/src/test/java/com/l2jserver/service/configuration/XMLConfigurationServiceTest.java +++ b/l2jserver2-common/src/test/java/com/l2jserver/service/configuration/XMLConfigurationServiceTest.java @@ -27,8 +27,9 @@ import com.l2jserver.service.ServiceStartException; import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath; /** - * @author Rogiel + * Tests for {@link XMLConfigurationService} * + * @author Rogiel */ public class XMLConfigurationServiceTest { /** @@ -36,6 +37,11 @@ public class XMLConfigurationServiceTest { */ private TestConfig config; + /** + * Preparation for tests + * + * @throws ServiceStartException + */ @Before public void tearUp() throws ServiceStartException { final XMLConfigurationService service = new XMLConfigurationService( @@ -44,27 +50,52 @@ public class XMLConfigurationServiceTest { config = service.get(TestConfig.class); } + /** + * Test config string + * + * @throws ServiceStartException + */ @Test public void testString() throws ServiceStartException { Assert.assertEquals("test", config.getTestString()); } + /** + * Test default value + * + * @throws ServiceStartException + */ @Test public void testDefaultValue() throws ServiceStartException { Assert.assertEquals("default", config.getDefaultTestString()); } + /** + * Test integer + * + * @throws ServiceStartException + */ @Test public void testInteger() throws ServiceStartException { Assert.assertEquals(256, config.getTestInteger()); } + /** + * Test setter + * + * @throws ServiceStartException + */ @Test public void testSetter() throws ServiceStartException { config.setTestString("new-value"); Assert.assertEquals("new-value", config.getTestString()); } + /** + * Test null setter + * + * @throws ServiceStartException + */ @Test public void testNullSetter() throws ServiceStartException { config.setTestString(null); @@ -77,22 +108,39 @@ public class XMLConfigurationServiceTest { * @author Rogiel */ public interface TestConfig extends Configuration { + /** + * @return an configuration string + */ @ConfigurationPropertyGetter(defaultValue = "test-default") @ConfigurationXPath("/configuration/test/testvalue") String getTestString(); + /** + * @param value + * any string + */ @ConfigurationPropertySetter @ConfigurationXPath("/configuration/test/testvalue") void setTestString(String value); + /** + * @return an configuration string + */ @ConfigurationPropertyGetter(defaultValue = "default") @ConfigurationXPath("/configuration/test/nonexistentkey") String getDefaultTestString(); + /** + * @return an configuration integer + */ @ConfigurationPropertyGetter(defaultValue = "0") @ConfigurationXPath("/configuration/test/integer") int getTestInteger(); + /** + * @param n + * any integer + */ @ConfigurationPropertySetter @ConfigurationXPath("/configuration/test/integer") void setTestInteger(Integer n); diff --git a/l2jserver2-common/src/test/java/com/l2jserver/util/ArrayUtilsTest.java b/l2jserver2-common/src/test/java/com/l2jserver/util/ArrayUtilsTest.java index e4e863ec9..506b10c06 100644 --- a/l2jserver2-common/src/test/java/com/l2jserver/util/ArrayUtilsTest.java +++ b/l2jserver2-common/src/test/java/com/l2jserver/util/ArrayUtilsTest.java @@ -23,10 +23,14 @@ import junit.framework.Assert; import org.junit.Test; /** - * @author Rogiel + * Tests for {@link ArrayUtils} * + * @author Rogiel */ public class ArrayUtilsTest extends ArrayUtils { + /** + * Test for {@link ArrayUtils#copyArrayExcept(Class, Object[], Object...)} + */ @Test public void testCopyArrayExcept() { final TestClass objA = new TestClass("a"); @@ -34,17 +38,26 @@ public class ArrayUtilsTest extends ArrayUtils { final TestClass objC = new TestClass("c"); TestClass[] arr = new TestClass[] { objA, objB, objC }; - TestClass[] selected = ArrayUtils.copyArrayExcept(TestClass[].class, - arr, objB); + TestClass[] selected = copyArrayExcept(TestClass[].class, arr, objB); System.out.println(Arrays.toString(selected)); Assert.assertTrue(Arrays.equals(new TestClass[] { objA, objC }, selected)); } + /** + * Simple test class + * @author Rogiel + */ private static class TestClass { + /** + * The name + */ private String name; + /** + * @param string the name + */ public TestClass(String string) { this.name = string; } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java index 8b0526a7d..74bffb275 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java @@ -41,6 +41,9 @@ import com.l2jserver.service.network.keygen.BlowfishKeygenService; * @author Rogiel */ public class L2JGameServerMain { + /** + * List of start services + */ public static final Class[][] SERVICES = { // core services { CacheService.class, ConfigurationService.class, diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_ACTION.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_ACTION.java index effefa6de..c23f21d73 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_ACTION.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_ACTION.java @@ -65,6 +65,9 @@ public class CM_CHAR_ACTION extends AbstractClientPacket { * The object id */ private int objectId; + /** + * The action origin + */ @SuppressWarnings("unused") private Coordinate origin; /** @@ -72,6 +75,11 @@ public class CM_CHAR_ACTION extends AbstractClientPacket { */ private CharacterAction action; + /** + * The character action type + * + * @author Rogiel + */ public enum CharacterAction { /** * If the player has clicked with the left mouse button. @@ -82,12 +90,24 @@ public class CM_CHAR_ACTION extends AbstractClientPacket { */ RIGHT_CLICK(1); + /** + * The action id + */ public final int id; + /** + * @param id + * the action id + */ CharacterAction(int id) { this.id = id; } + /** + * @param id + * the action id + * @return the {@link CharacterAction} represented by id + */ public static CharacterAction fromID(int id) { for (final CharacterAction action : values()) if (action.id == id) @@ -96,6 +116,11 @@ public class CM_CHAR_ACTION extends AbstractClientPacket { } } + /** + * @param idResolver the id resolver + * @param npcService the npc service + * @param itemService the item service + */ @Inject public CM_CHAR_ACTION(ObjectIDResolver idResolver, NPCService npcService, ItemService itemService) { @@ -119,8 +144,8 @@ public class CM_CHAR_ACTION extends AbstractClientPacket { final NPC npc = ((NPCID) id).getObject(); try { npcService.action(npc, conn.getCharacter(), action); - } catch(NPCControllerException e) { - if(e.getSystemMessage() != null) + } catch (NPCControllerException e) { + if (e.getSystemMessage() != null) conn.sendSystemMessage(e.getSystemMessage()); conn.sendActionFailed(); } catch (ActionServiceException | CannotSetTargetServiceException e) { diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_APPEARING.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_APPEARING.java index c02c2ec85..ab597a7a7 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_APPEARING.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_APPEARING.java @@ -41,6 +41,9 @@ public class CM_CHAR_APPEARING extends AbstractClientPacket { */ private final SpawnService spawnService; + /** + * @param spawnService the spawn service + */ @Inject public CM_CHAR_APPEARING(SpawnService spawnService) { this.spawnService = spawnService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CHAT.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CHAT.java index e9eb86cbd..69970a951 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CHAT.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CHAT.java @@ -49,11 +49,22 @@ public class CM_CHAR_CHAT extends AbstractClientPacket { */ private final ChatService chatService; + /** + * The message + */ private String message; + /** + * The message destination + */ private ChatMessageType destination; - + /** + * The message target + */ private String target; + /** + * @param chatService the chat service + */ @Inject public CM_CHAR_CHAT(ChatService chatService) { this.chatService = chatService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CREATE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CREATE.java index 5fd4cfbaa..95ae59120 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CREATE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_CREATE.java @@ -125,6 +125,9 @@ public class CM_CHAR_CREATE extends AbstractClientPacket { */ private CharacterFace face; + /** + * @param characterService the character service + */ @Inject public CM_CHAR_CREATE(CharacterService characterService) { this.characterService = characterService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_MOVE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_MOVE.java index 6a54d79f3..a2afb0618 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_MOVE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_MOVE.java @@ -50,20 +50,50 @@ public class CM_CHAR_MOVE extends AbstractClientPacket { private final CharacterService charService; // packet + /** + * The movement target + */ private Coordinate target; + /** + * The movement origin + */ private Coordinate origin; + /** + * The movement type + */ @SuppressWarnings("unused") private MovementType type; + /** + * Defines the movement action type + * @author Rogiel + */ public enum MovementType { - MOUSE(0x01), KEYBOARD(0x00); + /** + * The move action was issued by the mouse + */ + MOUSE(0x01), + /** + * The move action was issued by the keyboard + */ + KEYBOARD(0x00); + /** + * The type id + */ public final int id; + /** + * @param id the type id + */ MovementType(int id) { this.id = id; } + /** + * @param id the type id + * @return the {@link MovementType} represented by id + */ public static MovementType fromID(int id) { for (final MovementType type : values()) { if (type.id == id) @@ -73,6 +103,9 @@ public class CM_CHAR_MOVE extends AbstractClientPacket { } } + /** + * @param charService the character service + */ @Inject public CM_CHAR_MOVE(CharacterService charService) { this.charService = charService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_POSITION.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_POSITION.java index 77f0dadcc..ab096a967 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_POSITION.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_POSITION.java @@ -40,10 +40,19 @@ public class CM_CHAR_POSITION extends AbstractClientPacket { */ private final CharacterService charService; + /** + * The current position point + */ private Point3D point; + /** + * Extra data -> vehicle id + */ @SuppressWarnings("unused") private int extra; // vehicle id + /** + * @param charService the character service + */ @Inject public CM_CHAR_POSITION(CharacterService charService) { this.charService = charService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_SELECT.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_SELECT.java index 2262df852..0cb084b5f 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_SELECT.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_CHAR_SELECT.java @@ -50,6 +50,9 @@ public class CM_CHAR_SELECT extends AbstractClientPacket { */ private int slot; + /** + * @param characterDao the character dao + */ @Inject public CM_CHAR_SELECT(CharacterDAO characterDao) { this.characterDao = characterDao; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ENTER_WORLD.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ENTER_WORLD.java index 7518e227c..256a98214 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ENTER_WORLD.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ENTER_WORLD.java @@ -40,6 +40,9 @@ public class CM_ENTER_WORLD extends AbstractClientPacket { */ public static final int OPCODE = 0x11; + /** + * The logger + */ private final Logger log = LoggerFactory.getLogger(CM_ENTER_WORLD.class); /** @@ -47,6 +50,9 @@ public class CM_ENTER_WORLD extends AbstractClientPacket { */ private final CharacterService characterService; + /** + * @param characterService the character service + */ @Inject public CM_ENTER_WORLD(CharacterService characterService) { this.characterService = characterService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_EXT_REQ_SHORTCUT_REGISTRY.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_EXT_REQ_SHORTCUT_REGISTRY.java deleted file mode 100644 index 92f6ca4cd..000000000 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_EXT_REQ_SHORTCUT_REGISTRY.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of l2jserver2 . - * - * l2jserver2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * l2jserver2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with l2jserver2. If not, see . - */ -package com.l2jserver.game.net.packet.client; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.l2jserver.game.net.Lineage2Client; -import com.l2jserver.game.net.packet.AbstractClientPacket; - -/** - * The client is requesting a logout. Currently, when this packet is received - * the connection is immediately closed. - * - * @author Rogiel - */ -public class CM_EXT_REQ_SHORTCUT_REGISTRY extends AbstractClientPacket { - /** - * The packet OPCODE1 - */ - public static final int OPCODE1 = 0xd0; - /** - * The packet OPCODE2 - */ - public static final int OPCODE2 = 0x3d; - - /** - * The logger - */ - private static final Logger log = LoggerFactory - .getLogger(CM_EXT_REQ_SHORTCUT_REGISTRY.class); - - /** - * The shortcut type - */ - @SuppressWarnings("unused") - private int type; - /** - * The shortcut ID - */ - @SuppressWarnings("unused") - private int id; - @SuppressWarnings("unused") - private int slot; - @SuppressWarnings("unused") - private int page; - @SuppressWarnings("unused") - private int lvl; - @SuppressWarnings("unused") - private int characterType; - - @Override - public void read(Lineage2Client conn, ChannelBuffer buffer) { - } - - @Override - public void process(final Lineage2Client conn) { - log.debug("Logging out client {}", conn); - conn.close(); - } -} diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GG_KEY.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GG_KEY.java index 75faca68e..d2760fe61 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GG_KEY.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GG_KEY.java @@ -52,6 +52,9 @@ public class CM_GG_KEY extends AbstractClientPacket { */ private byte[] key = new byte[8]; + /** + * @param ggService the gameguard service + */ @Inject public CM_GG_KEY(GameGuardService ggService) { this.ggService = ggService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GOTO_LOBBY.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GOTO_LOBBY.java index 225cd91b9..f3ae98441 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GOTO_LOBBY.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_GOTO_LOBBY.java @@ -48,6 +48,9 @@ public class CM_GOTO_LOBBY extends AbstractClientPacket { */ private final CharacterDAO characterDao; + /** + * @param characterDao the character dao + */ @Inject public CM_GOTO_LOBBY(CharacterDAO characterDao) { this.characterDao = characterDao; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DESTROY.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DESTROY.java index 0d0a84eec..56fcc66fc 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DESTROY.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DESTROY.java @@ -43,6 +43,9 @@ public class CM_ITEM_DESTROY extends AbstractClientPacket { * The {@link ItemService} */ private final ItemService itemService; + /** + * The {@link ItemID} provider + */ private final ItemIDProvider itemIdProvider; /** diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DROP.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DROP.java index d93ce1afe..daffe682e 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DROP.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ITEM_DROP.java @@ -47,6 +47,9 @@ public class CM_ITEM_DROP extends AbstractClientPacket { * The {@link ItemService} */ private final ItemService itemService; + /** + * The {@link ItemID} provider + */ private final ItemIDProvider itemIdProvider; /** diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_PROTOCOL_VERSION.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_PROTOCOL_VERSION.java index 8a6a202e4..c92839116 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_PROTOCOL_VERSION.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_PROTOCOL_VERSION.java @@ -64,6 +64,9 @@ public class CM_PROTOCOL_VERSION extends AbstractClientPacket { */ private ProtocolVersion version; + /** + * @param keygen the keygen service + */ @Inject public CM_PROTOCOL_VERSION(BlowfishKeygenService keygen) { this.keygen = keygen; @@ -115,8 +118,4 @@ public class CM_PROTOCOL_VERSION extends AbstractClientPacket { } }); } - - public ProtocolVersion getVersion() { - return version; - } } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_REQUEST_CHAR_TEMPLATE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_REQUEST_CHAR_TEMPLATE.java index 8be060b69..a1f244e8b 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_REQUEST_CHAR_TEMPLATE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_REQUEST_CHAR_TEMPLATE.java @@ -64,6 +64,9 @@ public class CM_REQUEST_CHAR_TEMPLATE extends AbstractClientPacket { */ private final CharacterTemplateIDProvider idFactory; + /** + * @param idFactory the character template id provider + */ @Inject public CM_REQUEST_CHAR_TEMPLATE(CharacterTemplateIDProvider idFactory) { this.idFactory = idFactory; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_RESTART.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_RESTART.java index ec0b7cda7..e0e8368ab 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_RESTART.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_RESTART.java @@ -48,6 +48,10 @@ public class CM_RESTART extends AbstractClientPacket { */ private final CharacterDAO charDao; + /** + * @param charService the character service + * @param charDao the character dao + */ @Inject public CM_RESTART(CharacterService charService, CharacterDAO charDao) { this.charService = charService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_ATTACK.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_ATTACK.java index c7231dd53..1395aa123 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_ATTACK.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_ATTACK.java @@ -48,12 +48,22 @@ public class SM_ACTOR_ATTACK extends AbstractServerPacket { */ private final List hits = CollectionFactory.newList(); + /** + * @param attacker + * the attacked + * @param hits + * the hits + */ public SM_ACTOR_ATTACK(Actor attacker, AttackHit... hits) { super(OPCODE); this.attacker = attacker; Collections.addAll(this.hits, hits); } + /** + * @param hits + * the hits + */ public SM_ACTOR_ATTACK(AttackHit... hits) { this(hits[0].getAttacker(), hits); } @@ -90,6 +100,13 @@ public class SM_ACTOR_ATTACK extends AbstractServerPacket { buffer.writeInt(first.getTarget().getPoint().getZ()); } + /** + * Adds a new hit + * + * @param hit + * the hit + * @return this instance + */ public SM_ACTOR_ATTACK add(AttackHit hit) { hits.add(hit); return this; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_CHAT.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_CHAT.java index 82069d509..8881897a7 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_CHAT.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_CHAT.java @@ -54,6 +54,11 @@ public class SM_ACTOR_CHAT extends AbstractServerPacket { */ private int messageID = 0; + /** + * @param character the actor + * @param destination the destination + * @param message the message + */ public SM_ACTOR_CHAT(Actor character, ChatMessageType destination, String message) { super(OPCODE); this.actor = character; @@ -61,6 +66,11 @@ public class SM_ACTOR_CHAT extends AbstractServerPacket { this.message = message; } + /** + * @param actor the actor + * @param destination the destination + * @param messageID the message id + */ public SM_ACTOR_CHAT(Actor actor, ChatMessageType destination, int messageID) { super(OPCODE); this.actor = actor; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_DIE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_DIE.java index aa932131a..d31f59ad7 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_DIE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_DIE.java @@ -40,6 +40,10 @@ public class SM_ACTOR_DIE extends AbstractServerPacket { */ private final Actor actor; + /** + * @param actor + * the actor + */ public SM_ACTOR_DIE(Actor actor) { super(OPCODE); this.actor = actor; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_MOVE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_MOVE.java index cedc22010..928648135 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_MOVE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_MOVE.java @@ -45,6 +45,10 @@ public class SM_ACTOR_MOVE extends AbstractServerPacket { */ private Coordinate target; + /** + * @param actor the actor + * @param target the target + */ public SM_ACTOR_MOVE(Actor actor, Coordinate target) { super(OPCODE); this.actor = actor; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_POSITION.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_POSITION.java index 2ed13c4b5..63d13a0c2 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_POSITION.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_POSITION.java @@ -39,6 +39,9 @@ public class SM_ACTOR_POSITION extends AbstractServerPacket { */ private final Actor actor; + /** + * @param actor the actor + */ public SM_ACTOR_POSITION(Actor actor) { super(OPCODE); this.actor = actor; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_STATUS_UPDATE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_STATUS_UPDATE.java index 39d42e45a..c0ae6d17f 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_STATUS_UPDATE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ACTOR_STATUS_UPDATE.java @@ -44,29 +44,151 @@ public class SM_ACTOR_STATUS_UPDATE extends AbstractServerPacket { * @author Rogiel */ public enum Stat { - LEVEL(0x01), EXPERIENCE(0x02), STR(0x03), DEX(0x04), CON(0x05), INT( - 0x06), WIT(0x07), MEN(0x08), + /** + * Updates the character level + */ + LEVEL(0x01), + /** + * Updates the character experience + */ + EXPERIENCE(0x02), + /** + * Updates the character strength + */ + STR(0x03), + /** + * Updates the character dexterity + */ + DEX(0x04), - HP(0x09), MAX_HP(0x0a), MP(0x0b), MAX_MP(0x0c), + /** + * Updates the character concentration + */ + CON(0x05), + /** + * Updates the character intelligence + */ + INT(0x06), + /** + * Updates the character witness + */ + WIT(0x07), + /** + * Updates the character mentality + */ + MEN(0x08), + /** + * Updates the character hp + */ + HP(0x09), + /** + * Updates the character maximum hp + */ + MAX_HP(0x0a), + /** + * Updates the character hp + */ + MP(0x0b), + /** + * Updates the character maximum mp + */ + MAX_MP(0x0c), + /** + * Updates the character sp + */ + SP(0x0d), + /** + * Updates the character load + */ + LOAD(0x0e), + /** + * Updates the character maximum load + */ + MAX_LOAD(0x0f), + /** + * Updates the character physical attack + */ + PHYSICAL_ATK(0x11), + /** + * Updates the character attack speed + */ + ATTACK_SPEED(0x12), + /** + * Updates the character physical defense + */ + PHYSICAL_DEFENSE(0x13), + /** + * Updates the character evasion + */ + EVASION(0x14), + /** + * Updates the character accuracy + */ + ACCURACY(0x15), + /** + * Updates the character critical + */ + CRITICAL(0x16), + /** + * Updates the character magical attack + */ + MAGICAL_ATTACK(0x17), + /** + * Updates the character cast speed + */ + CAST_SPEED(0x18), + /** + * Updates the character magical defense + */ + MAGICAL_DEFENSE(0x19), - SP(0x0d), LOAD(0x0e), MAX_LOAD(0x0f), + /** + * Updates the character pvp flag + */ + PVP_FLAG(0x1a), - PHYSICAL_ATK(0x11), ATTACK_SPEED(0x12), PHYSICAL_DEFENSE(0x13), EVASION( - 0x14), ACCURACY(0x15), CRITICAL(0x16), MAGICAL_ATTACK(0x17), CAST_SPEED( - 0x18), MAGICAL_DEFENSE(0x19), PVP_FLAG(0x1a), KARMA(0x1b), + /** + * Updates the character karma + */ + KARMA(0x1b), - CP(0x21), MAX_CP(0x22); + /** + * Updates the character cp + */ + CP(0x21), + /** + * Updates the character max cp + */ + MAX_CP(0x22); + + /** + * The stat id + */ public final int id; + /** + * @param id + * the stat id + */ Stat(int id) { this.id = id; } } + /** + * The set of updates to be sent + */ private final Map update = CollectionFactory.newMap(); + /** + * The actor to be updated + */ private final Actor actor; + /** + * @param actor + * the actor + */ public SM_ACTOR_STATUS_UPDATE(Actor actor) { super(OPCODE); this.actor = actor; @@ -83,6 +205,13 @@ public class SM_ACTOR_STATUS_UPDATE extends AbstractServerPacket { } } + /** + * @param stat + * the stat + * @param value + * the stat value + * @return this instances + */ public SM_ACTOR_STATUS_UPDATE add(Stat stat, int value) { update.put(stat, value); return this; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_FAIL.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_FAIL.java index 414f88d06..f2d86e3fe 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_FAIL.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_FAIL.java @@ -83,11 +83,17 @@ public class SM_CHAR_CREATE_FAIL extends AbstractServerPacket { */ public final int id; + /** + * @param id the reason id + */ Reason(int id) { this.id = id; } } + /** + * @param reason the reason + */ public SM_CHAR_CREATE_FAIL(Reason reason) { super(OPCODE); this.reason = reason; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_OK.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_OK.java index d2431704a..679cc28cb 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_OK.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_CREATE_OK.java @@ -37,6 +37,9 @@ public class SM_CHAR_CREATE_OK extends AbstractServerPacket { */ public static final SM_CHAR_CREATE_OK INSTANCE = new SM_CHAR_CREATE_OK(); + /** + * Creates a new instance + */ public SM_CHAR_CREATE_OK() { super(OPCODE); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO.java index a454ae5c6..4fea9d458 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO.java @@ -76,6 +76,9 @@ public class SM_CHAR_INFO extends AbstractServerPacket { */ private L2Character character; + /** + * @param character the character + */ public SM_CHAR_INFO(L2Character character) { super(OPCODE); this.character = character; @@ -338,6 +341,16 @@ public class SM_CHAR_INFO extends AbstractServerPacket { buffer.writeInt(0x00); // special effects } + /** + * Writes the paperdoll object id + * + * @param buffer + * the buffer + * @param character + * the character + * @param paperdoll + * the slot + */ private void writePaperdollObjectID(ChannelBuffer buffer, L2Character character, InventoryPaperdoll paperdoll) { final Item item = character.getInventory().getItem(paperdoll); @@ -347,6 +360,16 @@ public class SM_CHAR_INFO extends AbstractServerPacket { buffer.writeInt(id); } + /** + * Writes the paperdoll item id + * + * @param buffer + * the buffer + * @param character + * the character + * @param paperdoll + * the slot + */ private void writePaperdollItemID(ChannelBuffer buffer, L2Character character, InventoryPaperdoll paperdoll) { final Item item = character.getInventory().getItem(paperdoll); @@ -356,6 +379,16 @@ public class SM_CHAR_INFO extends AbstractServerPacket { buffer.writeInt(id); } + /** + * Writes the paperdoll augument id + * + * @param buffer + * the buffer + * @param character + * the character + * @param paperdoll + * the slot + */ private void writePaperdollAugumentID(ChannelBuffer buffer, L2Character character, InventoryPaperdoll paperdoll) { buffer.writeInt(0x00); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_BROADCAST.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_BROADCAST.java index 06f7aff50..dd87720d2 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_BROADCAST.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_BROADCAST.java @@ -59,8 +59,15 @@ public class SM_CHAR_INFO_BROADCAST extends AbstractServerPacket { */ public static final int OPCODE = 0x31; + /** + * The character + */ private final L2Character character; + /** + * @param character + * the character + */ public SM_CHAR_INFO_BROADCAST(L2Character character) { super(OPCODE); this.character = character; @@ -248,6 +255,16 @@ public class SM_CHAR_INFO_BROADCAST extends AbstractServerPacket { buffer.writeInt(0x00); // special effect } + /** + * Writes the paperdoll item id + * + * @param buffer + * the buffer + * @param character + * the character + * @param paperdoll + * the slot + */ private void writePaperdollItemID(ChannelBuffer buffer, L2Character character, InventoryPaperdoll paperdoll) { final Item item = character.getInventory().getItem(paperdoll); @@ -257,6 +274,16 @@ public class SM_CHAR_INFO_BROADCAST extends AbstractServerPacket { buffer.writeInt(id); } + /** + * Writes the paperdoll augument id + * + * @param buffer + * the buffer + * @param character + * the character + * @param paperdoll + * the slot + */ private void writePaperdollAugumentID(ChannelBuffer buffer, L2Character character, InventoryPaperdoll paperdoll) { buffer.writeInt(0x00); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_EXTRA.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_EXTRA.java index afc3344f2..78381469c 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_EXTRA.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INFO_EXTRA.java @@ -38,6 +38,9 @@ public class SM_CHAR_INFO_EXTRA extends AbstractServerPacket { */ private L2Character character; + /** + * @param character the character + */ public SM_CHAR_INFO_EXTRA(L2Character character) { super(OPCODE); this.character = character; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INVENTORY.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INVENTORY.java index e418b7035..ee9e188ff 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INVENTORY.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_INVENTORY.java @@ -44,6 +44,9 @@ public class SM_CHAR_INVENTORY extends AbstractServerPacket { */ private boolean showWindow = false; + /** + * @param inventory the inventory + */ public SM_CHAR_INVENTORY(CharacterInventory inventory) { super(OPCODE); this.inventory = inventory; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_LIST.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_LIST.java index 343cea9a0..32858d26b 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_LIST.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_LIST.java @@ -79,6 +79,16 @@ public class SM_CHAR_LIST extends AbstractServerPacket { */ private final L2Character[] characters; + /** + * @param loginName + * the account id + * @param sessionId + * the session id + * @param lastCharacterId + * the last character used + * @param characters + * the characters + */ public SM_CHAR_LIST(String loginName, int sessionId, int lastCharacterId, L2Character... characters) { super(OPCODE); @@ -88,12 +98,26 @@ public class SM_CHAR_LIST extends AbstractServerPacket { this.characters = characters; } + /** + * @param session + * the session + * @param characters + * the characters + * @return an {@link SM_CHAR_LIST} instance + */ public static SM_CHAR_LIST fromL2Session(Lineage2Session session, L2Character... characters) { return new SM_CHAR_LIST(session.getAccountID().getID(), session.getPlayKey2(), -1, characters); } + /** + * @param session + * the session + * @param characters + * the characters + * @return an {@link SM_CHAR_LIST} instance + */ public static SM_CHAR_LIST fromL2Session(Lineage2Session session, Collection characters) { return fromL2Session(session, @@ -220,6 +244,16 @@ public class SM_CHAR_LIST extends AbstractServerPacket { } } + /** + * Writes the paperdoll item id + * + * @param buffer + * the buffer + * @param character + * the character + * @param paperdoll + * the slot + */ private void writePaperdollItemID(ChannelBuffer buffer, L2Character character, InventoryPaperdoll paperdoll) { final Item item = character.getInventory().getItem(paperdoll); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_MOVE_TYPE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_MOVE_TYPE.java index a3abdc7ba..da77b6c97 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_MOVE_TYPE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_MOVE_TYPE.java @@ -38,6 +38,9 @@ public class SM_CHAR_MOVE_TYPE extends AbstractServerPacket { */ private final L2Character character; + /** + * @param character the character + */ public SM_CHAR_MOVE_TYPE(L2Character character) { super(OPCODE); this.character = character; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_OPEN_MAP.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_OPEN_MAP.java index a265353a3..dfcf9de94 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_OPEN_MAP.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_OPEN_MAP.java @@ -37,6 +37,9 @@ public class SM_CHAR_OPEN_MAP extends AbstractServerPacket { */ private final int mapID; + /** + * @param mapID the map id + */ public SM_CHAR_OPEN_MAP(int mapID) { super(OPCODE); this.mapID = mapID; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_RESTART.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_RESTART.java index 4dc058288..64c185cf0 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_RESTART.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_RESTART.java @@ -37,15 +37,25 @@ public class SM_CHAR_RESTART extends AbstractServerPacket { */ private boolean state; + /** + * @param state + * the state + */ public SM_CHAR_RESTART(boolean state) { super(OPCODE); this.state = state; } + /** + * @return an OK instance of this packet + */ public static SM_CHAR_RESTART ok() { return new SM_CHAR_RESTART(true); } + /** + * @return an FAILED instance of this packet + */ public static SM_CHAR_RESTART denied() { return new SM_CHAR_RESTART(false); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SELECTED.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SELECTED.java index 2d529c912..3eacefdb7 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SELECTED.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SELECTED.java @@ -41,6 +41,9 @@ public class SM_CHAR_SELECTED extends AbstractServerPacket { */ private final L2Character character; + /** + * @param character the character + */ public SM_CHAR_SELECTED(L2Character character) { super(OPCODE); this.character = character; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_LIST.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_LIST.java index 5fed1804f..9e4851478 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_LIST.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_LIST.java @@ -39,6 +39,10 @@ public class SM_CHAR_SHORTCUT_LIST extends AbstractServerPacket { */ private final CharacterShortcutContainer shortcuts; + /** + * @param shortcuts + * the shortcuts container + */ public SM_CHAR_SHORTCUT_LIST(CharacterShortcutContainer shortcuts) { super(OPCODE); this.shortcuts = shortcuts; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_REGISTER.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_REGISTER.java index 58afeb0f7..741b24372 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_REGISTER.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_SHORTCUT_REGISTER.java @@ -38,6 +38,10 @@ public class SM_CHAR_SHORTCUT_REGISTER extends AbstractServerPacket { */ private final CharacterShortcut shortcut; + /** + * @param shortcut + * the shortcut registered + */ public SM_CHAR_SHORTCUT_REGISTER(CharacterShortcut shortcut) { super(OPCODE); this.shortcut = shortcut; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_STOP.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_STOP.java index 8bd5937e0..19f6e5111 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_STOP.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_STOP.java @@ -33,8 +33,14 @@ public class SM_CHAR_STOP extends AbstractServerPacket { */ public static final int OPCODE = 0x47; + /** + * The character + */ private L2Character character; + /** + * @param character the character + */ public SM_CHAR_STOP(L2Character character) { super(OPCODE); this.character = character; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET.java index 934b8bd33..1bffb16ce 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET.java @@ -38,14 +38,27 @@ public class SM_CHAR_TARGET extends AbstractServerPacket { * The selected character */ private final Actor object; + /** + * The name color + */ private int color; + /** + * @param object + * the target + * @param color + * the name color + */ public SM_CHAR_TARGET(Actor object, int color) { super(OPCODE); this.object = object; this.color = color; } + /** + * @param object + * the target + */ public SM_CHAR_TARGET(Actor object) { this(object, 0); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET_UNSELECT.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET_UNSELECT.java index e073cd8ae..fdb9e2a52 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET_UNSELECT.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TARGET_UNSELECT.java @@ -39,6 +39,9 @@ public class SM_CHAR_TARGET_UNSELECT extends AbstractServerPacket { */ private final L2Character character; + /** + * @param character the character + */ public SM_CHAR_TARGET_UNSELECT(L2Character character) { super(OPCODE); this.character = character; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TELEPORT.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TELEPORT.java index cac03423b..1543a3110 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TELEPORT.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TELEPORT.java @@ -44,6 +44,10 @@ public class SM_CHAR_TELEPORT extends AbstractServerPacket { */ private final Point3D point; + /** + * @param character the character + * @param point the teleport point + */ public SM_CHAR_TELEPORT(L2Character character, Point3D point) { super(OPCODE); this.character = character; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TEMPLATE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TEMPLATE.java index ea9ce0349..e0de41a7a 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TEMPLATE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_CHAR_TEMPLATE.java @@ -38,6 +38,9 @@ public class SM_CHAR_TEMPLATE extends AbstractServerPacket { */ private CharacterTemplate[] templates; + /** + * @param templates the character templates + */ public SM_CHAR_TEMPLATE(CharacterTemplate... templates) { super(OPCODE); this.templates = templates; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_COMMUNITY_HTML.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_COMMUNITY_HTML.java index bd65d59d0..3fde27956 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_COMMUNITY_HTML.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_COMMUNITY_HTML.java @@ -41,16 +41,25 @@ public class SM_COMMUNITY_HTML extends AbstractServerPacket { */ private final String html; + /** + * @param html the html + */ public SM_COMMUNITY_HTML(String html) { super(OPCODE); this.html = html; } + /** + * @param html the html + */ public SM_COMMUNITY_HTML(Html html) { super(OPCODE); this.html = html.toHtml(); } + /** + * @param template the html template + */ public SM_COMMUNITY_HTML(HtmlTemplate template) { super(OPCODE); this.html = template.toHtmlString(); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_FORT_INFO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_FORT_INFO.java index 1d447e5d4..afb546bc8 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_FORT_INFO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_FORT_INFO.java @@ -33,6 +33,9 @@ public class SM_FORT_INFO extends AbstractServerPacket { */ public static final int OPCODE = 0xfe; + /** + * Creates a new instance + */ public SM_FORT_INFO() { super(OPCODE); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_GG_QUERY.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_GG_QUERY.java index 3b90bcaf0..5b6af68a8 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_GG_QUERY.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_GG_QUERY.java @@ -33,9 +33,15 @@ public class SM_GG_QUERY extends AbstractServerPacket { * The packet OPCODE */ public static final int OPCODE = 0x74; - + /** + * The GG key + */ private final int[] key; + /** + * @param key + * the game guard key + */ public SM_GG_QUERY(int[] key) { super(OPCODE); Preconditions.checkArgument(key.length == 4, @@ -43,6 +49,16 @@ public class SM_GG_QUERY extends AbstractServerPacket { this.key = key; } + /** + * @param key1 + * the game guard key 1 + * @param key2 + * the game guard key 2 + * @param key3 + * the game guard key 3 + * @param key4 + * the game guard key 4 + */ public SM_GG_QUERY(int key1, int key2, int key3, int key4) { super(OPCODE); this.key = new int[4]; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_HTML.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_HTML.java index b797a8110..0279f6b76 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_HTML.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_HTML.java @@ -45,32 +45,62 @@ public class SM_HTML extends AbstractServerPacket { */ private final String html; + /** + * @param npc + * the npc instance + * @param html + * the html + */ public SM_HTML(NPC npc, String html) { super(OPCODE); this.npc = npc; this.html = html; } + /** + * @param npc + * the npc instance + * @param html + * the html + */ public SM_HTML(NPC npc, Html html) { super(OPCODE); this.npc = npc; this.html = html.toHtml(); } + /** + * @param npc + * the npc instance + * @param template + * the html template + */ public SM_HTML(NPC npc, HtmlTemplate template) { super(OPCODE); this.npc = npc; this.html = template.toHtmlString(); } + /** + * @param html + * the html + */ public SM_HTML(String html) { this(null, html); } + /** + * @param html + * the html + */ public SM_HTML(Html html) { this(null, html); } + /** + * @param template + * the html template + */ public SM_HTML(HtmlTemplate template) { this(null, template); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ITEM_GROUND.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ITEM_GROUND.java index ff9fabcf7..77b750763 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ITEM_GROUND.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_ITEM_GROUND.java @@ -32,9 +32,14 @@ public class SM_ITEM_GROUND extends AbstractServerPacket { * The packet OPCODE */ public static final int OPCODE = 0x16; - + /** + * The item that is on the ground + */ private final Item item; + /** + * @param item the item that is on the ground + */ public SM_ITEM_GROUND(Item item) { super(OPCODE); this.item = item; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_KEY.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_KEY.java index 35590aa90..fc823abf8 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_KEY.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_KEY.java @@ -49,6 +49,12 @@ public class SM_KEY extends AbstractServerPacket { */ private boolean status; + /** + * @param key + * the cryptography key + * @param status + * the status + */ public SM_KEY(Lineage2CryptographyKey key, boolean status) { super(OPCODE); this.key = Arrays.copyOfRange(key.key, 0, 8); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_MANOR_LIST.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_MANOR_LIST.java index a9d06c8da..c827b369f 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_MANOR_LIST.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_MANOR_LIST.java @@ -38,6 +38,9 @@ public class SM_MANOR_LIST extends AbstractServerPacket { */ private String[] manors; + /** + * @param manors the manors + */ public SM_MANOR_LIST(String... manors) { super(OPCODE); this.manors = manors; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_NPC_INFO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_NPC_INFO.java index 09c31a55f..50f9d0638 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_NPC_INFO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_NPC_INFO.java @@ -34,9 +34,14 @@ public class SM_NPC_INFO extends AbstractServerPacket { * The packet OPCODE */ public static final int OPCODE = 0x0c; - + /** + * The {@link NPC} + */ private final NPC npc; + /** + * @param npc the npc + */ public SM_NPC_INFO(NPC npc) { super(OPCODE); this.npc = npc; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_OBJECT_REMOVE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_OBJECT_REMOVE.java index 1bcf0b7e6..323936b50 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_OBJECT_REMOVE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_OBJECT_REMOVE.java @@ -39,6 +39,10 @@ public class SM_OBJECT_REMOVE extends AbstractServerPacket { */ private final PositionableObject object; + /** + * @param object + * the object to be removed + */ public SM_OBJECT_REMOVE(PositionableObject object) { super(OPCODE); this.object = object; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SERVER_OBJECT.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SERVER_OBJECT.java index 56200684d..10fa77f37 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SERVER_OBJECT.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SERVER_OBJECT.java @@ -35,9 +35,15 @@ public class SM_SERVER_OBJECT extends AbstractServerPacket { * The packet OPCODE */ public static final int OPCODE = 0x92; - + /** + * The {@link NPC} + */ private final NPC npc; + /** + * @param npc + * the npc + */ public SM_SERVER_OBJECT(NPC npc) { super(OPCODE); this.npc = npc; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SYSTEM_MESSAGE.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SYSTEM_MESSAGE.java index 206e217f6..5ccaf6ddc 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SYSTEM_MESSAGE.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/server/SM_SYSTEM_MESSAGE.java @@ -23,12 +23,14 @@ import org.jboss.netty.buffer.ChannelBuffer; import com.l2jserver.game.net.Lineage2Client; import com.l2jserver.game.net.SystemMessage; import com.l2jserver.game.net.packet.AbstractServerPacket; +import com.l2jserver.model.game.Castle; import com.l2jserver.model.game.Fort; import com.l2jserver.model.game.Skill; import com.l2jserver.model.template.SkillTemplate; import com.l2jserver.model.template.item.ItemTemplate; import com.l2jserver.model.world.Actor; import com.l2jserver.model.world.Item; +import com.l2jserver.model.world.NPC; import com.l2jserver.util.BufferUtils; import com.l2jserver.util.factory.CollectionFactory; @@ -54,22 +56,69 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { private List params = CollectionFactory .newList(); + /** + * System message parameter IDs + * + * @author Rogiel + */ public interface SystemMessagePacketParameter { + /** + * String parameter + */ public static final byte TYPE_SYSTEM_STRING = 13; + /** + * Player name parameter + */ public static final byte TYPE_PLAYER_NAME = 12; // id 11 - unknown + /** + * Instance name parameter + */ public static final byte TYPE_INSTANCE_NAME = 10; + /** + * Element name parameter + */ public static final byte TYPE_ELEMENT_NAME = 9; // id 8 - same as 3 + /** + * Zone name parameter + */ public static final byte TYPE_ZONE_NAME = 7; + /** + * {@link Item} number parameter + */ public static final byte TYPE_ITEM_NUMBER = 6; + /** + * {@link Castle} name parameter + */ public static final byte TYPE_CASTLE_NAME = 5; + /** + * {@link Skill} name parameter + */ public static final byte TYPE_SKILL_NAME = 4; + /** + * {@link Item} name parameter + */ public static final byte TYPE_ITEM_NAME = 3; + /** + * {@link NPC} name parameter + */ public static final byte TYPE_NPC_NAME = 2; + /** + * Number parameter + */ public static final byte TYPE_NUMBER = 1; + /** + * Text parameter + */ public static final byte TYPE_TEXT = 0; + /** + * @param conn + * the connection + * @param buffer + * the buffer + */ void write(Lineage2Client conn, ChannelBuffer buffer); } @@ -93,6 +142,13 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { } } + /** + * Adds an string parameter + * + * @param text + * the text + * @return this instance + */ public final SM_SYSTEM_MESSAGE addString(final String text) { params.add(new SystemMessagePacketParameter() { @Override @@ -126,6 +182,13 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { return this; } + /** + * Adds an number parameter + * + * @param number + * the number + * @return this instance + */ public final SM_SYSTEM_MESSAGE addNumber(final int number) { params.add(new SystemMessagePacketParameter() { @Override @@ -137,6 +200,13 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { return this; } + /** + * Adds an item count parameter + * + * @param number + * the number + * @return this instance + */ public final SM_SYSTEM_MESSAGE addItemCount(final long number) { params.add(new SystemMessagePacketParameter() { @Override @@ -148,6 +218,13 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { return this; } + /** + * Adds an the actor name + * + * @param actor + * the actor + * @return this instance + */ public final SM_SYSTEM_MESSAGE addActorName(final Actor actor) { // params.add(new SystemMessagePacketParameter() { // @Override @@ -160,6 +237,13 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { return this; } + /** + * Adds the item name + * + * @param item + * the item + * @return this instance + */ public final SM_SYSTEM_MESSAGE addItem(final ItemTemplate item) { params.add(new SystemMessagePacketParameter() { @Override @@ -171,10 +255,29 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { return this; } + /** + * Adds the item name + * + * @param item + * the item + * @return this instance + */ public final SM_SYSTEM_MESSAGE addItem(final Item item) { return addItem(item.getTemplateID().getTemplate()); } + /** + * Adds the zone name + * + * @param x + * the x + * @param y + * the y + * @param z + * the z + * + * @return this instance + */ public final SM_SYSTEM_MESSAGE addZoneName(final int x, final int y, final int z) { params.add(new SystemMessagePacketParameter() { @@ -189,6 +292,13 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { return this; } + /** + * @param skill + * the skill template + * @param level + * the skill level + * @return this instance + */ public final SM_SYSTEM_MESSAGE addSkill(final SkillTemplate skill, final int level) { params.add(new SystemMessagePacketParameter() { @@ -202,6 +312,11 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket { return this; } + /** + * @param skill + * the skill + * @return this instance + */ public final SM_SYSTEM_MESSAGE addSkill(final Skill skill) { return addSkill(skill.getTemplate(), skill.getLevel()); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/CharacterShortcutID.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/CharacterShortcutID.java index 88a4e4365..726aab5e0 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/CharacterShortcutID.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/id/CharacterShortcutID.java @@ -32,6 +32,9 @@ import com.l2jserver.model.id.provider.IDProvider; */ public class CharacterShortcutID extends AbstractModelID { + /** + * The {@link CharacterShortcutDAO} instance + */ private final CharacterShortcutDAO shortcutDao; /** diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/SkillTemplate.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/SkillTemplate.java index ac5a5be0c..b504154ce 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/SkillTemplate.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/SkillTemplate.java @@ -44,13 +44,25 @@ import com.l2jserver.util.jaxb.SkillTemplateIDAdapter; @XmlType(namespace = "http://schemas.l2jserver2.com/skill", name = "SkillType") @XmlAccessorType(XmlAccessType.FIELD) public class SkillTemplate extends AbstractTemplate { + /** + * The skill id + */ @XmlAttribute(name = "id", required = true) @XmlJavaTypeAdapter(value = SkillTemplateIDAdapter.class) protected SkillTemplateID id; + /** + * The skill name + */ @XmlAttribute(name = "name", required = true) protected String name; + /** + * The skill delay + */ @XmlAttribute(name = "delay") protected int delay; + /** + * The skill cooldown + */ @XmlAttribute(name = "cooldown") protected int cooldown; @@ -59,6 +71,9 @@ public class SkillTemplate extends AbstractTemplate { */ protected int maximumLevel = 1; + /** + * The skill effects + */ @XmlElements({ @XmlElement(name = "teleport", type = TeleportEffectTemplate.class) }) protected EffectTemplate[] effects; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterClass.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterClass.java index 188a773ed..74a94fa34 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterClass.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterClass.java @@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlType; * @author Rogiel */ @XmlType(name = "CharacterClassType") +@SuppressWarnings("javadoc") public enum CharacterClass { /** * Human fighter diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterRace.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterRace.java index 64fa8aa92..b4b25e216 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterRace.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterRace.java @@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlType; * @author Rogiel */ @XmlType(name = "CharacterRaceType") +@SuppressWarnings("javadoc") public enum CharacterRace { HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(0x05); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterTemplate.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterTemplate.java index fcd33c874..041125675 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterTemplate.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/character/CharacterTemplate.java @@ -39,129 +39,291 @@ import com.l2jserver.util.jaxb.CharacterTemplateIDAdapter; @XmlType(namespace = "http://schemas.l2jserver2.com/character", name = "CharacterType") @XmlAccessorType(XmlAccessType.FIELD) public class CharacterTemplate extends ActorTemplate { + /** + * The character templat eid + */ @XmlJavaTypeAdapter(CharacterTemplateIDAdapter.class) @XmlAttribute(name = "class", required = true) protected CharacterTemplateID id = null; + /** + * The character stats + */ @XmlElement(name = "stats", required = true) protected CharacterStatsMetadata stats = null; + /** + * Defines the character stats + * + * @author Rogiel + */ @XmlType(name = "CharacterStatsType") protected static class CharacterStatsMetadata { + /** + * The character level + */ @XmlAttribute(name = "level", required = true) protected int level = 0; + /** + * Whether the character is an crafter or not + */ @XmlAttribute(name = "crafter", required = false) protected boolean crafter = false; + /** + * The character HP descriptor + */ @XmlElement(name = "hp", required = true) protected Stat hp = null; + /** + * The character MP descriptor + */ @XmlElement(name = "mp", required = true) protected Stat mp = null; + /** + * The character CP descriptor + */ @XmlElement(name = "cp", required = true) protected Stat cp = null; + /** + * Describes an character stat (HP, MP or CP) + * + * @author Rogiel + */ @XmlType(name = "") protected static class Stat { + /** + * The base value + */ @XmlAttribute(name = "base", required = true) protected double base = 0; + /** + * The value modified + */ @XmlAttribute(name = "modifier", required = true) protected double modifier = 0; + /** + * The value add + */ @XmlAttribute(name = "add", required = true) protected double add = 0; } + /** + * The character attack data + */ @XmlElement(name = "attack", required = true) protected AttackMetadata attack = null; + /** + * Defines the character attack data + * + * @author Rogiel + */ @XmlType(name = "CharacterAttackType") protected static class AttackMetadata { + /** + * The character evasion + */ @XmlAttribute(name = "evasion", required = true) protected int evasion = 0; + /** + * The character critical chance + */ @XmlAttribute(name = "critical", required = true) protected int critical = 0; + /** + * The character accuracy + */ @XmlAttribute(name = "accuracy", required = true) protected int accuracy = 0; + /** + * The character physical attack data + */ @XmlElement(name = "physical", required = true) protected AttackValueMetadata physical = null; + /** + * The character magical attack data + */ @XmlElement(name = "magical", required = true) protected AttackValueMetadata magical = null; + /** + * Defines an attack attribute + * + * @author Rogiel + */ @XmlType(name = "") protected static class AttackValueMetadata { + /** + * The damage dealt + */ @XmlAttribute(name = "damage", required = true) protected double damage = 0; + /** + * The attack speed + */ @XmlAttribute(name = "speed", required = true) protected double speed = 0; } } + /** + * The character defense data + */ @XmlElement(name = "defense", required = true) protected DefenseMetadata defense = null; + /** + * Defines the character defense data + * + * @author Rogiel + */ @XmlType(name = "CharacterDefenseType") protected static class DefenseMetadata { + /** + * The character physical defense + */ @XmlElement(name = "physical", required = true) protected DefenseValueMetadata physical = null; + /** + * The character magical defense + */ @XmlElement(name = "magical", required = true) protected DefenseValueMetadata magical = null; + /** + * Defines an defense attribute + * + * @author Rogiel + */ @XmlType(name = "") protected static class DefenseValueMetadata { + /** + * The defense value + */ @XmlAttribute(name = "value", required = true) protected double value = 0; } } + /** + * The charatcer movement medatata + */ @XmlElement(name = "move", required = true) protected MoveMetadata move = null; + /** + * Defines the character movement + * @author Rogiel + * + */ @XmlType(name = "CharacterMovementType") protected static class MoveMetadata { + /** + * The run speed + */ @XmlAttribute(name = "run", required = true) protected double run = 0; + /** + * The walk speed + */ @XmlAttribute(name = "walk", required = true) protected double walk = 0; } + /** + * The character base stats + */ @XmlElement(name = "base", required = true) protected BaseMetadata base = null; + /** + * Defines an character base stats + * @author Rogiel + */ @XmlType(name = "CharacterBaseStatsType") protected static class BaseMetadata { + /** + * The intelligence + */ @XmlAttribute(name = "int", required = true) protected int intelligence = 0; + /** + * The strength + */ @XmlAttribute(name = "str", required = true) protected int strength = 0; + /** + * The concentration + */ @XmlAttribute(name = "con", required = true) protected int concentration = 0; + /** + * The mentality + */ @XmlAttribute(name = "men", required = true) protected int mentality = 0; + /** + * The dexterity + */ @XmlAttribute(name = "dex", required = true) protected int dexterity = 0; + /** + * The witness + */ @XmlAttribute(name = "wit", required = true) protected int witness = 0; } + /** + * The character maximum load + */ @XmlElement(name = "maxload", required = true) protected int maximumLoad = 0; } + /** + * The character collision data + */ @XmlElement(name = "collision", required = true) protected CollitionMetadataContainer collision = null; + /** + * Defines the character collision data + * @author Rogiel + */ @XmlType(name = "CharacterCollisionType") protected static class CollitionMetadataContainer { + /** + * Collision data for male characters + */ @XmlElement(name = "male", required = true) protected CollisionMetadata male = null; + /** + * Collision data for female characters + */ @XmlElement(name = "female", required = true) protected CollisionMetadata female = null; + /** + * Defines an collision data + * @author Rogiel + * + */ @XmlType(name = "") protected static class CollisionMetadata { + /** + * The character radius + */ @XmlAttribute(name = "radius", required = true) protected double radius = 0; + /** + * The character height + */ @XmlAttribute(name = "heigth", required = true) protected double height = 0; } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/EffectTemplate.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/EffectTemplate.java index bf8db4ead..a12136b74 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/EffectTemplate.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/EffectTemplate.java @@ -36,10 +36,16 @@ import com.l2jserver.util.jaxb.EffectTemplateIDAdapter; @XmlType(name = "Effect") @XmlSeeAlso({ TeleportEffectTemplate.class }) public abstract class EffectTemplate implements Template { + /** + * The effect template ID + */ @XmlAttribute(name = "id") @XmlJavaTypeAdapter(EffectTemplateIDAdapter.class) protected EffectTemplateID id; + /** + * Creates a new instance + */ protected EffectTemplate() { this.id = null; } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/TeleportEffectTemplate.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/TeleportEffectTemplate.java index 5e3cd358b..ab28ea377 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/TeleportEffectTemplate.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/effect/TeleportEffectTemplate.java @@ -39,12 +39,34 @@ import com.l2jserver.util.jaxb.CoordinateAdapter; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TeleportEffect") public class TeleportEffectTemplate extends EffectTemplate { + /** + * The teleportation type + * + * @author Rogiel + */ public enum SkillTeleportEffectLocation { - TARGET, OFFSET_FROM_TARGET, POINT; + /** + * Teleports the caster to the current target + */ + TARGET, + /** + * Teleports the caster to an offset from the target + */ + OFFSET_FROM_TARGET, + /** + * Teleports the caster to an fixed point + */ + POINT; } + /** + * The type of teleportation + */ @XmlAttribute(name = "type", required = false) private SkillTeleportEffectLocation type = SkillTeleportEffectLocation.TARGET; + /** + * The point (only of type is {@link SkillTeleportEffectLocation#POINT}) + */ @XmlElement(name = "point") @XmlJavaTypeAdapter(CoordinateAdapter.class) private Coordinate coordinate; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ArmorType.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ArmorType.java index 734d52e10..7138ef2ac 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ArmorType.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ArmorType.java @@ -25,5 +25,24 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType(name = "ArmorType") public enum ArmorType { - NONE, LIGHT, HEAVY, MAGIC, SIGILO; + /** + * No armor type + */ + NONE, + /** + * Light armor type + */ + LIGHT, + /** + * Heavy armor type + */ + HEAVY, + /** + * Magic armor type + */ + MAGIC, + /** + * Unknown + */ + SIGILO; } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemMaterial.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemMaterial.java index 69cd7f116..2ce13066d 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemMaterial.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemMaterial.java @@ -18,6 +18,12 @@ package com.l2jserver.model.template.item; import javax.xml.bind.annotation.XmlType; +/** + * The material the item is made off + * + * @author Rogiel + */ +@SuppressWarnings("javadoc") @XmlType(name = "ItemMaterialType") public enum ItemMaterial { COTTON, WOOD, PAPER, FISH, ORIHARUKON, HORN, ADAMANTAITE, CHRYSOLITE, MITHRIL, COBWEB, RUNE_XP, CLOTH, SCALE_OF_DRAGON, BONE, GOLD, LEATHER, FINE_STEEL, SILVER, DYESTUFF, CRYSTAL, RUNE_REMOVE_PENALTY, STEEL, BRONZE, RUNE_SP, LIQUID, BLOOD_STEEL, DAMASCUS; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemTemplate.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemTemplate.java index 872d8ec88..386d42582 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemTemplate.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemTemplate.java @@ -50,63 +50,148 @@ public class ItemTemplate extends AbstractTemplate { private static final Logger log = LoggerFactory .getLogger(ItemTemplate.class); + /** + * The Item Template ID + */ @XmlAttribute(name = "id", required = true) @XmlJavaTypeAdapter(ItemTemplateIDAdapter.class) protected ItemTemplateID id; + /** + * The item name + */ @XmlAttribute(name = "name", required = true) protected String name; + /** + * The item weight + */ @XmlElement(name = "weight", required = true) protected int weight = 0; + /** + * The item price + */ @XmlElement(name = "price", required = true) protected int price = 0; + /** + * The item icon + */ @XmlElement(name = "icon", required = false) protected String icon; + /** + * The item effects + */ @XmlElement(name = "effect", required = false) protected EffectContainer effect; + /** + * Effect container for items + * + * @author Rogiel + */ @XmlType(name = "ItemEffectsType") private static class EffectContainer { + /** + * The effect type + */ @XmlAttribute(name = "type", required = true) protected EffectType effect; } + /** + * The item stats container + * + * @author Rogiel + */ @XmlType(name = "ItemStatsType") protected static class StatsContainer { + /** + * The weapon's physical damage + */ @XmlElement(name = "physicalDamage", required = false) protected StatAttribute physicalDamage; + /** + * The weapons's magical damage + */ @XmlElement(name = "magicalDamage", required = false) protected StatAttribute magicalDamage; + /** + * The weapon's critical chance + */ @XmlElement(name = "criticalChance", required = false) protected StatAttribute criticalChance; + /** + * The weapon's physical attack speed + */ @XmlElement(name = "physicalAttackSpeed", required = false) protected StatAttribute physicalAttackSpeed; } + /** + * The item stats + */ @XmlElement(name = "stats", required = false) protected StatsContainer stats; + /** + * The item material + */ @XmlElement(name = "material", required = true) protected ItemMaterial material; + /** + * The item effect type + * + * @author Rogiel + */ @XmlType(name = "ItemEffectType") public enum EffectType { + /** + * The effect is applied immediately once used + */ IMMEDIATE; } + /** + * The item type + */ protected ItemType itemType = ItemType.NONE; + /** + * The weapon type + */ protected WeaponType weaponType = WeaponType.NONE; + /** + * The armor type + */ protected ArmorType armorType = ArmorType.NONE; + /** + * An item stat attribute + * + * @author Rogiel + */ @XmlType(name = "ItemAttributeType") public static class StatAttribute { + /** + * The set + */ @XmlElement(name = "set", required = true) protected StatSet set; + /** + * Defines an SET calculator function + * + * @author Rogiel + */ @XmlType(name = "") public static class StatSet { + /** + * The execution order + */ @XmlAttribute(name = "order", required = true) protected int order; + /** + * The value to be set + */ @XmlValue protected double value; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemType.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemType.java index a531595be..08eafaa5b 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemType.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/item/ItemType.java @@ -128,8 +128,31 @@ public enum ItemType { /** * Bolt? unk. */ - BOLT(26), SCRL_INC_ENCHANT_PROP_WP(27), SCRL_INC_ENCHANT_PROP_AM(28), ANCIENT_CRYSTAL_ENCHANT_WP( - 29), ANCIENT_CRYSTAL_ENCHANT_AM(30), RUNE_SELECT(31), RUNE(32); + BOLT(26), + /** + * Scoll + */ + SCRL_INC_ENCHANT_PROP_WP(27), + /** + * Scroll + */ + SCRL_INC_ENCHANT_PROP_AM(28), + /** + * Ancient crystal enchant weapon + */ + ANCIENT_CRYSTAL_ENCHANT_WP(29), + /** + * Ancient crystal enchant armor + */ + ANCIENT_CRYSTAL_ENCHANT_AM(30), + /** + * Rune select + */ + RUNE_SELECT(31), + /** + * Rune + */ + RUNE(32); /** * The packet id for this item type diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCRace.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCRace.java index b5ae50868..32783e06c 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCRace.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCRace.java @@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlType; * @author Rogiel */ @XmlType(name = "NPCRaceType") +@SuppressWarnings("javadoc") public enum NPCRace { // character races HUMAN, ELVEN, DARKELVEN, ORC, DWARVEN, KAMAEL, diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCTemplate.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCTemplate.java index 880542cb4..debb64b85 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCTemplate.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/NPCTemplate.java @@ -51,241 +51,539 @@ import com.l2jserver.util.jaxb.SkillTemplateIDAdapter; @XmlType(namespace = "http://schemas.l2jserver2.com/npc", name = "NPCType") @XmlAccessorType(XmlAccessType.FIELD) public class NPCTemplate extends ActorTemplate { + /** + * The template ID + */ @XmlAttribute(name = "id", required = true) @XmlJavaTypeAdapter(value = NPCTemplateIDAdapter.class) protected NPCTemplateID id = null; + /** + * The {@link NPC} controller class + */ @XmlAttribute(name = "controller", required = true) protected Class controller; + /** + * The {@link NPC} information metadata + */ @XmlElement(name = "info", required = true) protected NPCInformationMetadata info = null; + /** + * The {@link NPC} information metadata model + * + * @author Rogiel + */ @XmlType(name = "NPCInfoType") protected static class NPCInformationMetadata { + /** + * The {@link NPC} name metadata + */ @XmlElement(name = "name", required = false) public NPCNameMetadata nameMetadata = null; + /** + * Defines the {@link NPC}'s name information + * + * @author Rogiel + */ @XmlType(name = "NPCNameType") protected static class NPCNameMetadata { + /** + * The {@link NPC} name + */ @XmlValue protected String name = null; + /** + * Whether the {@link NPC} name should be sent to the client or not + */ @XmlAttribute(name = "send") protected Boolean send = false; + /** + * Whether the name should be displayed on the client or not + */ @XmlAttribute(name = "display") protected Boolean display = false; } + /** + * The {@link NPC} title metadata + */ @XmlElement(name = "title", required = false) protected NPCTitleMetadata titleMetadata = null; + /** + * Defines the {@link NPC}'s title information + * + * @author Rogiel + */ @XmlType(name = "NPCTitleType") protected static class NPCTitleMetadata { + /** + * The {@link NPC} title + */ @XmlValue protected String title = null; + /** + * Whether the {@link NPC} title should be sent to the client or not + */ @XmlAttribute(name = "send") protected Boolean send = false; } + /** + * The {@link NPC} level + */ @XmlElement(name = "level", required = true) protected int level = 0; + /** + * The {@link NPC} race + */ @XmlElement(name = "race", required = false) protected NPCRace race = NPCRace.NONE; + /** + * The {@link NPC} sex + */ @XmlElement(name = "sex", required = false) protected ActorSex sex = null; + /** + * Whether this {@link NPC} can be attacked or not + */ @XmlAttribute(name = "attackable", required = false) protected boolean attackable = false; + /** + * Whether this {@link NPC} can be targeted or not + */ @XmlAttribute(name = "targetable", required = false) protected boolean targetable = false; + /** + * Whether this {@link NPC} is aggressive + */ @XmlAttribute(name = "aggressive", required = false) protected boolean aggressive = false; + /** + * The {@link NPC} stats metadata, such as hp and mp + */ @XmlElement(name = "stats", required = true) protected NPCStatsMetadata stats = null; + /** + * Defines {@link NPC}'s stats, such as HP and MP + * + * @author Rogiel + * + */ @XmlType(name = "NPCStatsType") protected static class NPCStatsMetadata { + /** + * The {@link NPC} maximum HP + */ @XmlElement(name = "hp", required = true) protected Stat hp = null; + /** + * The {@link NPC} maximum MP + */ @XmlElement(name = "mp", required = true) protected Stat mp = null; + /** + * Defines an stat (HP or MP) + * + * @author Rogiel + */ @XmlType(name = "") protected static class Stat { + /** + * The maximum value + */ @XmlAttribute(name = "max", required = true) protected double max = 0; + /** + * The regeneration speed + */ @XmlAttribute(name = "regen", required = true) protected double regen = 0; } + /** + * The {@link NPC} attack metadata + */ @XmlElement(name = "attack", required = false) protected AttackMetadata attack = null; + /** + * Defines {@link NPC}'s attacking metadata + * + * @author Rogiel + */ @XmlType(name = "NPCAttackType") protected static class AttackMetadata { + /** + * The {@link NPC}'s attack range + */ @XmlAttribute(name = "range", required = true) protected int range = 0; + /** + * The {@link NPC}'s evasion + */ @XmlAttribute(name = "evasion", required = true) protected int evasion = 0; + /** + * The {@link NPC}'s attack critical chance + */ @XmlAttribute(name = "critical", required = true) protected int critical = 0; + /** + * The {@link NPC}'s attack physical damage + */ @XmlElement(name = "physical", required = true) protected AttackValueMetadata physical = null; + /** + * The {@link NPC}'s attack magical damage + */ @XmlElement(name = "magical", required = true) protected AttackValueMetadata magical = null; + /** + * Defines an attack value + * + * @author Rogiel + */ @XmlType(name = "") protected static class AttackValueMetadata { + /** + * The damage dealt + */ @XmlAttribute(name = "damage", required = true) protected double damage = 0; + /** + * The attacking speed + */ @XmlAttribute(name = "speed", required = true) protected double speed = 0; } } + /** + * The {@link NPC} defense metadata + */ @XmlElement(name = "defense", required = false) protected DefenseMetadata defense = null; + /** + * Defines {@link NPC}'s defensive metadata + * + * @author Rogiel + */ @XmlType(name = "NPCDefenseType") protected static class DefenseMetadata { + /** + * The {@link NPC}'s physical defense + */ @XmlElement(name = "physical", required = true) protected DefenseValueMetadata physical = null; + /** + * The {@link NPC}'s magical defense + */ @XmlElement(name = "magical", required = true) protected DefenseValueMetadata magical = null; + /** + * Defines an defense value + * + * @author Rogiel + */ @XmlType(name = "") protected static class DefenseValueMetadata { + /** + * The defense value + */ @XmlAttribute(name = "value", required = true) protected double value = 0; } } + /** + * The {@link NPC} movement data + */ @XmlElement(name = "move", required = false) protected MoveMetadata move = null; + /** + * Defines {@link NPC} movement data + * + * @author Rogiel + */ @XmlType(name = "NPCMovementType") protected static class MoveMetadata { + /** + * The run speed + */ @XmlAttribute(name = "run", required = true) protected double run = 0; + /** + * The walk speed + */ @XmlAttribute(name = "walk", required = true) protected double walk = 0; } + /** + * The {@link NPC} base stats + */ @XmlElement(name = "base", required = true) public BaseMetadata base = null; + /** + * Defines all base stats for {@link NPC} instances + * + * @author Rogiel + */ @XmlType(name = "NPCBaseStatsType") protected static class BaseMetadata { + /** + * The {@link NPC} intelligence + */ @XmlAttribute(name = "int", required = true) protected int intelligence = 0; + /** + * The {@link NPC} strength + */ @XmlAttribute(name = "str", required = true) protected int strength = 0; + /** + * The {@link NPC} concentration + */ @XmlAttribute(name = "con", required = true) protected int concentration = 0; + /** + * The {@link NPC} mentality + */ @XmlAttribute(name = "men", required = true) protected int mentality = 0; + /** + * The {@link NPC} dexterity + */ @XmlAttribute(name = "dex", required = true) protected int dexterity = 0; + /** + * The {@link NPC} witness + */ @XmlAttribute(name = "wit", required = true) protected int witness = 0; } } + /** + * The {@link NPC} experience + */ @XmlElement(name = "experience", required = true) protected long experience = 0; + /** + * The {@link NPC} SP + */ @XmlElement(name = "sp", required = true) protected int sp = 0; + /** + * The {@link NPC} holding items + */ @XmlElement(name = "item", required = false) protected ItemMetadata item = null; + /** + * Describes what items the {@link NPC} is holding on its hand + * + * @author Rogiel + */ @XmlType(name = "NPCItemsType") protected static class ItemMetadata { + /** + * The {@link ItemTemplateID} on {@link NPC}'s right hand + */ @XmlAttribute(name = "righthand", required = false) @XmlJavaTypeAdapter(value = ItemTemplateIDAdapter.class) protected ItemTemplateID rightHand = null; + /** + * The {@link ItemTemplateID} on {@link NPC}'s left hand + */ @XmlAttribute(name = "lefthand", required = false) @XmlJavaTypeAdapter(value = ItemTemplateIDAdapter.class) protected ItemTemplateID leftHand = null; } + /** + * The {@link NPC} collision data + */ @XmlElement(name = "collision", required = false) protected CollisionMetadata collision = null; + /** + * Defines the {@link NPC} dimensions used for collisions + * + * @author Rogiel + */ @XmlType(name = "NPCCollisionType") protected static class CollisionMetadata { + /** + * The {@link NPC} radius + */ @XmlAttribute(name = "radius", required = true) protected double radius = 0; + /** + * The {@link NPC} height + */ @XmlAttribute(name = "heigth", required = true) protected double height = 0; } } + /** + * The {@link NPC} AI data + */ @XmlElement(name = "ai", required = false) protected AIMetadata ai = null; + /** + * Describes the {@link NPC} ai data + * + * @author Rogiel + */ @XmlType(name = "NPCAIType") protected static class AIMetadata { + /** + * The ai script to be used + */ @XmlAttribute(name = "script", required = true) protected String script = null; } + /** + * Contains all {@link NPC} conversation HTML messages + */ @XmlElement(name = "talk", required = false) protected TalkMetadata talk = null; + /** + * Describes {@link NPC} talking capability as HTML messages + * + * @author Rogiel + */ @XmlType(name = "NPCTalkType") protected static class TalkMetadata { + /** + * The default chat message + */ @XmlAttribute(name = "default", required = true) protected String defaultChat = null; + /** + * The list of {@link Chat} available + */ @XmlElement(name = "chat", required = true) protected List chats = null; + /** + * Describes an "chat" message (an HTML page) + * + * @author Rogiel + */ @XmlType(name = "") public static class Chat { + /** + * The chat ID + */ @XmlAttribute(name = "id", required = true) protected String id = null; + /** + * The message content + */ @XmlValue protected String html = null; } } + /** + * The {@link NPC} drop list + */ @XmlElementWrapper(name = "droplist", required = false) @XmlElement(name = "item", required = true) protected List droplist = null; + /** + * Describes {@link NPC} dropping when it is killed + * + * @author Rogiel + */ @XmlType(name = "NPCDropType") protected static class DropItemMetadata { + /** + * The item dropped + */ @XmlAttribute(name = "id", required = true) @XmlJavaTypeAdapter(value = ItemTemplateIDAdapter.class) protected ItemTemplateID item = null; + /** + * The minimum amount of items dropped + */ @XmlAttribute(name = "min", required = true) protected int min = 0; + /** + * The maximum amount of item dropped + */ @XmlAttribute(name = "max", required = true) protected int max = 0; + /** + * The drop category + */ @XmlAttribute(name = "category", required = true) protected DropCategory category = null; + /** + * The drop category + * + * @author Rogiel + */ + @SuppressWarnings("javadoc") @XmlType(name = "NPCDropCategoryType") public enum DropCategory { DROP, SPOIL, UNK_1, UNK_2, UNK_3, UNK_4, UNK_5, UNK_6, UNK_7, UNK_8, UNK_9, UNK_10, UNK_11, UNK_12, UNK_13, UNK_14, UNK_15, UNK_16, UNK_17, UNK_18, UNK_19, UNK_20, UNK_21, UNK_22, UNK_23, UNK_24, UNK_25, UNK_26, UNK_27, UNK_28, UNK_29, UNK_30, UNK_31, UNK_32, UNK_33, UNK_34, UNK_35, UNK_36, UNK_100, UNK_101, UNK_102, UNK_200; } + /** + * The drop chance + */ @XmlAttribute(name = "chance", required = true) protected int chance = 0; } + /** + * List of all available {@link NPC} skills + */ @XmlElementWrapper(name = "skills", required = false) @XmlElement(name = "skill", required = true) protected List skills = null; + /** + * Describes an {@link NPC} skill + * + * @author Rogiel + */ @XmlType(name = "NPCSkillType") protected static class SkillMetadata { + /** + * The skill ID + */ @XmlAttribute(name = "id", required = true) @XmlJavaTypeAdapter(value = SkillTemplateIDAdapter.class) protected SkillTemplateID skill = null; + /** + * The skill level + */ @XmlAttribute(name = "level", required = true) protected int level = 0; } @@ -321,6 +619,9 @@ public class NPCTemplate extends ActorTemplate { return controller; } + /** + * @return the {@link NPC} name + */ public String getName() { if (info == null) return null; @@ -329,6 +630,9 @@ public class NPCTemplate extends ActorTemplate { return info.nameMetadata.name; } + /** + * @return true if the {@link NPC} name should be sent to the client + */ public boolean getSendName() { if (info == null) return false; @@ -337,6 +641,9 @@ public class NPCTemplate extends ActorTemplate { return info.nameMetadata.send; } + /** + * @return true if the {@link NPC} name should be displayed on the client + */ public boolean getDisplayName() { if (info == null) return false; @@ -345,6 +652,9 @@ public class NPCTemplate extends ActorTemplate { return info.nameMetadata.display; } + /** + * @return the npc title (if any) + */ public String getTitle() { if (info == null) return null; @@ -353,6 +663,9 @@ public class NPCTemplate extends ActorTemplate { return info.titleMetadata.title; } + /** + * @return if the {@link NPC} title should be sent to the client + */ public boolean getSendTitle() { if (info == null) return false; @@ -433,6 +746,9 @@ public class NPCTemplate extends ActorTemplate { return info.sp; } + /** + * @return the {@link NPC}'s maximum HP + */ public double getMaximumHP() { if (info == null) return 0; @@ -443,6 +759,9 @@ public class NPCTemplate extends ActorTemplate { return info.stats.hp.max; } + /** + * @return the {@link NPC}'s maximum HP regeneration + */ public double getHPRegeneration() { if (info == null) return 0; @@ -453,6 +772,9 @@ public class NPCTemplate extends ActorTemplate { return info.stats.hp.regen; } + /** + * @return the {@link NPC}'s maximum MP + */ public double getMaximumMP() { if (info == null) return 0; @@ -463,6 +785,9 @@ public class NPCTemplate extends ActorTemplate { return info.stats.mp.max; } + /** + * @return the {@link NPC}'s maximum MP regeneration + */ public double getMPRegeneration() { if (info == null) return 0; @@ -602,6 +927,9 @@ public class NPCTemplate extends ActorTemplate { return info.stats.attack.magical.speed; } + /** + * @return the {@link NPC}'s run speed + */ public double getRunSpeed() { if (info == null) return 0; @@ -612,6 +940,9 @@ public class NPCTemplate extends ActorTemplate { return info.stats.move.run; } + /** + * @return the {@link NPC}'s walk speed + */ public double getWalkSpeed() { if (info == null) return 0; @@ -700,6 +1031,9 @@ public class NPCTemplate extends ActorTemplate { return info.stats.base.witness; } + /** + * @return the item on {@link NPC}'s right hand + */ public ItemTemplateID getRightHand() { if (info == null) return null; @@ -708,6 +1042,9 @@ public class NPCTemplate extends ActorTemplate { return info.item.rightHand; } + /** + * @return the item on {@link NPC}'s left hand + */ public ItemTemplateID getLeftHand() { if (info == null) return null; @@ -716,6 +1053,9 @@ public class NPCTemplate extends ActorTemplate { return info.item.leftHand; } + /** + * @return the {@link NPC}'s collision radius + */ public double getCollisionRadius() { if (info == null) return 0; @@ -724,6 +1064,9 @@ public class NPCTemplate extends ActorTemplate { return info.collision.radius; } + /** + * @return the {@link NPC}'s collision height + */ public double getCollisionHeight() { if (info == null) return 0; @@ -732,12 +1075,20 @@ public class NPCTemplate extends ActorTemplate { return info.collision.height; } + /** + * @return the {@link NPC}'s AI script name + */ public String getAIScriptName() { if (ai == null) return null; return ai.script; } + /** + * @param id + * the chat ID + * @return the {@link NPC}'s HTML chat by ID + */ public String getHTML(String id) { if (talk == null) return null; @@ -750,6 +1101,9 @@ public class NPCTemplate extends ActorTemplate { return null; } + /** + * @return the {@link NPC}'s default chat, if any. + */ public String getDefaultHTML() { if (talk == null) return null; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/TeleportationTemplate.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/TeleportationTemplate.java index 2363eea9d..4019d7808 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/TeleportationTemplate.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/template/npc/TeleportationTemplate.java @@ -44,28 +44,54 @@ import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(namespace = "http://schemas.l2jserver2.com/teleport", name = "TeleportType") public class TeleportationTemplate extends AbstractTemplate { + /** + * The teleportation template ID + */ @XmlAttribute(name = "id") @XmlJavaTypeAdapter(TeleportationTemplateIDAdapter.class) protected TeleportationTemplateID id; + /** + * The teleportation name + */ @XmlAttribute(name = "name") protected String name; + /** + * The teleportation cost item id + */ @XmlAttribute(name = "item", required = false) @XmlJavaTypeAdapter(ItemTemplateIDAdapter.class) protected ItemTemplateID itemTemplateID; + /** + * The amount of items decreased + */ @XmlAttribute(name = "price", required = true) protected int price; + /** + * The teleportation point + */ @XmlElement(name = "point", required = false) @XmlJavaTypeAdapter(CoordinateAdapter.class) protected Coordinate coordinate; + /** + * The teleportation restrictions + */ @XmlElementWrapper(name = "restrictions", required = false) @XmlElement(name = "restriction", required = true) protected List restrictions; + /** + * Defines an teleport restriction + * + * @author Rogiel + */ @XmlType(name = "TeleportRestrictionType") public enum TeleportRestriction { + /** + * Only nobles can use this teleport + */ NOBLE; } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorExperience.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorExperience.java index e55439fef..fe539a76f 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorExperience.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/ActorExperience.java @@ -23,6 +23,7 @@ import com.l2jserver.model.world.Actor; * * @author Rogiel */ +@SuppressWarnings("javadoc") public enum ActorExperience { /** * This is an unreachable level! diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractEffect.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractEffect.java index 64f52035e..8d30df656 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractEffect.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractEffect.java @@ -31,9 +31,21 @@ import com.l2jserver.model.world.Actor; */ public abstract class AbstractEffect implements Effect { + /** + * The effect template + */ protected final T template; + /** + * The actor that the effect is applied to + */ protected final Actor actor; + /** + * @param template + * the effect template + * @param actor + * the actor that the effect is applied to + */ public AbstractEffect(T template, Actor actor) { this.template = template; this.actor = actor; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractTemporalEffect.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractTemporalEffect.java index 812af4bb0..ae92c5ab1 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractTemporalEffect.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/AbstractTemporalEffect.java @@ -31,8 +31,17 @@ import com.l2jserver.util.exception.L2Exception; */ public abstract class AbstractTemporalEffect extends AbstractEffect implements TemporalEffect { + /** + * The last time the effect ticked + */ protected long lastCallTime; + /** + * @param template + * the effect template + * @param actor + * the actor that the effect is applied to + */ public AbstractTemporalEffect(T template, Actor actor) { super(template, actor); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/TemporalEffect.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/TemporalEffect.java index 74fef57dc..dfc4481b6 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/TemporalEffect.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/effect/TemporalEffect.java @@ -36,7 +36,14 @@ public interface TemporalEffect extends Effect { * @author Rogiel */ public enum TemporalEffectAction { - CANCEL, CONTINUE; + /** + * Cancels the effect after this tick + */ + CANCEL, + /** + * Continues this effect for at least one more tick + */ + CONTINUE; } /** diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/stat/StatType.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/stat/StatType.java index 9d63cde72..eb719da24 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/stat/StatType.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/actor/stat/StatType.java @@ -5,6 +5,7 @@ package com.l2jserver.model.world.actor.stat; * * @author Rogiel */ +@SuppressWarnings("javadoc") public enum StatType { MAX_HP, MAX_MP, MAX_CP, REGENERATE_HP_RATE, REGENERATE_CP_RATE, REGENERATE_MP_RATE, RECHARGE_MP_RATE, HEAL_EFFECTIVNESS, HEAL_PROFICIENCY, HEAL_STATIC_BONUS, diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterAppearance.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterAppearance.java index 1ea188c26..fe86d13bf 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterAppearance.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterAppearance.java @@ -41,18 +41,39 @@ public class CharacterAppearance { * @author Rogiel */ public enum CharacterFace { + /** + * Face type A + */ FACE_A(0x00), + /** + * Face type B + */ FACE_B(0x01), + /** + * Face type C + */ FACE_C(0x02); + /** + * The option id + */ public final int option; + /** + * @param option + * the option id + */ CharacterFace(int option) { this.option = option; } + /** + * @param option + * the option id + * @return the {@link CharacterFace} represented by option + */ public static CharacterFace fromOption(int option) { for (CharacterFace face : values()) { if (face.option == option) @@ -73,20 +94,45 @@ public class CharacterAppearance { * @author Rogiel */ public enum CharacterHairColor { + /** + * The hair color A + */ COLOR_A(0x00), + /** + * The hair color B + */ COLOR_B(0x01), + /** + * The hair color C + */ COLOR_C(0x02), + /** + * The hair color D + */ COLOR_D(0x03); + /** + * The hair color id + */ public final int option; + /** + * @param option + * the hair color id + */ CharacterHairColor(int option) { this.option = option; } + /** + * @param option + * the hair color id + * @return the {@link CharacterHairColor} from the given + * option + */ public static CharacterHairColor fromOption(int option) { for (CharacterHairColor color : values()) { if (color.option == option) @@ -107,22 +153,46 @@ public class CharacterAppearance { * @author Rogiel */ public enum CharacterHairStyle { + /** + * The hair style A + */ STYLE_A(0x00), - + /** + * The hair style B + */ STYLE_B(0x01), - + /** + * The hair style C + */ STYLE_C(0x02), - + /** + * The hair style D + */ STYLE_D(0x03), - + /** + * The hair style E + */ STYLE_E(0x04); + /** + * The hair style id + */ public final int option; + /** + * @param option + * the hair style id + */ CharacterHairStyle(int option) { this.option = option; } + /** + * @param option + * the hair style id + * @return the {@link CharacterHairStyle} represented by + * option + */ public static CharacterHairStyle fromOption(int option) { for (CharacterHairStyle style : values()) { if (style.option == option) @@ -162,6 +232,10 @@ public class CharacterAppearance { */ private boolean visible; + /** + * @param character + * the parent character + */ public CharacterAppearance(L2Character character) { this.character = character; } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterInventory.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterInventory.java index 3e9a8f80f..ad8837caf 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterInventory.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/character/CharacterInventory.java @@ -209,12 +209,124 @@ public class CharacterInventory implements Iterable { * @author Rogiel */ public enum InventoryPaperdoll { - UNDERWEAR(0), HEAD(1), HAIR1(2), HAIR2(3), NECK(4), RIGHT_HAND(5), CHEST( - 6), LEFT_HAND(7), RIGHT_EAR(8), LEFT_EAR(9), GLOVES(10), LEGS( - 11), FEET(12), RIGHT_FINGER(13), LEFT_FINGER(14), LEFT_BRACELET( - 15), RIGHT_BRACELET(16), DECORATION_1(17), DECORATION_2(18), DECORATION_3( - 19), DECORATION_4(20), DECORATION_5(21), DECORATION_6(22), CLOAK( - 23), BELT(24); + /** + * Underwear + */ + UNDERWEAR(0), + + /** + * Head + */ + HEAD(1), + + /** + * Hair, slot 1 + */ + HAIR1(2), + + /** + * Hair slot 2 + */ + HAIR2(3), + + /** + * Neck + */ + NECK(4), + + /** + * Right hant + */ + RIGHT_HAND(5), + + /** + * Chest + */ + CHEST(6), + + /** + * Left hand + */ + LEFT_HAND(7), + + /** + * Right ear + */ + RIGHT_EAR(8), + + /** + * Left ear + */ + LEFT_EAR(9), + + /** + * Gloves + */ + GLOVES(10), + + /** + * Legs + */ + LEGS(11), + + /** + * Feet + */ + FEET(12), + + /** + * Right finger + */ + RIGHT_FINGER(13), + + /** + * Left finger + */ + LEFT_FINGER(14), + + /** + * Left bracelet + */ + LEFT_BRACELET(15), + + /** + * Right bracelet + */ + RIGHT_BRACELET(16), + + /** + * Decoration, slot 1 + */ + DECORATION_1(17), + + /** + * Decoration slot 2 + */ + DECORATION_2(18), + /** + * Decoration slot 3 + */ + DECORATION_3(19), + /** + * Decoration slot 4 + */ + DECORATION_4(20), + /** + * Decoration slot 5 + */ + DECORATION_5(21), + /** + * Decoration slot 6 + */ + DECORATION_6(22), + /** + * Cloak + */ + CLOAK(23), + /** + * Belt + */ + BELT(24); /** * The inventory paperdoll slot id diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/NPCController.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/NPCController.java index 528d7ffa9..89638a31f 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/NPCController.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/NPCController.java @@ -52,6 +52,9 @@ public interface NPCController { * @author Rogiel */ public static class NPCControllerException extends L2Exception { + /** + * Serialization ID + */ private static final long serialVersionUID = 1L; /** diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/event/NPCTalkEvent.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/event/NPCTalkEvent.java index 89c925591..82fca2d6d 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/event/NPCTalkEvent.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/model/world/npc/event/NPCTalkEvent.java @@ -27,8 +27,17 @@ import com.l2jserver.model.world.WorldObject; * @author Rogiel */ public class NPCTalkEvent implements NPCEvent { + /** + * The NPC that is sending the HTML content + */ private final NPC npc; + /** + * The character instance that is receiving the HTML content + */ private final L2Character character; + /** + * The html message + */ private final String html; /** diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerDAOResolver.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerDAOResolver.java index 8ee97dcff..d64eff0e4 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerDAOResolver.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerDAOResolver.java @@ -16,6 +16,7 @@ */ package com.l2jserver.service.database; +import com.google.inject.Guice; import com.google.inject.Inject; import com.google.inject.Injector; import com.l2jserver.model.Model; @@ -42,8 +43,15 @@ import com.l2jserver.util.ClassUtils; * */ public class GameServerDAOResolver implements DAOResolver { + /** + * The {@link Guice} {@link Injector} + */ private final Injector injector; + /** + * @param injector + * the {@link Guice} {@link Injector} + */ @Inject private GameServerDAOResolver(Injector injector) { this.injector = injector; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java index 6945c2228..f53ba99d5 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java @@ -64,6 +64,9 @@ import com.l2jserver.service.game.template.TemplateService; ConfigurationService.class, TemplateService.class, ThreadService.class }) public class GameServerOrientDatabaseService extends AbstractOrientDatabaseService implements DatabaseService { + /** + * The VFS service + */ private final VFSService vfsService; /** @@ -73,6 +76,8 @@ public class GameServerOrientDatabaseService extends * the cache service * @param threadService * the thread service + * @param vfsService + * the VFS service * @param daoResolver * the {@link DataAccessObject DAO} resolver */ diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterDAO.java index fea2ae79d..f27dcd0f6 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterDAO.java @@ -145,7 +145,7 @@ public class OrientDBCharacterDAO extends @Override protected OQueryContextNative query(OQueryContextNative record, L2Character o) { - return record.field(name(e.characterId)).eq(o.getID().getID()); + return record.field(name(entity.characterId)).eq(o.getID().getID()); } }); } @@ -157,7 +157,7 @@ public class OrientDBCharacterDAO extends @Override protected OQueryContextNative query(OQueryContextNative record, L2Character o) { - return record.field(name(e.characterId)).eq(o.getID().getID()); + return record.field(name(entity.characterId)).eq(o.getID().getID()); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterFriendDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterFriendDAO.java index e33431454..041e6de54 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterFriendDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterFriendDAO.java @@ -128,9 +128,9 @@ public class OrientDBCharacterFriendDAO extends @Override protected OQueryContextNative query( OQueryContextNative record, CharacterFriend friend) { - return record.field(name(e.characterId)) + return record.field(name(entity.characterId)) .eq(friend.getID().getCharacterID().getID()) - .field(name(e.characterIdFriend)) + .field(name(entity.characterIdFriend)) .eq(friend.getID().getFriendID()); } }); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterShortcutDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterShortcutDAO.java index 85baf6841..d0dd957d6 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterShortcutDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBCharacterShortcutDAO.java @@ -44,6 +44,9 @@ import com.orientechnologies.orient.core.query.nativ.OQueryContextNative; public class OrientDBCharacterShortcutDAO extends AbstractOrientDBDAO implements CharacterShortcutDAO { + /** + * The {@link CharacterShortcut} mapper + */ private final CharacterShortcutMapper mapper; /** @@ -117,7 +120,7 @@ public class OrientDBCharacterShortcutDAO extends @Override protected OQueryContextNative query( OQueryContextNative record, CharacterShortcut o) { - return record.field(name(e.shortcutId)).eq( + return record.field(name(entity.shortcutId)).eq( o.getID().getID()); } }); @@ -131,7 +134,7 @@ public class OrientDBCharacterShortcutDAO extends @Override protected OQueryContextNative query( OQueryContextNative record, CharacterShortcut o) { - return record.field(name(e.shortcutId)).eq( + return record.field(name(entity.shortcutId)).eq( o.getID().getID()); } }); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBChatMessageDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBChatMessageDAO.java index 9a24ea520..f1dd7d701 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBChatMessageDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBChatMessageDAO.java @@ -42,6 +42,9 @@ import com.orientechnologies.orient.core.query.nativ.OQueryContextNative; public class OrientDBChatMessageDAO extends AbstractOrientDBDAO implements ChatMessageDAO { + /** + * The {@link ChatMessage} mapper + */ private final ChatMessageMapper mapper; /** @@ -103,7 +106,8 @@ public class OrientDBChatMessageDAO extends @Override protected OQueryContextNative query(OQueryContextNative record, ChatMessage o) { - return record.field(name(e.messageId)).eq(o.getID().getID()); + return record.field(name(entity.messageId)).eq( + o.getID().getID()); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBClanDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBClanDAO.java index 6efd3d238..a852a5bda 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBClanDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBClanDAO.java @@ -40,7 +40,11 @@ import com.orientechnologies.orient.core.query.nativ.OQueryContextNative; * * @author Rogiel */ -public class OrientDBClanDAO extends AbstractOrientDBDAO implements ClanDAO { +public class OrientDBClanDAO extends AbstractOrientDBDAO + implements ClanDAO { + /** + * The {@link Clan} mapper + */ private final ClanMapper mapper; /** @@ -94,7 +98,7 @@ public class OrientDBClanDAO extends AbstractOrientDBDAO implement @Override protected OQueryContextNative query(OQueryContextNative record, Clan o) { - return record.field(name(e.clanId)).eq(o.getID().getID()); + return record.field(name(entity.clanId)).eq(o.getID().getID()); } }); } @@ -106,7 +110,8 @@ public class OrientDBClanDAO extends AbstractOrientDBDAO implement @Override protected OQueryContextNative query( OQueryContextNative record, Clan o) { - return record.field(name(e.clanId)).eq(o.getID().getID()); + return record.field(name(entity.clanId)).eq( + o.getID().getID()); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBItemDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBItemDAO.java index 0e544a329..f31a4a1ea 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBItemDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBItemDAO.java @@ -44,6 +44,9 @@ import com.orientechnologies.orient.core.query.nativ.OQueryContextNative; */ public class OrientDBItemDAO extends AbstractOrientDBDAO implements ItemDAO { + /** + * The {@link Item} mapper + */ private final ItemMapper mapper; /** @@ -125,7 +128,7 @@ public class OrientDBItemDAO extends AbstractOrientDBDAO @Override protected OQueryContextNative query(OQueryContextNative record, Item o) { - return record.field(name(e.itemId)).eq(o.getID().getID()); + return record.field(name(entity.itemId)).eq(o.getID().getID()); } }); } @@ -137,7 +140,7 @@ public class OrientDBItemDAO extends AbstractOrientDBDAO @Override protected OQueryContextNative query( OQueryContextNative record, Item o) { - return record.field(name(e.itemId)).eq(o.getID().getID()); + return record.field(name(entity.itemId)).eq(o.getID().getID()); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBNPCDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBNPCDAO.java index f050a4400..1d75ba020 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBNPCDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/orientdb/OrientDBNPCDAO.java @@ -44,6 +44,9 @@ import com.orientechnologies.orient.core.query.nativ.OQueryContextNative; */ public class OrientDBNPCDAO extends AbstractOrientDBDAO implements NPCDAO { + /** + * The {@link NPC} mapper + */ private final NPCMapper mapper; /** @@ -120,7 +123,7 @@ public class OrientDBNPCDAO extends AbstractOrientDBDAO implements @Override protected OQueryContextNative query(OQueryContextNative record, NPC o) { - return record.field(name(e.npcId)).eq(o.getID().getID()); + return record.field(name(entity.npcId)).eq(o.getID().getID()); } }); } @@ -131,7 +134,7 @@ public class OrientDBNPCDAO extends AbstractOrientDBDAO implements @Override protected OQueryContextNative query(OQueryContextNative record, NPC o) { - return record.field(name(e.npcId)).eq(o.getID().getID()); + return record.field(name(entity.npcId)).eq(o.getID().getID()); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterDAO.java index d591f68d8..5fcfa18d7 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterDAO.java @@ -138,7 +138,7 @@ public class SQLCharacterDAO extends AbstractSQLDAO QCharacter.character, mapper, characters) { @Override protected void query(SQLUpdateClause q, L2Character o) { - q.where(e.characterId.eq(o.getID().getID())); + q.where(entity.characterId.eq(o.getID().getID())); } }); } @@ -149,7 +149,7 @@ public class SQLCharacterDAO extends AbstractSQLDAO QCharacter.character, characters) { @Override protected void query(SQLDeleteClause q, L2Character o) { - q.where(e.characterId.eq(o.getID().getID())); + q.where(entity.characterId.eq(o.getID().getID())); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterFriendDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterFriendDAO.java index 974ea36eb..a320d35bd 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterFriendDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterFriendDAO.java @@ -124,9 +124,9 @@ public class SQLCharacterFriendDAO extends QCharacterFriend.characterFriend, friends) { @Override protected void query(SQLDeleteClause q, CharacterFriend o) { - q.where(e.characterId.eq( + q.where(entity.characterId.eq( o.getID().getCharacterID().getID()).and( - e.characterIdFriend.eq(o.getID().getFriendID() + entity.characterIdFriend.eq(o.getID().getFriendID() .getID()))); } }); diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterShortcutDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterShortcutDAO.java index 6297ff0ec..9340f1c2e 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterShortcutDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLCharacterShortcutDAO.java @@ -46,6 +46,9 @@ import com.mysema.query.sql.dml.SQLUpdateClause; public class SQLCharacterShortcutDAO extends AbstractSQLDAO implements CharacterShortcutDAO { + /** + * The {@link CharacterShortcut} mapper + */ private final CharacterShortcutMapper mapper; /** @@ -116,7 +119,7 @@ public class SQLCharacterShortcutDAO extends QCharacterShortcut.characterShortcut, mapper, shortcuts) { @Override protected void query(SQLUpdateClause q, CharacterShortcut o) { - q.where(e.shortcutId.eq(o.getID().getID())); + q.where(entity.shortcutId.eq(o.getID().getID())); } }); } @@ -128,7 +131,7 @@ public class SQLCharacterShortcutDAO extends QCharacterShortcut.characterShortcut, shortcuts) { @Override protected void query(SQLDeleteClause q, CharacterShortcut o) { - q.where(e.shortcutId.eq(o.getID().getID())); + q.where(entity.shortcutId.eq(o.getID().getID())); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLChatMessageDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLChatMessageDAO.java index 5898bf575..b808f3a84 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLChatMessageDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLChatMessageDAO.java @@ -42,6 +42,9 @@ import com.mysema.query.sql.dml.SQLDeleteClause; */ public class SQLChatMessageDAO extends AbstractSQLDAO implements ChatMessageDAO { + /** + * The {@link ChatMessage} mapper + */ private final ChatMessageMapper mapper; /** @@ -98,7 +101,7 @@ public class SQLChatMessageDAO extends QLogChat.logChat, objects) { @Override protected void query(SQLDeleteClause q, ChatMessage o) { - q.where(e.messageId.eq(o.getID().getID())); + q.where(entity.messageId.eq(o.getID().getID())); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLClanDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLClanDAO.java index 4b00eab81..60a9ebf47 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLClanDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLClanDAO.java @@ -43,6 +43,9 @@ import com.mysema.query.sql.dml.SQLUpdateClause; * @author Rogiel */ public class SQLClanDAO extends AbstractSQLDAO implements ClanDAO { + /** + * The {@link Clan} mapper + */ private final ClanMapper mapper; /** @@ -92,7 +95,7 @@ public class SQLClanDAO extends AbstractSQLDAO implements ClanDAO objects) { @Override protected void query(SQLUpdateClause q, Clan o) { - q.where(e.clanId.eq(o.getID().getID())); + q.where(entity.clanId.eq(o.getID().getID())); } }); } @@ -103,7 +106,7 @@ public class SQLClanDAO extends AbstractSQLDAO implements ClanDAO .query(new DeleteQuery(QClan.clan, objects) { @Override protected void query(SQLDeleteClause q, Clan o) { - q.where(e.clanId.eq(o.getID().getID())); + q.where(entity.clanId.eq(o.getID().getID())); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLItemDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLItemDAO.java index fd833b1fc..a4804a5a7 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLItemDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLItemDAO.java @@ -45,6 +45,9 @@ import com.mysema.query.sql.dml.SQLUpdateClause; * @author Rogiel */ public class SQLItemDAO extends AbstractSQLDAO implements ItemDAO { + /** + * The {@link Item} mapper + */ private final ItemMapper mapper; /** @@ -118,7 +121,7 @@ public class SQLItemDAO extends AbstractSQLDAO implements ItemDAO objects) { @Override protected void query(SQLUpdateClause q, Item o) { - q.where(e.itemId.eq(o.getID().getID())); + q.where(entity.itemId.eq(o.getID().getID())); } }); } @@ -129,7 +132,7 @@ public class SQLItemDAO extends AbstractSQLDAO implements ItemDAO .query(new DeleteQuery(QItem.item, objects) { @Override protected void query(SQLDeleteClause q, Item o) { - q.where(e.itemId.eq(o.getID().getID())); + q.where(entity.itemId.eq(o.getID().getID())); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLNPCDAO.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLNPCDAO.java index 0df00ac91..b17f0ee07 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLNPCDAO.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/dao/sql/SQLNPCDAO.java @@ -45,6 +45,9 @@ import com.mysema.query.sql.dml.SQLUpdateClause; * @author Rogiel */ public class SQLNPCDAO extends AbstractSQLDAO implements NPCDAO { + /** + * The {@link NPC} mapper + */ private final NPCMapper mapper; /** @@ -113,7 +116,7 @@ public class SQLNPCDAO extends AbstractSQLDAO implements NPCDAO { objects) { @Override protected void query(SQLUpdateClause q, NPC o) { - q.where(e.npcId.eq(o.getID().getID())); + q.where(entity.npcId.eq(o.getID().getID())); } }); } @@ -123,7 +126,7 @@ public class SQLNPCDAO extends AbstractSQLDAO implements NPCDAO { return database.query(new DeleteQuery(QNPC.npc, objects) { @Override protected void query(SQLDeleteClause q, NPC o) { - q.where(e.npcId.eq(o.getID().getID())); + q.where(entity.npcId.eq(o.getID().getID())); } }); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterMapper.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterMapper.java index 62276c149..ae0359df1 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterMapper.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterMapper.java @@ -41,6 +41,9 @@ import com.l2jserver.util.geometry.Point3D; */ public class CharacterMapper extends AbstractMapper { + /** + * The primary key mapper + */ private final PrimaryKeyMapper pk = new PrimaryKeyMapper() { @Override public CharacterID createID(Integer raw) { diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterShortcutMapper.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterShortcutMapper.java index cad95360e..64f9db2c8 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterShortcutMapper.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/CharacterShortcutMapper.java @@ -38,6 +38,9 @@ import com.l2jserver.service.database.model.QCharacterShortcut; public class CharacterShortcutMapper extends AbstractMapper { + /** + * The primary key mapper + */ private final PrimaryKeyMapper idMapper = new PrimaryKeyMapper() { @Override public CharacterShortcutID createID(Integer raw) { diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ChatMessageMapper.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ChatMessageMapper.java index d427b7f7b..7e143ce07 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ChatMessageMapper.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ChatMessageMapper.java @@ -34,6 +34,9 @@ import com.l2jserver.service.database.model.QLogChat; */ public class ChatMessageMapper extends AbstractMapper { + /** + * The primary key mapper + */ private final PrimaryKeyMapper idMapper = new PrimaryKeyMapper() { @Override public ChatMessageID createID(Integer raw) { diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ClanMapper.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ClanMapper.java index 83c62fea9..b3a410278 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ClanMapper.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ClanMapper.java @@ -33,6 +33,9 @@ import com.l2jserver.service.database.model.QClan; * */ public class ClanMapper extends AbstractMapper { + /** + * The primary key mapper + */ private final PrimaryKeyMapper idMapper = new PrimaryKeyMapper() { @Override public ClanID createID(Integer raw) { diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ItemMapper.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ItemMapper.java index cc6673ee0..bbd0b47e3 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ItemMapper.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/ItemMapper.java @@ -46,6 +46,9 @@ public class ItemMapper extends AbstractMapper { */ private final Logger log = LoggerFactory.getLogger(this.getClass()); + /** + * The primary key mapper + */ private final PrimaryKeyMapper idMapper = new PrimaryKeyMapper() { @Override public ItemID createID(Integer raw) { diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/NPCMapper.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/NPCMapper.java index c345f7b26..a9a7401d6 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/NPCMapper.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/mapper/NPCMapper.java @@ -43,6 +43,9 @@ public class NPCMapper extends AbstractMapper { */ private final Logger log = LoggerFactory.getLogger(this.getClass()); + /** + * The primary key mapper + */ private final PrimaryKeyMapper idMapper = new PrimaryKeyMapper() { @Override public NPCID createID(Integer raw) { diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QActorSkill.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QActorSkill.java index 18c7f8aab..6a8142eb3 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QActorSkill.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QActorSkill.java @@ -16,31 +16,67 @@ import com.mysema.query.types.path.NumberPath; * @author Rogiel */ public class QActorSkill extends RelationalPathBase { - private static final long serialVersionUID = -146336131; + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + /** + * Default entity for {@link QActorSkill} + */ public static final QActorSkill actorSkill = new QActorSkill("actor_skill"); + /** + * Column: actor_id + */ @ColumnSize(10) public final NumberPath actorId = createNumber("actor_id", Integer.class); + /** + * Column: skill_id + */ @ColumnSize(6) public final NumberPath skillId = createNumber("skill_id", Integer.class); + /** + * Column: level + */ @ColumnSize(4) public final NumberPath level = createNumber("level", Integer.class); + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(actorId, skillId); + /** + * Creates a new instance + * + * @param variable + * the query variable + */ public QActorSkill(String variable) { super(Skill.class, forVariable(variable), "null", "actor_skill"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QActorSkill(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "actor_skill"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QActorSkill(PathMetadata metadata) { super(Skill.class, metadata, "null", "actor_skill"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacter.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacter.java index d321c5fd7..29fbd0027 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacter.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacter.java @@ -24,72 +24,160 @@ import com.mysema.query.types.path.StringPath; * @author Rogiel */ public class QCharacter extends RelationalPathBase { - private static final long serialVersionUID = -59499032; + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + /** + * Default entity for {@link QCharacter} + */ public static final QCharacter character = new QCharacter("l2character"); + /** + * Column: character_id + */ @ColumnSize(10) public final NumberPath characterId = createNumber("character_id", Integer.class); + /** + * Column: account_id + */ @ColumnSize(50) public final StringPath accountId = createString("account_id"); + /** + * Column: clan_id + */ @ColumnSize(10) @ColumnNullable public final NumberPath clanId = createNumber("clan_id", Integer.class); + /** + * Column: name + */ @ColumnSize(100) public final StringPath name = createString("name"); + /** + * Column: race + */ public final EnumPath race = createEnum("race", CharacterRace.class); + /** + * Column: sex + */ public final EnumPath sex = createEnum("sex", ActorSex.class); + /** + * Column: character_class + */ public final EnumPath characterClass = createEnum("class", CharacterClass.class); + /** + * Column: level + */ @ColumnSize(4) public final NumberPath level = createNumber("level", Integer.class); + /** + * Column: experience + */ @ColumnSize(10) public final NumberPath experience = createNumber("experience", Long.class); + /** + * Column: sp + */ @ColumnSize(10) public final NumberPath sp = createNumber("sp", Integer.class); + /** + * Column: cp + */ public final NumberPath cp = createNumber("cp", Double.class); + /** + * Column: hp + */ public final NumberPath hp = createNumber("hp", Double.class); + /** + * Column: mp + */ public final NumberPath mp = createNumber("mp", Double.class); + /** + * Column: point_x + */ @ColumnSize(10) public final NumberPath pointX = createNumber("point_x", Integer.class); + /** + * Column: point_y + */ @ColumnSize(10) public final NumberPath pointY = createNumber("point_y", Integer.class); + /** + * Column: point_z + */ @ColumnSize(10) public final NumberPath pointZ = createNumber("point_z", Integer.class); + /** + * Column: point_angle + */ public final NumberPath pointAngle = createNumber("point_angle", Double.class); + /** + * Column: appearance_hair_color + */ public final EnumPath appearanceHairColor = createEnum( "appearance_hair_color", CharacterHairColor.class); + /** + * Column: appearance_hair_style + */ public final EnumPath appearanceHairStyle = createEnum( "appearance_hair_style", CharacterHairStyle.class); + /** + * Column: appearance_face + */ public final EnumPath apperanceFace = createEnum( "apperance_face", CharacterFace.class); + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(characterId); - //public final ForeignKey clanIdKey = createForeignKey(clanId, ""); + // public final ForeignKey clanIdKey = createForeignKey(clanId, ""); + + /** + * Creates a new instance + * + * @param variable + * the query variable + */ public QCharacter(String variable) { super(Integer.class, forVariable(variable), "null", "character"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QCharacter(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "character"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QCharacter(PathMetadata metadata) { super(Integer.class, metadata, "null", "character"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterFriend.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterFriend.java index bbf41135f..aa7c6371d 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterFriend.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterFriend.java @@ -16,30 +16,61 @@ import com.mysema.query.types.path.NumberPath; */ public class QCharacterFriend extends com.mysema.query.sql.RelationalPathBase { - private static final long serialVersionUID = 1488651942; + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + /** + * Default entity for {@link QCharacterFriend} + */ public static final QCharacterFriend characterFriend = new QCharacterFriend( "character_friend"); + /** + * Column: character_id + */ @ColumnSize(10) public final NumberPath characterId = createNumber("character_id", Integer.class); + /** + * Column: character_id_friend + */ @ColumnSize(10) public final NumberPath characterIdFriend = createNumber( "character_id_friend", Integer.class); + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(characterId, characterIdFriend); + /** + * Creates a new instance + * @param variable the query variable + */ public QCharacterFriend(String variable) { super(FriendID.class, forVariable(variable), "null", "character_friend"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QCharacterFriend(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "character_friend"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QCharacterFriend(PathMetadata metadata) { super(FriendID.class, metadata, "null", "character_friend"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterShortcut.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterShortcut.java index c6f3c7400..d44000112 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterShortcut.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QCharacterShortcut.java @@ -19,50 +19,99 @@ import com.mysema.query.types.path.NumberPath; */ public class QCharacterShortcut extends com.mysema.query.sql.RelationalPathBase { - private static final long serialVersionUID = 1450964558; - + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + + /** + * Default entity for {@link QCharacterShortcut} + */ public static final QCharacterShortcut characterShortcut = new QCharacterShortcut( "character_shortcut"); + /** + * Column: shortcut_id + */ @ColumnSize(10) @ColumnAutoIncrement public final NumberPath shortcutId = createNumber("shortcut_id", Integer.class); + /** + * Column: character_id + */ @ColumnSize(10) public final NumberPath characterId = createNumber("character_id", Integer.class); + /** + * Column: character_type + */ @ColumnSize(10) @ColumnNullable public final NumberPath characterType = createNumber( "character_type", Integer.class); + /** + * Column: level + */ @ColumnSize(3) @ColumnNullable public final NumberPath level = createNumber("level", Integer.class); + /** + * Column: object_id + */ @ColumnSize(10) public final NumberPath objectId = createNumber("object_id", Integer.class); + /** + * Column: page + */ @ColumnSize(2) public final NumberPath page = createNumber("page", Integer.class); + /** + * Column: slot + */ @ColumnSize(2) public final NumberPath slot = createNumber("slot", Integer.class); + /** + * Column: type + */ public final EnumPath type = createEnum("type", ShortcutType.class); + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(shortcutId); + /** + * Creates a new instance + * @param variable the query variable + */ public QCharacterShortcut(String variable) { super(Integer.class, forVariable(variable), "null", "character_shortcut"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QCharacterShortcut(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "character_shortcut"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QCharacterShortcut(PathMetadata metadata) { super(Integer.class, metadata, "null", "character_shortcut"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QClan.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QClan.java index 0fb2bc517..6a6a077f1 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QClan.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QClan.java @@ -14,27 +14,58 @@ import com.mysema.query.types.path.NumberPath; * @author Rogiel */ public class QClan extends com.mysema.query.sql.RelationalPathBase { - private static final long serialVersionUID = 1592083511; - + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + + /** + * Default entity for {@link QClan} + */ public static final QClan clan = new QClan("clan"); + /** + * Column: clan_id + */ @ColumnSize(10) public final NumberPath clanId = createNumber("clan_id", Integer.class); + /** + * Column: character_id_leader + */ @ColumnSize(10) public final NumberPath characterIdLeader = createNumber( "character_id_leader", Integer.class); + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(clanId); + /** + * Creates a new instance + * @param variable the query variable + */ public QClan(String variable) { super(Integer.class, forVariable(variable), "null", "clan"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QClan(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "clan"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QClan(PathMetadata metadata) { super(Integer.class, metadata, "null", "clan"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QItem.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QItem.java index cd7fc6769..68d8ef68a 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QItem.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QItem.java @@ -19,54 +19,106 @@ import com.mysema.query.types.path.NumberPath; * @author Rogiel */ public class QItem extends com.mysema.query.sql.RelationalPathBase { - private static final long serialVersionUID = 1592270068; - + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + + /** + * Default entity for {@link QItem} + */ public static final QItem item = new QItem("item"); + /** + * Column: item_id + */ @ColumnSize(10) public final NumberPath itemId = createNumber("item_id", Integer.class); + /** + * Column: template_id + */ @ColumnSize(5) public final NumberPath templateId = createNumber("template_id", Integer.class); + /** + * Column: character_id + */ @ColumnSize(10) @ColumnNullable public final NumberPath characterId = createNumber("character_id", Integer.class); + /** + * Column: coord_x + */ @ColumnSize(10) @ColumnNullable public final NumberPath coordX = createNumber("coord_x", Integer.class); + /** + * Column: coord_y + */ @ColumnSize(10) @ColumnNullable public final NumberPath coordY = createNumber("coord_y", Integer.class); + /** + * Column: coord_z + */ @ColumnSize(10) @ColumnNullable public final NumberPath coordZ = createNumber("coord_z", Integer.class); + /** + * Column: count + */ @ColumnSize(10) public final NumberPath count = createNumber("count", Long.class); + /** + * Column: location + */ @ColumnDefault("INVENTORY") public final EnumPath location = createEnum("location", ItemLocation.class); + /** + * Column: paperdoll + */ @ColumnNullable public final EnumPath paperdoll = createEnum( "paperdoll", InventoryPaperdoll.class); + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(itemId); + /** + * Creates a new instance + * @param variable the query variable + */ public QItem(String variable) { super(Integer.class, forVariable(variable), "null", "item"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QItem(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "item"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QItem(PathMetadata metadata) { super(Integer.class, metadata, "null", "item"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QLogChat.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QLogChat.java index 79ee5487d..af6f97993 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QLogChat.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QLogChat.java @@ -22,42 +22,84 @@ import com.mysema.query.types.path.StringPath; * @author Rogiel */ public class QLogChat extends com.mysema.query.sql.RelationalPathBase { - private static final long serialVersionUID = -76124357; - + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + + /** + * Default entity for {@link QLogChat} + */ public static final QLogChat logChat = new QLogChat("log_chat"); + /** + * Column: message_id + */ @ColumnSize(10) @ColumnAutoIncrement public final NumberPath messageId = createNumber("message_id", Integer.class); + /** + * Column: channel_id + */ @ColumnSize(10) @ColumnNullable public final NumberPath channelId = createNumber("channel_id", Integer.class); + /** + * Column: sender + */ @ColumnSize(10) @ColumnNullable public final NumberPath sender = createNumber("sender", Integer.class); + /** + * Column: date + */ public final DateTimePath date = createDateTime("date", Date.class); + /** + * Column: message + */ @ColumnSize(255) public final StringPath message = createString("message"); + /** + * Column: type + */ public final EnumPath type = createEnum("type", ChatMessageType.class); - + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(messageId); + /** + * Creates a new instance + * @param variable the query variable + */ public QLogChat(String variable) { super(Integer.class, forVariable(variable), "null", "log_chat"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QLogChat(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "log_chat"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QLogChat(PathMetadata metadata) { super(Integer.class, metadata, "null", "log_chat"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QNPC.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QNPC.java index 347b8949f..8c092c65b 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QNPC.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/model/QNPC.java @@ -14,46 +14,98 @@ import com.mysema.query.types.path.NumberPath; * @author Rogiel */ public class QNPC extends com.mysema.query.sql.RelationalPathBase { - private static final long serialVersionUID = 2129578208; + /** + * The Java Serialization UID + */ + private static final long serialVersionUID = 1L; + /** + * Default entity for {@link QNPC} + */ public static final QNPC npc = new QNPC("npc"); + /** + * Column: npc_id + */ @ColumnSize(10) public final NumberPath npcId = createNumber("npc_id", Integer.class); + /** + * Column: npc_template_id + */ @ColumnSize(4) public final NumberPath npcTemplateId = createNumber( "npc_template_id", Integer.class); + /** + * Column: hp + */ public final NumberPath hp = createNumber("hp", Double.class); + /** + * Column: mp + */ public final NumberPath mp = createNumber("mp", Double.class); + /** + * Column: point_x + */ @ColumnSize(10) public final NumberPath pointX = createNumber("point_x", Integer.class); + /** + * Column: point_y + */ @ColumnSize(10) public final NumberPath pointY = createNumber("point_y", Integer.class); + /** + * Column: point_z + */ @ColumnSize(10) public final NumberPath pointZ = createNumber("point_z", Integer.class); + /** + * Column: point_angle + */ public final NumberPath pointAngle = createNumber("point_angle", Double.class); + /** + * Column: respawn_time + */ @ColumnSize(8) public final NumberPath respawnTime = createNumber("respawn_time", Long.class); + /** + * The entity primary key + */ public final PrimaryKey primary = createPrimaryKey(npcId); + /** + * Creates a new instance + * @param variable the query variable + */ public QNPC(String variable) { super(Integer.class, forVariable(variable), "null", "npc"); } + /** + * Creates a new instance + * + * @param entity + * the parent entity + */ public QNPC(Path entity) { super(entity.getType(), entity.getMetadata(), "null", "npc"); } + /** + * Creates a new instance + * + * @param metadata + * the entity metadata + */ public QNPC(PathMetadata metadata) { super(Integer.class, metadata, "null", "npc"); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/chat/ChatMessageType.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/chat/ChatMessageType.java index eaa0a2eb8..064f90564 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/chat/ChatMessageType.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/chat/ChatMessageType.java @@ -69,9 +69,47 @@ public enum ChatMessageType { /** * Boat */ - BOAT(11), L2FRIEND(12), MSNCHAT(13), PARTYMATCH_ROOM(14), PARTYROOM_COMMANDER( - 15), PARTYROOM_ALL(16), HERO_VOICE(17), CRITICAL_ANNOUNCE(18), SCREEN_ANNOUNCE( - 19), BATTLEFIELD(20), MPCC_ROOM(21); + BOAT(11), + /** + * Message sent to an Lineage II friend + */ + L2FRIEND(12), + /** + * MSN Chat log + */ + MSNCHAT(13), + /** + * PartyMatching room + */ + PARTYMATCH_ROOM(14), + /** + * The party room command + */ + PARTYROOM_COMMANDER(15), + /** + * Party room all + */ + PARTYROOM_ALL(16), + /** + * Hero chat + */ + HERO_VOICE(17), + /** + * Critical announcement + */ + CRITICAL_ANNOUNCE(18), + /** + * Screen announce + */ + SCREEN_ANNOUNCE(19), + /** + * Battlefield + */ + BATTLEFIELD(20), + /** + * UNKNOWN + */ + MPCC_ROOM(21); /** * The numeric id representing this message type diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/effect/SimpleEffectService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/effect/SimpleEffectService.java index fbb72dd8e..7b6157a41 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/effect/SimpleEffectService.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/effect/SimpleEffectService.java @@ -56,6 +56,9 @@ public class SimpleEffectService extends AbstractService implements */ private List actors; + /** + * @param threadService the thread service + */ @Inject private SimpleEffectService(ThreadService threadService) { this.threadService = threadService; diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Calculator.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Calculator.java index cc85d67f4..f4f90ad24 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Calculator.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Calculator.java @@ -25,7 +25,29 @@ package com.l2jserver.util.calculator; */ public interface Calculator> extends Function { - double calculate(V v, T ctx, double value); + /** + * Calculates the result for the given ctx and + * variable and value. + * + * @param variable + * the variable + * @param ctx + * the context + * @param value + * the value + * @return the calculated value + */ + double calculate(V variable, T ctx, double value); - double calculate(V v, T ctx); + /** + * Calculates the result for the given ctx and + * variable. Original value is 0. + * + * @param variable + * the variable + * @param ctx + * the context + * @return the calculated value + */ + double calculate(V variable, T ctx); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/ComplexCalculator.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/ComplexCalculator.java index 30354c12a..96b71e7bb 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/ComplexCalculator.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/ComplexCalculator.java @@ -263,12 +263,18 @@ public class ComplexCalculator> } } + /** + * Sorts the function accordingly to their execution order + */ public void sort() { for (final Function[] funcs : functions.values()) { Arrays.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE); } } + /** + * Clears the functions on this calculator + */ public void clear() { functions.clear(); } @@ -291,6 +297,13 @@ public class ComplexCalculator> return calculate(v, ctx, 0); } + /** + * Get the List of functions for the given value + * + * @param value + * the value + * @return the list + */ @SuppressWarnings("unchecked") private Function[] getList(V value) { Function[] list = functions.get(value); @@ -301,14 +314,31 @@ public class ComplexCalculator> return list; } + /** + * + * @param value + * @param func + */ private void setList(V value, Function[] func) { functions.put(value, func); } + /** + * This comparator compares two {@link Function}s based on its execution + * oder + * + * @author Rogiel + */ public static class FunctionOrderComparator implements Comparator>, Serializable { + /** + * Java Serialization UID + */ private static final long serialVersionUID = 1L; + /** + * Shared instance (recommeded) + */ public static final FunctionOrderComparator SHARED_INSTANCE = new FunctionOrderComparator(); @Override diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Function.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Function.java index 645e9032f..22c139f52 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Function.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/Function.java @@ -46,5 +46,8 @@ public interface Function> { */ int order(); + /** + * @return function type + */ V type(); } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/SimpleCalculator.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/SimpleCalculator.java index 34e6f7999..17b9c8834 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/SimpleCalculator.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/util/calculator/SimpleCalculator.java @@ -16,9 +16,9 @@ */ package com.l2jserver.util.calculator; -import java.io.Serializable; import java.util.Arrays; -import java.util.Comparator; + +import com.l2jserver.util.calculator.ComplexCalculator.FunctionOrderComparator; /** * An calculator is used to compute data and outputs its result. Note also, that @@ -33,6 +33,9 @@ import java.util.Comparator; */ public class SimpleCalculator> extends AbstractDoubleFunction implements Calculator { + /** + * The value + */ protected final V value; /** * List of operations in this calculator @@ -75,16 +78,4 @@ public class SimpleCalculator> public double calculate(T ctx, double value) { return 0; } - - public static class FunctionOrderComparator implements - Comparator>, Serializable { - private static final long serialVersionUID = 1L; - - public static final FunctionOrderComparator SHARED_INSTANCE = new FunctionOrderComparator(); - - @Override - public int compare(Function func1, Function func2) { - return (func1.order() - func2.order()); - } - } } \ No newline at end of file diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java index e04c501f0..a7cfcbd30 100644 --- a/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java +++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java @@ -30,13 +30,22 @@ import com.l2jserver.model.world.L2Character; import com.l2jserver.service.ServiceManager; import com.l2jserver.service.ServiceStartException; import com.l2jserver.service.database.DatabaseService; +import com.l2jserver.service.database.dao.sql.SQLCharacterDAO; import com.l2jserver.service.database.mapper.CharacterFriendMapper; import com.l2jserver.service.database.mapper.CharacterMapper; import com.l2jserver.service.database.mapper.CharacterShortcutMapper; import com.l2jserver.service.game.template.TemplateService; import com.l2jserver.service.game.world.WorldService; +/** + * Test for {@link SQLCharacterDAO} + * + * @author Rogiel + */ public class MySQL5CharacterDAOTest { + /** + * The {@link Guice} {@link Injector} + */ private final Injector injector = Guice.createInjector(Stage.PRODUCTION, new GameServerModule(), new AbstractModule() { @Override @@ -47,6 +56,11 @@ public class MySQL5CharacterDAOTest { } }); + /** + * Test cached object loading + * + * @throws ServiceStartException + */ @Test public void testCachedLoad() throws ServiceStartException { injector.getInstance(ServiceManager.class).start(TemplateService.class); @@ -54,7 +68,7 @@ public class MySQL5CharacterDAOTest { injector.getInstance(ServiceManager.class).start(WorldService.class); final CharacterDAO dao = injector.getInstance(CharacterDAO.class); - + final L2Character char1 = dao.select(injector.getInstance( CharacterIDProvider.class).resolveID(268437456)); final L2Character char2 = dao.select(injector.getInstance( diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java index 41ceacff1..061dd6433 100644 --- a/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java +++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java @@ -35,11 +35,26 @@ import com.l2jserver.service.database.JDBCDAOModule; import com.l2jserver.service.game.template.TemplateService; import com.l2jserver.service.game.world.WorldService; +/** + * Test for {@link CharacterIDProvider} + * + * @author Rogiel + */ public class CharacterIDProviderTest { + /** + * The {@link Guice} {@link Injector} + */ private final Injector injector = Guice.createInjector(new ServiceModule(), new JDBCDAOModule(), new IDProviderModule()); + /** + * The character id provider + */ private CharacterIDProvider charIdFactory; + /** + * Prepares the test + * @throws ServiceStartException + */ @Before public void tearUp() throws ServiceStartException { injector.getInstance(ServiceManager.class).start(TemplateService.class); @@ -48,6 +63,9 @@ public class CharacterIDProviderTest { charIdFactory = injector.getInstance(CharacterIDProvider.class); } + /** + * Tests ID creation + */ @Test public void testCreateID() { final ID id1 = charIdFactory.createID(); @@ -56,6 +74,9 @@ public class CharacterIDProviderTest { Assert.assertFalse(id1.equals(id2)); } + /** + * Tests ID destroying + */ @Test public void testDestroy() { final CharacterID id1 = charIdFactory.createID(); @@ -63,6 +84,10 @@ public class CharacterIDProviderTest { charIdFactory.destroy(id1); } + /** + * Tests DAO aware ids + * @throws ServiceStartException + */ @Test public void testGetObject() throws ServiceStartException { final CharacterID id = charIdFactory.resolveID(268437456); diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/scripting/ScriptingServiceImplTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/scripting/ScriptingServiceImplTest.java index 491d9f6ab..95b0ec9e4 100644 --- a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/scripting/ScriptingServiceImplTest.java +++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/scripting/ScriptingServiceImplTest.java @@ -28,7 +28,15 @@ import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Scopes; +/** + * Test for {@link ScriptingService} + * + * @author Rogiel + */ public class ScriptingServiceImplTest { + /** + * The {@link Guice} {@link Injector} + */ private final Injector injector = Guice .createInjector(new AbstractModule() { @Override @@ -37,9 +45,16 @@ public class ScriptingServiceImplTest { .in(Scopes.SINGLETON); } }); + /** + * The scripting service + */ private final ScriptingService service = injector .getInstance(ScriptingService.class); + /** + * Tests script loading + * @throws Exception + */ @Test public void testLoading() throws Exception { final List contexts = service.load(new File( @@ -47,6 +62,10 @@ public class ScriptingServiceImplTest { Assert.assertEquals(1, contexts.size()); } + /** + * Tests script instantiation + * @throws Exception + */ @Test public void testCreatingInstance() throws Exception { final List contexts = service.load(new File( diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/template/StaticTemplateServiceTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/template/StaticTemplateServiceTest.java deleted file mode 100644 index f5a0d4e60..000000000 --- a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/game/template/StaticTemplateServiceTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of l2jserver2 . - * - * l2jserver2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * l2jserver2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with l2jserver2. If not, see . - */ -package com.l2jserver.service.game.template; - -import org.junit.Test; - -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.l2jserver.model.id.provider.IDProviderModule; -import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider; -import com.l2jserver.service.ServiceManager; -import com.l2jserver.service.ServiceModule; -import com.l2jserver.service.ServiceStartException; -import com.l2jserver.service.database.JDBCDAOModule; - -public class StaticTemplateServiceTest { - private final Injector injector = Guice.createInjector(new ServiceModule(), - new IDProviderModule(), new JDBCDAOModule()); - private final ItemTemplateIDProvider factory = injector - .getInstance(ItemTemplateIDProvider.class); - - @Test - public void testAdena() throws ServiceStartException { - injector.getInstance(ServiceManager.class).start(TemplateService.class); - System.out.println(factory.resolveID(57).getTemplate()); - } -} diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java index 4d7d00fed..95967a61c 100644 --- a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java +++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java @@ -41,14 +41,36 @@ import com.l2jserver.service.ServiceStartException; import com.l2jserver.service.game.world.WorldIDService; import com.l2jserver.service.game.world.WorldService; import com.l2jserver.service.game.world.event.WorldEventDispatcher; +import com.l2jserver.service.game.world.event.WorldEventDispatcherImpl; +/** + * Test for {@link WorldEventDispatcherImpl} + * + * @author Rogiel + */ public class WorldEventDispatcherImplTest { + /** + * The world service + */ private WorldService world; + /** + * The dispatcher + */ private WorldEventDispatcher dispatcher; + /** + * The character id provider + */ private CharacterIDProvider cidFactory; + /** + * The item id provider + */ private ItemIDProvider iidFactory; + /** + * Prepares the tests + * @throws ServiceStartException + */ @Before public void tearUp() throws ServiceStartException { Injector injector = Guice.createInjector(Stage.PRODUCTION, @@ -66,6 +88,10 @@ public class WorldEventDispatcherImplTest { world.start(); } + /** + * Test listenteners - mode 1 + * @throws InterruptedException + */ @Test public void testListeners1() throws InterruptedException { final L2Character character1 = new L2Character(null); @@ -107,6 +133,10 @@ public class WorldEventDispatcherImplTest { Assert.assertFalse(bool.get()); } + /** + * Test listeners - mode 2 + * @throws InterruptedException + */ @Test public void testListeners2() throws InterruptedException { final L2Character character1 = new L2Character(null); diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java index cf6cbaf21..d7251318c 100644 --- a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java +++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java @@ -31,12 +31,27 @@ import com.l2jserver.model.world.WorldObject; import com.l2jserver.service.ServiceManager; import com.l2jserver.service.ServiceStartException; import com.l2jserver.service.game.world.WorldService; +import com.l2jserver.service.game.world.WorldServiceImpl; import com.l2jserver.service.game.world.filter.impl.InstanceFilter; +/** + * Tests for {@link WorldServiceImpl} + * @author Rogiel + */ public class WorldServiceImplTest { + /** + * The world service + */ private WorldService world; + /** + * The character id provider + */ private CharacterIDProvider provider; + /** + * Preparation for tests + * @throws ServiceStartException + */ @Before public void tearUp() throws ServiceStartException { Injector injector = Guice.createInjector(new GameServerModule()); @@ -46,6 +61,9 @@ public class WorldServiceImplTest { provider = injector.getInstance(CharacterIDProvider.class); } + /** + * Test adding object to world + */ @Test public void testAdd() { final L2Character character = new L2Character(null); @@ -53,12 +71,18 @@ public class WorldServiceImplTest { Assert.assertTrue(world.add(character)); } + /** + * Test adding null object to world + */ @Test(expected = NullPointerException.class) public void testAddNullId() { final L2Character character = new L2Character(null); world.add(character); } + /** + * Test removing object from world + */ @Test public void testRemove() { final L2Character character = new L2Character(null); @@ -67,6 +91,9 @@ public class WorldServiceImplTest { Assert.assertTrue(world.remove(character)); } + /** + * Test removing 2 objects from world + */ @Test public void testRemoveOther() { final L2Character character1 = new L2Character(null); @@ -79,6 +106,9 @@ public class WorldServiceImplTest { Assert.assertFalse(world.remove(character2)); } + /** + * Test removing null id + */ @Test(expected = NullPointerException.class) public void testRemoveNullId() { final L2Character character = new L2Character(null); @@ -86,6 +116,9 @@ public class WorldServiceImplTest { world.remove(character); } + /** + * Test if the object exists + */ @Test public void testContains() { final L2Character character = new L2Character(null); @@ -94,6 +127,9 @@ public class WorldServiceImplTest { Assert.assertTrue(world.contains(character)); } + /** + * Test if the an null object exists + */ @Test(expected = NullPointerException.class) public void testContainsNullId() { final L2Character character = new L2Character(null); @@ -101,6 +137,9 @@ public class WorldServiceImplTest { Assert.assertTrue(world.contains(character)); } + /** + * Test the world iterator + */ @Test public void testIterator() { final L2Character character1 = new L2Character(null);