Updated README for line-ending demands, also fixed line-endigs.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
Bukkit/Spigot 2011-04-25 13:24:32 +02:00
parent 485a47aac4
commit 2556140901
46 changed files with 1240 additions and 1239 deletions

View file

@ -21,6 +21,7 @@ Coding and Pull Request Conventions
* No tabs; use 4 spaces instead. * No tabs; use 4 spaces instead.
* No trailing whitespaces. * No trailing whitespaces.
* No 80 column limit or midstatement newlines. * No 80 column limit or midstatement newlines.
* No CRLF lineendigs, LF only, put your gits 'core.autocrlf' on 'true'
* Proper javadoc for each method added/changed to describe what it does. * Proper javadoc for each method added/changed to describe what it does.
* The number of commits in a pull request should be kept to a minimum (squish them into one most of the time - use common sense!). * The number of commits in a pull request should be kept to a minimum (squish them into one most of the time - use common sense!).
* No merges should be included in pull requests unless the pull request's purpose is a merge. * No merges should be included in pull requests unless the pull request's purpose is a merge.

View file

@ -1,14 +1,14 @@
package org.bukkit; package org.bukkit;
/** /**
* Tree type. * Tree type.
* *
* @author sk89q * @author sk89q
*/ */
public enum TreeType { public enum TreeType {
TREE, TREE,
BIG_TREE, BIG_TREE,
REDWOOD, REDWOOD,
TALL_REDWOOD, TALL_REDWOOD,
BIRCH BIRCH
} }

View file

@ -1,9 +1,9 @@
package org.bukkit.block; package org.bukkit.block;
/** /**
* Represents a chest. * Represents a chest.
* *
* @author sk89q * @author sk89q
*/ */
public interface Chest extends BlockState, ContainerBlock { public interface Chest extends BlockState, ContainerBlock {
} }

View file

@ -1,17 +1,17 @@
package org.bukkit.block; package org.bukkit.block;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
/** /**
* Indicates a block type that has inventory. * Indicates a block type that has inventory.
* *
* @author sk89q * @author sk89q
*/ */
public interface ContainerBlock { public interface ContainerBlock {
/** /**
* Get the block's inventory. * Get the block's inventory.
* *
* @return * @return
*/ */
public Inventory getInventory(); public Inventory getInventory();
} }

View file

@ -1,54 +1,54 @@
package org.bukkit.block; package org.bukkit.block;
import org.bukkit.entity.CreatureType; import org.bukkit.entity.CreatureType;
/** /**
* Represents a creature spawner. * Represents a creature spawner.
* *
* @author sk89q * @author sk89q
* @author Cogito * @author Cogito
*/ */
public interface CreatureSpawner extends BlockState { public interface CreatureSpawner extends BlockState {
/** /**
* Get the spawner's creature type. * Get the spawner's creature type.
* *
* @return * @return
*/ */
public CreatureType getCreatureType(); public CreatureType getCreatureType();
/** /**
* Set the spawner creature type. * Set the spawner creature type.
* *
* @param mobType * @param mobType
*/ */
public void setCreatureType(CreatureType creatureType); public void setCreatureType(CreatureType creatureType);
/** /**
* Get the spawner's creature type. * Get the spawner's creature type.
* *
* @return * @return
*/ */
public String getCreatureTypeId(); public String getCreatureTypeId();
/** /**
* Set the spawner mob type. * Set the spawner mob type.
* *
* @param creatureType * @param creatureType
*/ */
public void setCreatureTypeId(String creatureType); public void setCreatureTypeId(String creatureType);
/** /**
* Get the spawner's delay. * Get the spawner's delay.
* *
* @return * @return
*/ */
public int getDelay(); public int getDelay();
/** /**
* Set the spawner's delay. * Set the spawner's delay.
* *
* @param delay * @param delay
*/ */
public void setDelay(int delay); public void setDelay(int delay);
} }

View file

@ -1,17 +1,17 @@
package org.bukkit.block; package org.bukkit.block;
/** /**
* Represents a dispenser. * Represents a dispenser.
* *
* @author sk89q * @author sk89q
*/ */
public interface Dispenser extends BlockState, ContainerBlock { public interface Dispenser extends BlockState, ContainerBlock {
/** /**
* Attempts to dispense the contents of this block<br /> * Attempts to dispense the contents of this block<br />
* <br /> * <br />
* If the block is no longer a dispenser, this will return false * If the block is no longer a dispenser, this will return false
* *
* @return true if successful, otherwise false * @return true if successful, otherwise false
*/ */
public boolean dispense(); public boolean dispense();
} }

View file

