Update documentation

This commit is contained in:
filoghost 2014-12-23 11:36:47 +01:00
parent cc7a7c974e
commit cf2db447b8
8 changed files with 71 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public interface Hologram {
public HologramLine getLine(int index);
/**
* Removes a line at a given index.
* Removes a line at a given index. Since: v2.0.1
*
* @param index the index of the line, that should be between 0 and size() - 1.
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())

View File

@ -3,12 +3,22 @@ package com.gmail.filoghost.holographicdisplays.api.line;
import com.gmail.filoghost.holographicdisplays.api.handler.PickupHandler;
/**
* A piece of hologram that can be picked up.
* A line of a Hologram that can be picked up.
*/
public interface CollectableLine extends HologramLine {
/**
* Sets the PickupHandler for this line.
*
* @param pickupHandler the new PickupHandler, can be null.
*/
public void setPickupHandler(PickupHandler pickupHandler);
/**
* Returns the current PickupHandler of this line.
*
* @return the current PickupHandler, can be null.
*/
public PickupHandler getPickupHandler();
}

View File

@ -2,8 +2,21 @@ package com.gmail.filoghost.holographicdisplays.api.line;
import com.gmail.filoghost.holographicdisplays.api.Hologram;
/**
* Interface to represent a line in a Hologram.
*/
public interface HologramLine {
/**
* Returns the parent Hologram of this line.
*
* @return the parent Hologram.
*/
public Hologram getParent();
/**
* Removes this line from the parent Hologram. Since: v2.0.1
*/
public void removeLine();
}

View File

@ -4,8 +4,18 @@ import org.bukkit.inventory.ItemStack;
public interface ItemLine extends CollectableLine, TouchableLine {
/**
* Returns the ItemStack of this ItemLine.
*
* @return the ItemStack if this ItemLine.
*/
public ItemStack getItemStack();
/**
* Sets the ItemStack for this ItemLine.
*
* @param itemStack the new item, should not be null.
*/
public void setItemStack(ItemStack itemStack);
}

View File

@ -2,8 +2,18 @@ package com.gmail.filoghost.holographicdisplays.api.line;
public interface TextLine extends TouchableLine {
/**
* Returns the current text of this TextLine.
*
* @return the current text of this line.
*/
public String getText();
/**
* Sets the text of this TextLine.
*
* @param text the new text of this line.
*/
public void setText(String text);
}

View File

@ -3,12 +3,22 @@ package com.gmail.filoghost.holographicdisplays.api.line;
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
/**
* A piece of hologram that can be touched.
* A line of a Hologram that can be touched (right click).
*/
public interface TouchableLine extends HologramLine {
/**
* Sets the TouchHandler for this line.
*
* @param touchHandler the new TouchHandler, can be null.
*/
public void setTouchHandler(TouchHandler touchHandler);
/**
* Returns the current TouchHandler of this line.
*
* @return the current TouchHandler, can be null.
*/
public TouchHandler getTouchHandler();
}

View File

@ -161,6 +161,14 @@ public class CraftHologram implements Hologram, com.gmail.filoghost.holograms.ap
refreshSingleLines();
}
public void removeLine(CraftHologramLine line) {
Validator.isTrue(!deleted, "hologram already deleted");
lines.remove(line);
line.despawn();
refreshSingleLines();
}
@Override
public void clearLines() {
for (CraftHologramLine line : lines) {

View File

@ -14,7 +14,8 @@ public abstract class CraftHologramLine implements HologramLine {
// This field is necessary for teleport.
private boolean isSpawned;
protected CraftHologramLine(double height, CraftHologram parent) {
protected CraftHologramLine(double height, CraftHologram parent) {
Validator.notNull(parent, "parent hologram");
this.height = height;
this.parent = parent;
}
@ -27,6 +28,10 @@ public abstract class CraftHologramLine implements HologramLine {
public final CraftHologram getParent() {
return parent;
}
public void removeLine() {
parent.removeLine(this);
}
public void spawn(World world, double x, double y, double z) {
Validator.notNull(world, "world");