Jelajahi Sumber

BETA: Adding some !JavaDocs.

Zoey76 11 tahun lalu
induk
melakukan
e69d2bb2be

+ 236 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentParser.java

@@ -35,8 +35,7 @@ import com.l2jserver.Config;
 import com.l2jserver.util.file.filter.XMLFilter;
 
 /**
- * Abstract class for XML parsers.<br>
- * It's in <i>beta</i> state, so it's expected to change over time.
+ * Abstract class for XML parsers.
  * @author Zoey76
  */
 public abstract class DocumentParser
@@ -45,8 +44,8 @@ public abstract class DocumentParser
 	
 	private static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
 	private static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
-	
-	private static final XMLFilter xmlFilter = new XMLFilter();
+	/** The default file filter, ".xml" files only. */
+	private static final XMLFilter XML_FILTER = new XMLFilter();
 	
 	private File _currentFile;
 	
@@ -208,166 +207,366 @@ public abstract class DocumentParser
 	 */
 	protected abstract void parseDocument();
 	
+	/**
+	 * Parses a boolean value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Boolean parseBoolean(Node node, Boolean defaultValue)
 	{
 		return node != null ? Boolean.valueOf(node.getNodeValue()) : defaultValue;
 	}
 	
+	/**
+	 * Parses a boolean value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Boolean parseBoolean(Node node)
 	{
 		return parseBoolean(node, null);
 	}
 	
+	/**
+	 * Parses a boolean value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Boolean parseBoolean(NamedNodeMap attrs, String name)
 	{
 		return parseBoolean(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses a boolean value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Boolean parseBoolean(NamedNodeMap attrs, String name, Boolean defaultValue)
 	{
 		return parseBoolean(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses a byte value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Byte parseByte(Node node, Byte defaultValue)
 	{
 		return node != null ? Byte.valueOf(node.getNodeValue()) : defaultValue;
 	}
 	
+	/**
+	 * Parses a byte value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Byte parseByte(Node node)
 	{
 		return parseByte(node, null);
 	}
 	
+	/**
+	 * Parses a byte value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Byte parseByte(NamedNodeMap attrs, String name)
 	{
 		return parseByte(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses a byte value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Byte parseByte(NamedNodeMap attrs, String name, Byte defaultValue)
 	{
 		return parseByte(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses a short value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Short parseShort(Node node, Short defaultValue)
 	{
 		return node != null ? Short.valueOf(node.getNodeValue()) : defaultValue;
 	}
 	
+	/**
+	 * Parses a short value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Short parseShort(Node node)
 	{
 		return parseShort(node, null);
 	}
 	
+	/**
+	 * Parses a short value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Short parseShort(NamedNodeMap attrs, String name)
 	{
 		return parseShort(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses a short value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Short parseShort(NamedNodeMap attrs, String name, Short defaultValue)
 	{
 		return parseShort(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses an integer value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Integer parseInteger(Node node, Integer defaultValue)
 	{
 		return node != null ? Integer.valueOf(node.getNodeValue()) : defaultValue;
 	}
 	
+	/**
+	 * Parses an integer value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Integer parseInteger(Node node)
 	{
 		return parseInteger(node, null);
 	}
 	
+	/**
+	 * Parses an integer value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Integer parseInteger(NamedNodeMap attrs, String name)
 	{
 		return parseInteger(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses an integer value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Integer parseInteger(NamedNodeMap attrs, String name, Integer defaultValue)
 	{
 		return parseInteger(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses a long value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Long parseLong(Node node, Long defaultValue)
 	{
 		return node != null ? Long.valueOf(node.getNodeValue()) : defaultValue;
 	}
 	
+	/**
+	 * Parses a long value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Long parseLong(Node node)
 	{
 		return parseLong(node, null);
 	}
 	
+	/**
+	 * Parses a long value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Long parseLong(NamedNodeMap attrs, String name)
 	{
 		return parseLong(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses a long value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Long parseLong(NamedNodeMap attrs, String name, Long defaultValue)
 	{
 		return parseLong(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses a float value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Float parseFloat(Node node, Float defaultValue)
 	{
 		return node != null ? Float.valueOf(node.getNodeValue()) : defaultValue;
 	}
 	
+	/**
+	 * Parses a float value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Float parseFloat(Node node)
 	{
 		return parseFloat(node, null);
 	}
 	
+	/**
+	 * Parses a float value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Float parseFloat(NamedNodeMap attrs, String name)
 	{
 		return parseFloat(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses a float value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Float parseFloat(NamedNodeMap attrs, String name, Float defaultValue)
 	{
 		return parseFloat(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses a double value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Double parseDouble(Node node, Double defaultValue)
 	{
 		return node != null ? Double.valueOf(node.getNodeValue()) : defaultValue;
 	}
 	
+	/**
+	 * Parses a double value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Double parseDouble(Node node)
 	{
 		return parseDouble(node, null);
 	}
 	
+	/**
+	 * Parses a double value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected Double parseDouble(NamedNodeMap attrs, String name)
 	{
 		return parseDouble(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses a double value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected Double parseDouble(NamedNodeMap attrs, String name, Double defaultValue)
 	{
 		return parseDouble(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses a string value.
+	 * @param node the node to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected String parseString(Node node, String defaultValue)
 	{
 		return node != null ? node.getNodeValue() : defaultValue;
 	}
 	
+	/**
+	 * Parses a string value.
+	 * @param node the node to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected String parseString(Node node)
 	{
 		return parseString(node, null);
 	}
 	
+	/**
+	 * Parses a string value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null, the value of the parsed node, otherwise null
+	 */
 	protected String parseString(NamedNodeMap attrs, String name)
 	{
 		return parseString(attrs.getNamedItem(name));
 	}
 	