@ -1,36 +1,36 @@
package org.bukkit.block; package org.bukkit.block;
/** /**
* Represents a furnace. * Represents a furnace.
* *
* @author sk89q * @author sk89q
*/ */
public interface Furnace extends BlockState, ContainerBlock { public interface Furnace extends BlockState, ContainerBlock {
/** /**
* Get burn time. * Get burn time.
* *
* @return * @return
*/ */
public short getBurnTime(); public short getBurnTime();
/** /**
* Set burn time. * Set burn time.
* *
* @param burnTime * @param burnTime
*/ */
public void setBurnTime(short burnTime); public void setBurnTime(short burnTime);
/** /**
* Get cook time. * Get cook time.
* *
* @return * @return
*/ */
public short getCookTime(); public short getCookTime();
/** /**
* Set cook time. * Set cook time.
* *
* @param cookTime * @param cookTime
*/ */
public void setCookTime(short cookTime); public void setCookTime(short cookTime);
} }

View file

@ -1,30 +1,30 @@
package org.bukkit.block; package org.bukkit.block;
/** /**
* Represents a note. * Represents a note.
* *
* @author sk89q * @author sk89q
*/ */
public interface NoteBlock extends BlockState { public interface NoteBlock extends BlockState {
/** /**
* Gets the note. * Gets the note.
* *
* @return * @return
*/ */
public byte getNote(); public byte getNote();
/** /**
* Set the note. * Set the note.
* *
* @param note * @param note
*/ */
public void setNote(byte note); public void setNote(byte note);
/** /**
* Attempts to play the note at block<br /> * Attempts to play the note at block<br />
* <br /> * <br />
* If the block is no longer a note block, this will return false * If the block is no longer a note block, this will return false
* *
* @return true if successful, otherwise false * @return true if successful, otherwise false
*/ */
public boolean play(); public boolean play();
} }

View file

@ -1,11 +1,11 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents an Animal. * Represents an Animal.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Animals extends Creature{ public interface Animals extends Creature{
} }

View file

@ -1,9 +1,9 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents an arrow. * Represents an arrow.
* *
* @author sk89q * @author sk89q
*/ */
public interface Arrow extends Entity { public interface Arrow extends Entity {
} }

View file