+	/**
+	 * Parses a string value.
+	 * @param attrs the attributes
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null, the value of the parsed node, otherwise the default value
+	 */
 	protected String parseString(NamedNodeMap attrs, String name, String defaultValue)
 	{
 		return parseString(attrs.getNamedItem(name), defaultValue);
 	}
 	
+	/**
+	 * Parses an enumerated value.
+	 * @param <T> the enumerated type
+	 * @param node the node to parse
+	 * @param clazz the class of the enumerated
+	 * @param defaultValue the default value
+	 * @return if the node is not null and the node value is valid the parsed value, otherwise the default value
+	 */
 	protected <T extends Enum<T>> T parseEnum(Node node, Class<T> clazz, T defaultValue)
 	{
 		if (node == null)
@@ -386,29 +585,61 @@ public abstract class DocumentParser
 		}
 	}
 	
+	/**
+	 * Parses an enumerated value.
+	 * @param <T> the enumerated type
+	 * @param node the node to parse
+	 * @param clazz the class of the enumerated
+	 * @return if the node is not null and the node value is valid the parsed value, otherwise null
+	 */
 	protected <T extends Enum<T>> T parseEnum(Node node, Class<T> clazz)
 	{
 		return parseEnum(node, clazz, null);
 	}
 	
+	/**
+	 * Parses an enumerated value.
+	 * @param <T> the enumerated type
+	 * @param attrs the attributes
+	 * @param clazz the class of the enumerated
+	 * @param name the name of the attribute to parse
+	 * @return if the node is not null and the node value is valid the parsed value, otherwise null
+	 */
 	protected <T extends Enum<T>> T parseEnum(NamedNodeMap attrs, Class<T> clazz, String name)
 	{
 		return parseEnum(attrs.getNamedItem(name), clazz);
 	}
 	
+	/**
+	 * Parses an enumerated value.
+	 * @param <T> the enumerated type
+	 * @param attrs the attributes
+	 * @param clazz the class of the enumerated
+	 * @param name the name of the attribute to parse
+	 * @param defaultValue the default value
+	 * @return if the node is not null and the node value is valid the parsed value, otherwise the default value
+	 */
 	protected <T extends Enum<T>> T parseEnum(NamedNodeMap attrs, Class<T> clazz, String name, T defaultValue)
 	{
 		return parseEnum(attrs.getNamedItem(name), clazz, defaultValue);
 	}
 	
+	/**
+	 * Sets the current file filter.
+	 * @param filter the file filter
+	 */
 	public void setCurrentFileFilter(FileFilter filter)
 	{
 		_currentFilter = filter;
 	}
 	
+	/**
+	 * Gets the current file filter.
+	 * @return the current file filter
+	 */
 	public FileFilter getCurrentFileFilter()
 	{
-		return _currentFilter != null ? _currentFilter : xmlFilter;
+		return _currentFilter != null ? _currentFilter : XML_FILTER;
 	}
 	
 	/**

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/appearance/PcAppearance.java

@@ -46,10 +46,10 @@ public class PcAppearance
 	/** The current visible title of this player, not necessarily the real one */
 	private String _visibleTitle;
 	
-	/** The hexadecimal Color of players name (white is 0xFFFFFF) */
+	/** The default name color is 0xFFFFFF. */
 	private int _nameColor = 0xFFFFFF;
 	
-	/** The hexadecimal Color of players name (white is 0xFFFFFF) */
+	/** The default title color is 0xECF9A2. */
 	private int _titleColor = DEFAULT_TITLE_COLOR;
 	
 	public PcAppearance(byte face, byte hColor, byte hStyle, boolean sex)

+ 45 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/quest/Quest.java

@@ -3811,16 +3811,61 @@ public class Quest extends ManagedScript implements IIdentifiable
 		player.teleToLocation(loc, allowRandomOffset);
 	}
 	
+	/**
+	 * Sends the special camera packet to the player.
+	 * @param player the player
+	 * @param creature the watched creature
+	 * @param force
+	 * @param angle1
+	 * @param angle2
+	 * @param time
+	 * @param range
+	 * @param duration
+	 * @param relYaw
+	 * @param relPitch
+	 * @param isWide
+	 * @param relAngle
+	 */
 	public static final void specialCamera(L2PcInstance player, L2Character creature, int force, int angle1, int angle2, int time, int range, int duration, int relYaw, int relPitch, int isWide, int relAngle)
 	{
 		player.sendPacket(new SpecialCamera(creature, force, angle1, angle2, time, range, duration, relYaw, relPitch, isWide, relAngle));
 	}
 	
+	/**
+	 * Sends the special camera packet to the player.
+	 * @param player
+	 * @param creature
+	 * @param force
+	 * @param angle1
+	 * @param angle2
+	 * @param time
+	 * @param duration
+	 * @param relYaw
+	 * @param relPitch
+	 * @param isWide
+	 * @param relAngle
+	 */
 	public static final void specialCameraEx(L2PcInstance player, L2Character creature, int force, int angle1, int angle2, int time, int duration, int relYaw, int relPitch, int isWide, int relAngle)
 	{
 		player.sendPacket(new SpecialCamera(creature, player, force, angle1, angle2, time, duration, relYaw, relPitch, isWide, relAngle));
 	}
 	
+	/**
+	 * Sends the special camera packet to the player.
+	 * @param player
+	 * @param creature
+	 * @param force
+	 * @param angle1
+	 * @param angle2
+	 * @param time
+	 * @param range
+	 * @param duration
+	 * @param relYaw
+	 * @param relPitch
+	 * @param isWide
+	 * @param relAngle
+	 * @param unk
+	 */
 	public static final void specialCamera3(L2PcInstance player, L2Character creature, int force, int angle1, int angle2, int time, int range, int duration, int relYaw, int relPitch, int isWide, int relAngle, int unk)
 	{
 		player.sendPacket(new SpecialCamera(creature, force, angle1, angle2, time, range, duration, relYaw, relPitch, isWide, relAngle, unk));

+ 22 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/L2Skill.java

@@ -1280,17 +1280,34 @@ public abstract class L2Skill implements IChanceSkillTrigger, IIdentifiable
 		return funcs;
 	}
 	
+	/**
+	 * Gets the skill effects.
+	 * @param effectScope the effect scope
+	 * @return the list of effects for the give scope
+	 */
 	public List<AbstractEffect> getEffects(EffectScope effectScope)
 	{
 		return _effectLists.get(effectScope);
 	}
 	
+	/**
+	 * Verify if this skill has effects for the given scope.
+	 * @param effectScope the effect scope
+	 * @return {@code true} if this skill has effects for the given scope, {@code false} otherwise
+	 */
 	public boolean hasEffects(EffectScope effectScope)
 	{
 		List<AbstractEffect> effects = _effectLists.get(effectScope);
 		return (effects != null) && !effects.isEmpty();
 	}
 	
+	/**
+	 * Applies the effects from this skill to the target for the given effect scope.
+	 * @param effectScope the effect scope
+	 * @param info the buff info
+	 * @param applyInstantEffects if {@code true} instant effects will be applied to the effected
+	 * @param addContinuousEffects if {@code true} continuous effects will be applied to the effected
+	 */
 	public void applyEffectScope(EffectScope effectScope, BuffInfo info, boolean applyInstantEffects, boolean addContinuousEffects)
 	{
 		if ((effectScope != null) && hasEffects(effectScope))
@@ -1442,6 +1459,11 @@ public abstract class L2Skill implements IChanceSkillTrigger, IIdentifiable
 		_funcTemplates.add(f);
 	}
 	
+	/**
+	 * Adds an effect to the effect list for the give effect scope.
+	 * @param effectScope the effect scope
+	 * @param effect the effect to add
+	 */
 	public final void addEffect(EffectScope effectScope, AbstractEffect effect)
 	{
 		List<AbstractEffect> effects = _effectLists.get(effectScope);