@ -1,22 +1,22 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a boat entity. * Represents a boat entity.
* *
* @author sk89q * @author sk89q
*/ */
public interface Boat extends Vehicle { public interface Boat extends Vehicle {
/** /**
* Gets the maximum speed of a boat. The speed is unrelated to the velocity. * Gets the maximum speed of a boat. The speed is unrelated to the velocity.
* *
* @param speed * @param speed
*/ */
public double getMaxSpeed(); public double getMaxSpeed();
/** /**
* Sets the maximum speed of a boat. Must be nonnegative. Default is 0.4D. * Sets the maximum speed of a boat. Must be nonnegative. Default is 0.4D.
* *
* @param speed * @param speed
*/ */
public void setMaxSpeed(double speed); public void setMaxSpeed(double speed);
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Chicken. * Represents a Chicken.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Chicken extends Animals { public interface Chicken extends Animals {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Cow. * Represents a Cow.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Cow extends Animals { public interface Cow extends Animals {
} }

View file

@ -1,23 +1,23 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Creature. Creatures are non-intelligent monsters or animals which * Represents a Creature. Creatures are non-intelligent monsters or animals which
* have very simple abilities. * have very simple abilities.
*/ */
public interface Creature extends LivingEntity { public interface Creature extends LivingEntity {
/** /**
* Instructs this Creature to set the specified LivingEntity as its target. * Instructs this Creature to set the specified LivingEntity as its target.
* Hostile creatures may attack their target, and friendly creatures may * Hostile creatures may attack their target, and friendly creatures may
* follow their target. * follow their target.
* *
* @param target New LivingEntity to target, or null to clear the target * @param target New LivingEntity to target, or null to clear the target
*/ */
public void setTarget(LivingEntity target); public void setTarget(LivingEntity target);
/** /**
* Gets the current target of this Creature * Gets the current target of this Creature
* *
* @return Current target of this creature, or null if none exists * @return Current target of this creature, or null if none exists
*/ */
public LivingEntity getTarget(); public LivingEntity getTarget();
} }

View file

@ -1,9 +1,9 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents an egg. * Represents an egg.
* *
* @author sk89q * @author sk89q
*/ */
public interface Egg extends Entity { public interface Egg extends Entity {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents Falling Sand. * Represents Falling Sand.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface FallingSand extends Entity { public interface FallingSand extends Entity {
} }

View file

@ -1,9 +1,9 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Fireball. * Represents a Fireball.
* *
* @author Cogito * @author Cogito
*/ */
public interface Fireball extends Entity { public interface Fireball extends Entity {
} }

View file

@ -1,9 +1,9 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Fish. * Represents a Fish.
* *
* @author Cogito * @author Cogito
*/ */
public interface Fish extends Entity { public interface Fish extends Entity {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Flying Entity. * Represents a Flying Entity.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Flying extends LivingEntity { public interface Flying extends LivingEntity {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Ghast. * Represents a Ghast.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Ghast extends Flying { public interface Ghast extends Flying {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Giant. * Represents a Giant.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Giant extends Monster { public interface Giant extends Monster {
} }

View file

@ -1,26 +1,26 @@
package org.bukkit.entity; package org.bukkit.entity;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
* Represents an Item. * Represents an Item.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Item extends Entity { public interface Item extends Entity {
/** /**
* Gets the item stack associated with this item drop. * Gets the item stack associated with this item drop.
* *
* @return * @return
*/ */
public ItemStack getItemStack(); public ItemStack getItemStack();
/** /**
* Sets the item stack associated with this item drop. * Sets the item stack associated with this item drop.
* *
* @param stack * @param stack
*/ */
public void setItemStack(ItemStack stack); public void setItemStack(ItemStack stack);
} }

View file

@ -1,83 +1,83 @@
package org.bukkit.entity; package org.bukkit.entity;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
/** /**
* Represents a minecart entity. * Represents a minecart entity.
* *
* @author sk89q * @author sk89q
*/ */
public interface Minecart extends Vehicle { public interface Minecart extends Vehicle {
/** /**
* Sets a minecart's damage. * Sets a minecart's damage.
* *
* @param damage over 40 to "kill" a minecart * @param damage over 40 to "kill" a minecart
*/ */
public void setDamage(int damage); public void setDamage(int damage);
/** /**
* Gets a minecart's damage. * Gets a minecart's damage.
* *
* @param damage * @param damage
*/ */
public int getDamage(); public int getDamage();
/** /**
* Gets the maximum speed of a minecart. The speed is unrelated to the velocity. * Gets the maximum speed of a minecart. The speed is unrelated to the velocity.
* *
* @param speed * @param speed
*/ */
public double getMaxSpeed(); public double getMaxSpeed();
/** /**
* Sets the maximum speed of a minecart. Must be nonnegative. Default is 0.4D. * Sets the maximum speed of a minecart. Must be nonnegative. Default is 0.4D.
* *
* @param speed * @param speed
*/ */
public void setMaxSpeed(double speed); public void setMaxSpeed(double speed);
/** /**
* Returns whether this minecart will slow down faster without a passenger occupying it * Returns whether this minecart will slow down faster without a passenger occupying it
* *
*/ */
public boolean isSlowWhenEmpty(); public boolean isSlowWhenEmpty();
/** /**
* Sets whether this minecart will slow down faster without a passenger occupying it * Sets whether this minecart will slow down faster without a passenger occupying it
* *
* @param slow * @param slow
*/ */
public void setSlowWhenEmpty(boolean slow); public void setSlowWhenEmpty(boolean slow);
/** /**
* Gets the flying velocity modifier. Used for minecarts that are in mid-air. * Gets the flying velocity modifier. Used for minecarts that are in mid-air.
* A flying minecart's velocity is multiplied by this factor each tick. * A flying minecart's velocity is multiplied by this factor each tick.
* *
* @param flying velocity modifier * @param flying velocity modifier
*/ */
public Vector getFlyingVelocityMod(); public Vector getFlyingVelocityMod();
/** /**
* Sets the flying velocity modifier. Used for minecarts that are in mid-air. * Sets the flying velocity modifier. Used for minecarts that are in mid-air.
* A flying minecart's velocity is multiplied by this factor each tick. * A flying minecart's velocity is multiplied by this factor each tick.
* *
* @param flying velocity modifier * @param flying velocity modifier
*/ */
public void setFlyingVelocityMod(Vector flying); public void setFlyingVelocityMod(Vector flying);
/** /**
* Gets the derailed velocity modifier. Used for minecarts that are on the ground, but not on rails. * Gets the derailed velocity modifier. Used for minecarts that are on the ground, but not on rails.
* *
* A derailed minecart's velocity is multiplied by this factor each tick. * A derailed minecart's velocity is multiplied by this factor each tick.
* @param visible speed * @param visible speed
*/ */
public Vector getDerailedVelocityMod(); public Vector getDerailedVelocityMod();
/** /**
* Sets the derailed velocity modifier. Used for minecarts that are on the ground, but not on rails. * Sets the derailed velocity modifier. Used for minecarts that are on the ground, but not on rails.
* A derailed minecart's velocity is multiplied by this factor each tick. * A derailed minecart's velocity is multiplied by this factor each tick.
* *
* @param visible speed * @param visible speed
*/ */
public void setDerailedVelocityMod(Vector derailed); public void setDerailedVelocityMod(Vector derailed);
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Monster. * Represents a Monster.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Monster extends Creature { public interface Monster extends Creature {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Painting. * Represents a Painting.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Painting extends Entity { public interface Painting extends Entity {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Pig. * Represents a Pig.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Pig extends Animals { public interface Pig extends Animals {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Pig Zombie. * Represents a Pig Zombie.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface PigZombie extends Zombie { public interface PigZombie extends Zombie {
} }

View file

@ -1,10 +1,10 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a powered minecart. * Represents a powered minecart.
* *
* @author sk89q * @author sk89q
*/ */
public interface PoweredMinecart extends Minecart { public interface PoweredMinecart extends Minecart {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Skeleton. * Represents a Skeleton.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Skeleton extends Monster { public interface Skeleton extends Monster {
} }

View file

@ -1,9 +1,9 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Implements a snowball. * Implements a snowball.
* *
* @author sk89q * @author sk89q
*/ */
public interface Snowball extends Entity { public interface Snowball extends Entity {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Spider. * Represents a Spider.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Spider extends Monster { public interface Spider extends Monster {
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Squid. * Represents a Squid.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Squid extends WaterMob { public interface Squid extends WaterMob {
} }

View file

@ -1,17 +1,17 @@
package org.bukkit.entity; package org.bukkit.entity;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
/** /**
* Represents a storage minecart. * Represents a storage minecart.
* *
* @author sk89q * @author sk89q
*/ */
public interface StorageMinecart extends Minecart { public interface StorageMinecart extends Minecart {
/** /**
* Return the inventory object for this StorageMinecart. * Return the inventory object for this StorageMinecart.
* *
* @return The inventory for this Minecart * @return The inventory for this Minecart
*/ */
public Inventory getInventory(); public Inventory getInventory();
} }

View file

@ -1,14 +1,14 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Primed TNT. * Represents a Primed TNT.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface TNTPrimed extends Entity { public interface TNTPrimed extends Entity {
} }

View file

@ -1,13 +1,13 @@
/** /**
* *
*/ */
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Water Mob * Represents a Water Mob
* @author Cogito * @author Cogito
* *
*/ */
public interface WaterMob extends Creature { public interface WaterMob extends Creature {
} }

View file

@ -1,11 +1,11 @@
package org.bukkit.entity; package org.bukkit.entity;
/** /**
* Represents a Zombie. * Represents a Zombie.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Zombie extends Monster{ public interface Zombie extends Monster{
} }

View file

@ -1,24 +1,24 @@
package org.bukkit.event.block; package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.Event; import org.bukkit.event.Event;
/** /**
* Represents a block related event * Represents a block related event
*/ */
public class BlockEvent extends Event { public class BlockEvent extends Event {
protected Block block; protected Block block;
public BlockEvent(final Event.Type type, final Block theBlock) { public BlockEvent(final Event.Type type, final Block theBlock) {
super(type); super(type);
block = theBlock; block = theBlock;
} }
/** /**
* Returns the block involved in this event * Returns the block involved in this event
* @return Block which block is involved in this event * @return Block which block is involved in this event
*/ */
public final Block getBlock() { public final Block getBlock() {
return block; return block;
} }
} }

View file

@ -1,25 +1,25 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
/** /**
* Represents a player related event * Represents a player related event
*/ */
public class PlayerEvent extends Event { public class PlayerEvent extends Event {
protected Player player; protected Player player;
public PlayerEvent(final Event.Type type, final Player who) { public PlayerEvent(final Event.Type type, final Player who) {
super(type); super(type);
player = who; player = who;
} }
/** /**
* Returns the player involved in this event * Returns the player involved in this event
* @return Player who is involved in this event * @return Player who is involved in this event
*/ */
public final Player getPlayer() { public final Player getPlayer() {
return player; return player;
} }
} }

View file

@ -1,14 +1,14 @@
package org.bukkit.event.vehicle; package org.bukkit.event.vehicle;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
/** /**
* Raised when a vehicle collides. * Raised when a vehicle collides.
* *
* @author sk89q * @author sk89q
*/ */
public class VehicleCollisionEvent extends VehicleEvent { public class VehicleCollisionEvent extends VehicleEvent {
public VehicleCollisionEvent(Type type, Vehicle vehicle) { public VehicleCollisionEvent(Type type, Vehicle vehicle) {
super(type, vehicle); super(type, vehicle);
} }
} }

View file

@ -1,27 +1,27 @@
package org.bukkit.event.vehicle; package org.bukkit.event.vehicle;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.Event; import org.bukkit.event.Event;
/** /**
* Represents a vehicle-related event. * Represents a vehicle-related event.
* *
* @author sk89q * @author sk89q
*/ */
public class VehicleEvent extends Event { public class VehicleEvent extends Event {
protected Vehicle vehicle; protected Vehicle vehicle;
public VehicleEvent(final Event.Type type, final Vehicle vehicle) { public VehicleEvent(final Event.Type type, final Vehicle vehicle) {
super(type); super(type);
this.vehicle = vehicle; this.vehicle = vehicle;
} }
/** /**
* Get the vehicle. * Get the vehicle.
* *
* @return the vehicle * @return the vehicle
*/ */
public final Vehicle getVehicle() { public final Vehicle getVehicle() {
return vehicle; return vehicle;
} }
} }

View file

@ -1,204 +1,204 @@
package org.bukkit.inventory; package org.bukkit.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
/** /**
* Represents a stack of items * Represents a stack of items
*/ */
public class ItemStack { public class ItemStack {
private int type; private int type;
private int amount = 0; private int amount = 0;
private MaterialData data = null; private MaterialData data = null;
private short durability = 0; private short durability = 0;
public ItemStack(final int type) { public ItemStack(final int type) {
this(type, 0); this(type, 0);
} }
public ItemStack(final Material type) { public ItemStack(final Material type) {
this(type, 0); this(type, 0);
} }
public ItemStack(final int type, final int amount) { public ItemStack(final int type, final int amount) {
this(type, amount, (short) 0); this(type, amount, (short) 0);
} }
public ItemStack(final Material type, final int amount) { public ItemStack(final Material type, final int amount) {
this(type.getId(), amount); this(type.getId(), amount);
} }
public ItemStack(final int type, final int amount, final short damage) { public ItemStack(final int type, final int amount, final short damage) {
this(type, amount, damage, null); this(type, amount, damage, null);
} }
public ItemStack(final Material type, final int amount, final short damage) { public ItemStack(final Material type, final int amount, final short damage) {
this(type.getId(), amount, damage); this(type.getId(), amount, damage);
} }
public ItemStack(final int type, final int amount, final short damage, final Byte data) { public ItemStack(final int type, final int amount, final short damage, final Byte data) {
this.type = type; this.type = type;
this.amount = amount; this.amount = amount;
this.durability = damage; this.durability = damage;
if (data != null) { if (data != null) {
createData(data); createData(data);
this.durability = data; this.durability = data;
} }
} }
public ItemStack(final Material type, final int amount, final short damage, final Byte data) { public ItemStack(final Material type, final int amount, final short damage, final Byte data) {
this(type.getId(), amount, damage, data); this(type.getId(), amount, damage, data);
} }
/** /**
* Gets the type of this item * Gets the type of this item
* *
* @return Type of the items in this stack * @return Type of the items in this stack
*/ */
public Material getType() { public Material getType() {
return Material.getMaterial(type); return Material.getMaterial(type);
} }
/** /**
* Sets the type of this item<br /> * Sets the type of this item<br />
* <br /> * <br />
* Note that in doing so you will reset the MaterialData for this stack * Note that in doing so you will reset the MaterialData for this stack
* *
* @param type New type to set the items in this stack to * @param type New type to set the items in this stack to
*/ */
public void setType(Material type) { public void setType(Material type) {
setTypeId(type.getId()); setTypeId(type.getId());
} }
/** /**
* Gets the type id of this item * Gets the type id of this item
* *
* @return Type Id of the items in this stack * @return Type Id of the items in this stack
*/ */
public int getTypeId() { public int getTypeId() {
return type; return type;
} }
/** /**
* Sets the type id of this item<br /> * Sets the type id of this item<br />
* <br /> * <br />
* Note that in doing so you will reset the MaterialData for this stack * Note that in doing so you will reset the MaterialData for this stack
* *
* @param type New type id to set the items in this stack to * @param type New type id to set the items in this stack to
*/ */
public void setTypeId(int type) { public void setTypeId(int type) {
this.type = type; this.type = type;
createData((byte)0); createData((byte)0);
} }
/** /**
* Gets the amount of items in this stack * Gets the amount of items in this stack
* *
* @return Amount of items in this stick * @return Amount of items in this stick
*/ */
public int getAmount() { public int getAmount() {
return amount; return amount;
} }
/** /**
* Sets the amount of items in this stack * Sets the amount of items in this stack
* *
* @param amount New amount of items in this stack * @param amount New amount of items in this stack
*/ */
public void setAmount(int amount) { public void setAmount(int amount) {
this.amount = amount; this.amount = amount;
} }
/** /**
* Gets the MaterialData for this stack of items * Gets the MaterialData for this stack of items
* *
* @return MaterialData for this item * @return MaterialData for this item
*/ */
public MaterialData getData() { public MaterialData getData() {
if (Material.getMaterial(getTypeId()).getData() != null) { if (Material.getMaterial(getTypeId()).getData() != null) {
data = Material.getMaterial(getTypeId()).getNewData((byte)this.durability); data = Material.getMaterial(getTypeId()).getNewData((byte)this.durability);
} }
return data; return data;
} }
/** /**
* Sets the MaterialData for this stack of items * Sets the MaterialData for this stack of items
* *
* @param amount New MaterialData for this item * @param amount New MaterialData for this item
*/ */
public void setData(MaterialData data) { public void setData(MaterialData data) {
Material mat = getType(); Material mat = getType();
if ((mat == null) || (mat.getData() == null)) { if ((mat == null) || (mat.getData() == null)) {
this.data = data; this.data = data;
} else { } else {
if ((data.getClass() == mat.getData()) || (data.getClass() == MaterialData.class)) { if ((data.getClass() == mat.getData()) || (data.getClass() == MaterialData.class)) {
this.data = data; this.data = data;
} else { } else {
throw new IllegalArgumentException("Provided data is not of type " throw new IllegalArgumentException("Provided data is not of type "
+ mat.getData().getName() + ", found " + data.getClass().getName()); + mat.getData().getName() + ", found " + data.getClass().getName());
} }
} }
} }
/** /**
* Sets the durability of this item * Sets the durability of this item
* *
* @param durability Durability of this item * @param durability Durability of this item
*/ */
public void setDurability(final short durability) { public void setDurability(final short durability) {
this.durability = durability; this.durability = durability;
} }
/** /**
* Gets the durability of this item * Gets the durability of this item
* *
* @return Durability of this item * @return Durability of this item
*/ */
public short getDurability() { public short getDurability() {
return durability; return durability;
} }
/** /**
* Get the maximum stacksize for the material hold in this ItemStack * Get the maximum stacksize for the material hold in this ItemStack
* Returns -1 if it has no idea. * Returns -1 if it has no idea.
* *
* @return The maximum you can stack this material to. * @return The maximum you can stack this material to.
*/ */
public int getMaxStackSize() { public int getMaxStackSize() {
return -1; return -1;
} }
private void createData(final byte data) { private void createData(final byte data) {
Material mat = Material.getMaterial(type); Material mat = Material.getMaterial(type);
if (mat == null) { if (mat == null) {
this.data = new MaterialData(type, data); this.data = new MaterialData(type, data);
} else { } else {
this.data = mat.getNewData(data); this.data = mat.getNewData(data);
} }
} }
@Override @Override
public String toString() { public String toString() {
return "ItemStack{"+getType().name()+" x "+getAmount()+"}"; return "ItemStack{"+getType().name()+" x "+getAmount()+"}";
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!(obj instanceof ItemStack)) if (!(obj instanceof ItemStack))
return false; return false;
ItemStack item = (ItemStack)obj; ItemStack item = (ItemStack)obj;
return item.getAmount() == getAmount() && item.getTypeId() == getTypeId(); return item.getAmount() == getAmount() && item.getTypeId() == getTypeId();
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 11; int hash = 11;
hash = hash * 19 + 7 * getTypeId(); // Overriding hashCode since equals is overridden, it's just hash = hash * 19 + 7 * getTypeId(); // Overriding hashCode since equals is overridden, it's just
hash = hash * 7 + 23 * getAmount(); // too bad these are mutable values... Q_Q hash = hash * 7 + 23 * getAmount(); // too bad these are mutable values... Q_Q
return hash; return hash;
} }
} }

View file

@ -1,94 +1,94 @@
package org.bukkit.inventory; package org.bukkit.inventory;
/** /**
* Includes interface to the 4 armor slots * Includes interface to the 4 armor slots
*/ */
public interface PlayerInventory extends Inventory { public interface PlayerInventory extends Inventory {
/** /**
* Get all ItemStacks from the armor slots * Get all ItemStacks from the armor slots
* *
* @return All the ItemStacks from the armor slots * @return All the ItemStacks from the armor slots
*/ */
public ItemStack[] getArmorContents(); public ItemStack[] getArmorContents();
/** /**
* Return the ItemStack from the helmet slot * Return the ItemStack from the helmet slot
* *
* @return The ItemStack in the helmet slot * @return The ItemStack in the helmet slot
*/ */
public ItemStack getHelmet(); public ItemStack getHelmet();
/** /**
* Return the ItemStack from the chestplate slot * Return the ItemStack from the chestplate slot
* *
* @return The ItemStack in the chestplate slot * @return The ItemStack in the chestplate slot
*/ */
public ItemStack getChestplate(); public ItemStack getChestplate();
/** /**
* Return the ItemStack from the leg slot * Return the ItemStack from the leg slot
* *
* @return The ItemStack in the leg slot * @return The ItemStack in the leg slot
*/ */
public ItemStack getLeggings(); public ItemStack getLeggings();
/** /**
* Return the ItemStack from the boots slot * Return the ItemStack from the boots slot
* *
* @return The ItemStack in the boots slot * @return The ItemStack in the boots slot
*/ */
public ItemStack getBoots(); public ItemStack getBoots();
/** /**
* Put the given ItemStack into the helmet slot * Put the given ItemStack into the helmet slot
* This does not check if the ItemStack is a helmet * This does not check if the ItemStack is a helmet
* *
* @param helmet The ItemStack to use as helmet * @param helmet The ItemStack to use as helmet
*/ */
public void setHelmet(ItemStack helmet); public void setHelmet(ItemStack helmet);
/** /**
* Put the given ItemStack into the chestplate slot * Put the given ItemStack into the chestplate slot
* This does not check if the ItemStack is a chestplate * This does not check if the ItemStack is a chestplate
* *
* @param chestplate The ItemStack to use as chestplate * @param chestplate The ItemStack to use as chestplate
*/ */
public void setChestplate(ItemStack chestplate); public void setChestplate(ItemStack chestplate);
/** /**
* Put the given ItemStack into the leg slot * Put the given ItemStack into the leg slot
* This does not check if the ItemStack is a pair of leggings * This does not check if the ItemStack is a pair of leggings
* *
* @param leggings The ItemStack to use as leggings * @param leggings The ItemStack to use as leggings
*/ */
public void setLeggings(ItemStack leggings); public void setLeggings(ItemStack leggings);
/** /**
* Put the given ItemStack into the boots slot * Put the given ItemStack into the boots slot
* This does not check if the ItemStack is a boots * This does not check if the ItemStack is a boots
* *
* @param boots The ItemStack to use as boots * @param boots The ItemStack to use as boots
*/ */
public void setBoots(ItemStack boots); public void setBoots(ItemStack boots);
/** /**
* Returns the ItemStack currently hold * Returns the ItemStack currently hold
* *
* @return The currently held ItemStack * @return The currently held ItemStack
*/ */
public ItemStack getItemInHand(); public ItemStack getItemInHand();
/** /**
* Sets the item in hand * Sets the item in hand
* *
* @param stack Stack to set * @param stack Stack to set
*/ */
public void setItemInHand(ItemStack stack); public void setItemInHand(ItemStack stack);
/** /**
* Get the slot number of the currently held item * Get the slot number of the currently held item
* *
* @return Held item slot number * @return Held item slot number
*/ */
public int getHeldItemSlot(); public int getHeldItemSlot();
} }

View file

@ -1,27 +1,27 @@
package org.bukkit.material; package org.bukkit.material;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
/** /**
* An object that can be colored. * An object that can be colored.
* *
* @author Cogito * @author Cogito
* *
*/ */
public interface Colorable { public interface Colorable {
/** /**
* Gets the color of this object. * Gets the color of this object.
* *
* @return The DyeColor of this object. * @return The DyeColor of this object.
*/ */
public DyeColor getColor(); public DyeColor getColor();
/** /**
* Sets the color of this object to the specified DyeColor. * Sets the color of this object to the specified DyeColor.
* *
* @param color The color of the object, as a DyeColor. * @param color The color of the object, as a DyeColor.
*/ */
public void setColor(DyeColor color); public void setColor(DyeColor color);
} }

View file

@ -1,62 +1,62 @@
package org.bukkit.plugin; package org.bukkit.plugin;
/** /**
* Thrown when attempting to load an invalid PluginDescriptionFile * Thrown when attempting to load an invalid PluginDescriptionFile
*/ */
public class InvalidDescriptionException extends Exception { public class InvalidDescriptionException extends Exception {
private static final long serialVersionUID = 5721389122281775894L; private static final long serialVersionUID = 5721389122281775894L;
private final Throwable cause; private final Throwable cause;
private final String message; private final String message;
/** /**
* Constructs a new InvalidDescriptionException based on the given Exception * Constructs a new InvalidDescriptionException based on the given Exception
* *
* @param throwable Exception that triggered this Exception * @param throwable Exception that triggered this Exception
*/ */
public InvalidDescriptionException(Throwable throwable) { public InvalidDescriptionException(Throwable throwable) {
this(throwable, "Invalid plugin.yml"); this(throwable, "Invalid plugin.yml");
} }
/** /**
* Constructs a new InvalidDescriptionException with the given message * Constructs a new InvalidDescriptionException with the given message
* *
* @param message Brief message explaining the cause of the exception * @param message Brief message explaining the cause of the exception
*/ */
public InvalidDescriptionException(final String message) { public InvalidDescriptionException(final String message) {
this(null, message); this(null, message);
} }
/** /**
* Constructs a new InvalidDescriptionException based on the given Exception * Constructs a new InvalidDescriptionException based on the given Exception
* *
* @param message Brief message explaining the cause of the exception * @param message Brief message explaining the cause of the exception
* @param throwable Exception that triggered this Exception * @param throwable Exception that triggered this Exception
*/ */
public InvalidDescriptionException(final Throwable throwable, final String message) { public InvalidDescriptionException(final Throwable throwable, final String message) {
this.cause = null; this.cause = null;
this.message = message; this.message = message;
} }
/** /**
* Constructs a new InvalidDescriptionException * Constructs a new InvalidDescriptionException
*/ */
public InvalidDescriptionException() { public InvalidDescriptionException() {
this(null, "Invalid plugin.yml"); this(null, "Invalid plugin.yml");
} }
/** /**
* If applicable, returns the Exception that triggered this Exception * If applicable, returns the Exception that triggered this Exception
* *
* @return Inner exception, or null if one does not exist * @return Inner exception, or null if one does not exist
*/ */
@Override @Override
public Throwable getCause() { public Throwable getCause() {
return cause; return cause;
} }
@Override @Override
public String getMessage() { public String getMessage() {
return message; return message;
} }
} }

View file

@ -1,111 +1,111 @@
package org.bukkit.util; package org.bukkit.util;
/** /**
* A vector with a hash function that floors the X, Y, Z components, a la * A vector with a hash function that floors the X, Y, Z components, a la
* BlockVector in WorldEdit. BlockVectors can be used in hash sets and * BlockVector in WorldEdit. BlockVectors can be used in hash sets and
* hash maps. Be aware that BlockVectors are mutable, but it is important * hash maps. Be aware that BlockVectors are mutable, but it is important
* that BlockVectors are never changed once put into a hash set or hash map. * that BlockVectors are never changed once put into a hash set or hash map.
* *
* @author sk89q * @author sk89q
*/ */
public class BlockVector extends Vector { public class BlockVector extends Vector {
/** /**
* Construct the vector with all components as 0. * Construct the vector with all components as 0.
*/ */
public BlockVector() { public BlockVector() {
this.x = 0; this.x = 0;
this.y = 0; this.y = 0;
this.z = 0; this.z = 0;
} }
/** /**
* Construct the vector with another vector. * Construct the vector with another vector.
*/ */
public BlockVector(Vector vec) { public BlockVector(Vector vec) {
this.x = vec.getX(); this.x = vec.getX();
this.y = vec.getY(); this.y = vec.getY();
this.z = vec.getZ(); this.z = vec.getZ();
} }
/** /**
* Construct the vector with provided integer components. * Construct the vector with provided integer components.
* *
* @param x * @param x
* @param y * @param y
* @param z * @param z
*/ */
public BlockVector(int x, int y, int z) { public BlockVector(int x, int y, int z) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
} }
/** /**
* Construct the vector with provided double components. * Construct the vector with provided double components.
* *
* @param x * @param x
* @param y * @param y
* @param z * @param z
*/ */
public BlockVector(double x, double y, double z) { public BlockVector(double x, double y, double z) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
} }
/** /**
* Construct the vector with provided float components. * Construct the vector with provided float components.
* *
* @param x * @param x
* @param y * @param y
* @param z * @param z
*/ */
public BlockVector(float x, float y, float z) { public BlockVector(float x, float y, float z) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
} }
/** /**
* Checks if another object is equivalent. * Checks if another object is equivalent.
* *
* @param obj * @param obj
* @return whether the other object is equivalent * @return whether the other object is equivalent
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!(obj instanceof BlockVector)) { if (!(obj instanceof BlockVector)) {
return false; return false;
} }
BlockVector other = (BlockVector)obj; BlockVector other = (BlockVector)obj;
return (int)other.getX() == (int)this.x && (int)other.getY() == (int)this.y return (int)other.getX() == (int)this.x && (int)other.getY() == (int)this.y
&& (int)other.getZ() == (int)this.z; && (int)other.getZ() == (int)this.z;
} }
/** /**
* Returns a hash code for this vector. * Returns a hash code for this vector.
* *
* @return hash code * @return hash code
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
return (Integer.valueOf((int)x).hashCode() >> 13) ^ return (Integer.valueOf((int)x).hashCode() >> 13) ^
(Integer.valueOf((int)y).hashCode() >> 7) ^ (Integer.valueOf((int)y).hashCode() >> 7) ^
Integer.valueOf((int)z).hashCode(); Integer.valueOf((int)z).hashCode();
} }
/** /**
* Get a new block vector. * Get a new block vector.
* *
* @return vector * @return vector
*/ */
@Override @Override
public BlockVector clone() { public BlockVector clone() {
BlockVector v = (BlockVector)super.clone(); BlockVector v = (BlockVector)super.clone();
v.x = x; v.x = x;
v.y = y; v.y = y;
v.z = z; v.z = z;
return v; return v;
} }
} }

View file

@ -1,18 +1,18 @@
package org.bukkit.util.config; package org.bukkit.util.config;
/** /**
* Configuration exception. * Configuration exception.
* *
* @author sk89q * @author sk89q
*/ */
public class ConfigurationException extends Exception { public class ConfigurationException extends Exception {
private static final long serialVersionUID = -2442886939908724203L; private static final long serialVersionUID = -2442886939908724203L;
public ConfigurationException() { public ConfigurationException() {
super(); super();
} }
public ConfigurationException(String msg) { public ConfigurationException(String msg) {
super(msg); super(msg);
} }
} }