mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 21:37:39 +01:00
Merge branch 'master' of https://github.com/Bukkit/Bukkit
Conflicts: src/main/java/org/bukkit/Player.java By: Tahg <tahgtahv@gmail.com>
This commit is contained in:
commit
0e16bbed64
20
paper-api/src/main/java/org/bukkit/Biome.java
Normal file
20
paper-api/src/main/java/org/bukkit/Biome.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
package org.bukkit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds all accepted Biomes in the default server
|
||||||
|
*/
|
||||||
|
public enum Biome {
|
||||||
|
RAINFOREST,
|
||||||
|
SWAMPLAND,
|
||||||
|
SEASONAL_FOREST,
|
||||||
|
FOREST,
|
||||||
|
SAVANNA,
|
||||||
|
SHRUBLAND,
|
||||||
|
TAIGA,
|
||||||
|
DESERT,
|
||||||
|
PLAINS,
|
||||||
|
ICE_DESERT,
|
||||||
|
TUNDRA,
|
||||||
|
HELL
|
||||||
|
}
|
@ -1,7 +1,12 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a block
|
* Represents a block. This is a live object, and only one Block may exist for
|
||||||
|
* any given location in a world. The state of the block may change concurrently
|
||||||
|
* to your own handling of it; use block.getState() to get a snapshot state of a
|
||||||
|
* block which will not be modified.
|
||||||
*/
|
*/
|
||||||
public interface Block {
|
public interface Block {
|
||||||
/**
|
/**
|
||||||
@ -12,13 +17,33 @@ public interface Block {
|
|||||||
byte getData();
|
byte getData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block at the given face
|
* Gets the block at the given face<br />
|
||||||
|
* <br />
|
||||||
|
* This method is equal to getFace(face, 1)
|
||||||
*
|
*
|
||||||
* @param face Face of this block to return
|
* @param face Face of this block to return
|
||||||
* @return Block at the given face
|
* @return Block at the given face
|
||||||
|
* @see Block.getFace(BlockFace face, int distance);
|
||||||
*/
|
*/
|
||||||
Block getFace(BlockFace face);
|
Block getFace(BlockFace face);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the block at the given distance of the given face<br />
|
||||||
|
* <br />
|
||||||
|
* For example, the following method places water at 100,102,100; two blocks
|
||||||
|
* above 100,100,100.
|
||||||
|
* <pre>
|
||||||
|
* Block block = world.getBlockAt(100,100,100);
|
||||||
|
* Block shower = block.getFace(BlockFace.Up, 2);
|
||||||
|
* shower.setType(Material.WATER);
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param face Face of this block to return
|
||||||
|
* @param distance Distance to get the block at
|
||||||
|
* @return Block at the given face
|
||||||
|
*/
|
||||||
|
Block getFace(BlockFace face, int distance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block at the given offsets
|
* Gets the block at the given offsets
|
||||||
*
|
*
|
||||||
@ -103,6 +128,43 @@ public interface Block {
|
|||||||
* Sets the type-ID of this block
|
* Sets the type-ID of this block
|
||||||
*
|
*
|
||||||
* @param type Type-ID to change this block to
|
* @param type Type-ID to change this block to
|
||||||
|
* @return whether the block was changed
|
||||||
*/
|
*/
|
||||||
void setTypeID(int type);
|
boolean setTypeID(int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the face relation of this block compared to the given block<br />
|
||||||
|
* <br />
|
||||||
|
* For example:
|
||||||
|
* <pre>
|
||||||
|
* Block current = world.getBlockAt(100, 100, 100);
|
||||||
|
* Block target = world.getBlockAt(100, 101, 100);
|
||||||
|
*
|
||||||
|
* current.getFace(target) == BlockFace.Up;
|
||||||
|
* </pre>
|
||||||
|
* <br />
|
||||||
|
* If the given block is not connected to this block, null may be returned
|
||||||
|
*
|
||||||
|
* @param block Block to compare against this block
|
||||||
|
* @return BlockFace of this block which has the requested block, or null
|
||||||
|
*/
|
||||||
|
BlockFace getFace(Block block);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Captures the current state of this block. You may then cast that state
|
||||||
|
* into any accepted type, such as Furnace or Sign.
|
||||||
|
*
|
||||||
|
* The returned object will never be updated, and you are not guaranteed that
|
||||||
|
* (for example) a sign is still a sign after you capture its state.
|
||||||
|
*
|
||||||
|
* @return BlockState with the current state of this block.
|
||||||
|
*/
|
||||||
|
BlockState getState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the biome that this block resides in
|
||||||
|
*
|
||||||
|
* @return Biome type containing this block
|
||||||
|
*/
|
||||||
|
Biome getBiome();
|
||||||
}
|
}
|
||||||
|
15
paper-api/src/main/java/org/bukkit/BlockDamageLevel.java
Normal file
15
paper-api/src/main/java/org/bukkit/BlockDamageLevel.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package org.bukkit;
|
||||||
|
|
||||||
|
public enum BlockDamageLevel {
|
||||||
|
STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
|
||||||
|
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
private BlockDamageLevel(final int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,10 @@ public enum BlockFace {
|
|||||||
West(0, 0, 1),
|
West(0, 0, 1),
|
||||||
Up(0, 1, 0),
|
Up(0, 1, 0),
|
||||||
Down(0, -1, 0),
|
Down(0, -1, 0),
|
||||||
|
NorthEast(North, East),
|
||||||
|
NorthWest(North, West),
|
||||||
|
SouthEast(South, East),
|
||||||
|
SouthWest(South, West),
|
||||||
Self(0, 0, 0);
|
Self(0, 0, 0);
|
||||||
|
|
||||||
private final int modX;
|
private final int modX;
|
||||||
@ -22,6 +26,12 @@ public enum BlockFace {
|
|||||||
this.modZ = modZ;
|
this.modZ = modZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BlockFace(final BlockFace face1, final BlockFace face2) {
|
||||||
|
this.modX = face1.getModX() + face2.getModX();
|
||||||
|
this.modY = face1.getModY() + face2.getModY();
|
||||||
|
this.modZ = face1.getModZ() + face2.getModZ();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of X-coordinates to modify to get the represented block
|
* Get the amount of X-coordinates to modify to get the represented block
|
||||||
* @return Amount of X-coordinates to modify
|
* @return Amount of X-coordinates to modify
|
||||||
|
9
paper-api/src/main/java/org/bukkit/Boat.java
Normal file
9
paper-api/src/main/java/org/bukkit/Boat.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package org.bukkit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a boat entity.
|
||||||
|
*
|
||||||
|
* @author sk89q
|
||||||
|
*/
|
||||||
|
public interface Boat extends Vehicle {
|
||||||
|
}
|
@ -21,11 +21,18 @@ public interface Entity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Teleports this entity to the given location
|
* Teleports this entity to the given location
|
||||||
*
|
*
|
||||||
* @param location New location to teleport this entity to
|
* @param location New location to teleport this entity to
|
||||||
*/
|
*/
|
||||||
public void teleportTo(Location location);
|
public void teleportTo(Location location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teleports this entity to the target Entity
|
||||||
|
*
|
||||||
|
* @param destination Entity to teleport this entity to
|
||||||
|
*/
|
||||||
|
public void teleportTo(Entity destination);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a unique ID for this entity
|
* Returns a unique ID for this entity
|
||||||
*
|
*
|
||||||
|
@ -13,10 +13,34 @@ public interface HumanEntity extends LivingEntity {
|
|||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the item this entity has currently selected, which will be shown in
|
* Get the player's inventory.
|
||||||
* their hand
|
|
||||||
*
|
*
|
||||||
* @return ItemStack containing details on the item this entity has selected
|
* @return The inventory of the player, this also contains the armor slots.
|
||||||
*/
|
*/
|
||||||
public ItemStack getSelectedItem();
|
public PlayerInventory getInventory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ItemStack currently in your hand, can be empty.
|
||||||
|
*
|
||||||
|
* @return The ItemStack of the item you are currently holding.
|
||||||
|
*/
|
||||||
|
public ItemStack getItemInHand();
|
||||||
|
|
||||||
|
|
||||||
|
/** TODO: This probably won't work ;(
|
||||||
|
* Sets the item to the given ItemStack, this will replace whatever the
|
||||||
|
* user was holding.
|
||||||
|
*
|
||||||
|
* @param item The ItemStack which will end up in the hand
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
public void setItemInHand( ItemStack item );
|
||||||
|
|
||||||
|
**
|
||||||
|
* Changes the item in hand to another of your 'action slots'.
|
||||||
|
*
|
||||||
|
* @param index The new index to use, only valid ones are 0-8.
|
||||||
|
*
|
||||||
|
public void selectItemInHand( int index );
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to the various inventories
|
* Interface to the various inventories
|
||||||
@ -20,21 +20,6 @@ public interface Inventory {
|
|||||||
*/
|
*/
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Set the name of the inventory
|
|
||||||
*
|
|
||||||
* @param name The new name of the inventory
|
|
||||||
public void setName(String name);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** TODO: Appears minecraft has different ideas for slots!
|
|
||||||
* Get the slot at a specific index of an inventory
|
|
||||||
*
|
|
||||||
* @param index The index of the slot to get
|
|
||||||
* @return The Slot found at the index
|
|
||||||
public Slot getSlot(int index);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ItemStack found in the slot at the given index
|
* Get the ItemStack found in the slot at the given index
|
||||||
*
|
*
|
||||||
@ -43,23 +28,108 @@ public interface Inventory {
|
|||||||
*/
|
*/
|
||||||
public ItemStack getItem(int index);
|
public ItemStack getItem(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the ItemStack at the given index
|
||||||
|
*
|
||||||
|
* @param index The index where to put the ItemStack
|
||||||
|
* @param item The ItemStack to set
|
||||||
|
*/
|
||||||
|
public void setItem(int index, ItemStack item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the given ItemStacks in the inventory
|
||||||
|
*
|
||||||
|
* @param items The ItemStacks to add
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HashMap<Integer, ItemStack> addItem(ItemStack... items);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all ItemStacks from the inventory
|
* Get all ItemStacks from the inventory
|
||||||
*
|
*
|
||||||
* @return All the ItemStacks from all slots
|
* @return All the ItemStacks from all slots
|
||||||
*/
|
*/
|
||||||
public Collection<ItemStack> getContents();
|
public ItemStack[] getContents();
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* TODO public boolean contains(int materialId); public boolean
|
* Check if the inventory contains any ItemStacks with the given materialId
|
||||||
* contains(Material material); public boolean contains(ItemStack item);
|
|
||||||
*
|
*
|
||||||
* public Collection<Slot> all(int materialId); public Collection<Slot>
|
* @param materialId The materialId to check for
|
||||||
* all(Material material); public Collection<Slot> all(ItemStack item);
|
* @return If any ItemStacks were found
|
||||||
*
|
|
||||||
* public Slot first(int materialId); public Slot first(Material material);
|
|
||||||
* public Slot first(ItemStack item);
|
|
||||||
*
|
|
||||||
* public int firstEmptyIndex();
|
|
||||||
*/
|
*/
|
||||||
|
public boolean contains(int materialId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the inventory contains any ItemStacks with the given material
|
||||||
|
*
|
||||||
|
* @param material The material to check for
|
||||||
|
* @return If any ItemStacks were found
|
||||||
|
*/
|
||||||
|
public boolean contains(Material material);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the inventory contains any ItemStacks matching the given ItemStack
|
||||||
|
* This will only match if both the type and the amount of the stack match
|
||||||
|
*
|
||||||
|
* @param item The ItemStack to match against
|
||||||
|
* @return If any matching ItemStacks were found
|
||||||
|
*/
|
||||||
|
public boolean contains(ItemStack item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all slots in the inventory containing any ItemStacks with the given materialId
|
||||||
|
*
|
||||||
|
* @param materialId The materialId to look for
|
||||||
|
* @return The Slots found.
|
||||||
|
*/
|
||||||
|
public HashMap<Integer,ItemStack> all(int materialId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all slots in the inventory containing any ItemStacks with the given material
|
||||||
|
*
|
||||||
|
* @param materialId The material to look for
|
||||||
|
* @return The Slots found.
|
||||||
|
*/
|
||||||
|
public HashMap<Integer,ItemStack> all(Material material);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all slots in the inventory containing any ItemStacks with the given ItemStack
|
||||||
|
* This will only match slots if both the type and the amount of the stack match
|
||||||
|
*
|
||||||
|
* @param item The ItemStack to match against
|
||||||
|
* @return The Slots found.
|
||||||
|
*/
|
||||||
|
public HashMap<Integer,ItemStack> all(ItemStack item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the first slot in the inventory containing an ItemStack with the given materialId
|
||||||
|
*
|
||||||
|
* @param materialId The materialId to look for
|
||||||
|
* @return The Slot found.
|
||||||
|
*/
|
||||||
|
public int first(int materialId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the first slot in the inventory containing an ItemStack with the given material
|
||||||
|
*
|
||||||
|
* @param materialId The material to look for
|
||||||
|
* @return The Slot found.
|
||||||
|
*/
|
||||||
|
public int first(Material material);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the first slot in the inventory containing an ItemStack with the given stack
|
||||||
|
* This will only match a slot if both the type and the amount of the stack match
|
||||||
|
*
|
||||||
|
* @param item The ItemStack to match against
|
||||||
|
* @return The Slot found.
|
||||||
|
*/
|
||||||
|
public int first(ItemStack item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the first empty Slot.
|
||||||
|
*
|
||||||
|
* @return The first empty Slot found.
|
||||||
|
*/
|
||||||
|
public int firstEmpty();
|
||||||
}
|
}
|
15
paper-api/src/main/java/org/bukkit/ItemDrop.java
Normal file
15
paper-api/src/main/java/org/bukkit/ItemDrop.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package org.bukkit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dropped item.
|
||||||
|
*
|
||||||
|
* @author sk89q
|
||||||
|
*/
|
||||||
|
public interface ItemDrop extends Entity {
|
||||||
|
/**
|
||||||
|
* Gets the item stack.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ItemStack getItemStack();
|
||||||
|
}
|
@ -115,4 +115,28 @@ public class ItemStack {
|
|||||||
public byte getDamage() {
|
public byte getDamage() {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the maximum stacksize for the material hold in this ItemStack
|
||||||
|
* Returns -1 if it has no idea.
|
||||||
|
*
|
||||||
|
* @return The maximum you can stack this material to.
|
||||||
|
*/
|
||||||
|
public int getMaxStackSize() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ItemStack{"+getType().name()+" x "+getAmount()+"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(ItemStack item) {
|
||||||
|
return item.getAmount() == getAmount() && item.getTypeID() == getTypeID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,4 +28,35 @@ public interface LivingEntity extends Entity {
|
|||||||
* Throws a snowball from the entity.
|
* Throws a snowball from the entity.
|
||||||
*/
|
*/
|
||||||
public Snowball throwSnowball();
|
public Snowball throwSnowball();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shoots an arrow from the entity.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Arrow shootArrow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this entity is inside a vehicle.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isInsideVehicle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leave the current vehicle. If the entity is currently in a vehicle
|
||||||
|
* (and is removed from it), true will be returned, otherwise false will
|
||||||
|
* be returned.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean leaveVehicle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the vehicle that this player is inside. If there is no vehicle,
|
||||||
|
* null will be returned.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vehicle getVehicle();
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ public class Location implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Location clone() {
|
public Location clone() {
|
||||||
return new Location(world, x, y, z, yaw, pitch);
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,10 @@ public enum Material {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBlock() {
|
||||||
|
return id < 256;
|
||||||
|
}
|
||||||
|
|
||||||
public static Material getMaterial(final int id) {
|
public static Material getMaterial(final int id) {
|
||||||
return lookupId.get(id);
|
return lookupId.get(id);
|
||||||
}
|
}
|
||||||
@ -201,7 +205,7 @@ public enum Material {
|
|||||||
public static Material getMaterial(final String name) {
|
public static Material getMaterial(final String name) {
|
||||||
return lookupName.get(name);
|
return lookupName.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (Material material : values()) {
|
for (Material material : values()) {
|
||||||
lookupId.put(material.getID(), material);
|
lookupId.put(material.getID(), material);
|
||||||
|
@ -21,6 +21,26 @@ public interface Player extends HumanEntity {
|
|||||||
* @param message Message to be displayed
|
* @param message Message to be displayed
|
||||||
*/
|
*/
|
||||||
public void sendMessage(String message);
|
public void sendMessage(String message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the "friendly" name to display of this player. This may include color.
|
||||||
|
*
|
||||||
|
* Note that this name will not be displayed in game, only in chat and places
|
||||||
|
* defined by plugins
|
||||||
|
*
|
||||||
|
* @return String containing a color formatted name to display for this player
|
||||||
|
*/
|
||||||
|
public String getDisplayName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the "friendly" name to display of this player. This may include color.
|
||||||
|
*
|
||||||
|
* Note that this name will not be displayed in game, only in chat and places
|
||||||
|
* defined by plugins
|
||||||
|
*
|
||||||
|
* @return String containing a color formatted name to display for this player
|
||||||
|
*/
|
||||||
|
public void setDisplayName(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the socket address of this player
|
* Gets the socket address of this player
|
||||||
|
80
paper-api/src/main/java/org/bukkit/PlayerInventory.java
Normal file
80
paper-api/src/main/java/org/bukkit/PlayerInventory.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package org.bukkit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Includes interface to the 4 armor slots
|
||||||
|
*/
|
||||||
|
public interface PlayerInventory extends Inventory {
|
||||||
|
/**
|
||||||
|
* Get all ItemStacks from the armor slots
|
||||||
|
*
|
||||||
|
* @return All the ItemStacks from the armor slots
|
||||||
|
*/
|
||||||
|
public ItemStack[] getArmorContents();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ItemStack from the helmet slot
|
||||||
|
*
|
||||||
|
* @return The ItemStack in the helmet slot
|
||||||
|
*/
|
||||||
|
public ItemStack getHelmet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ItemStack from the chestplate slot
|
||||||
|
*
|
||||||
|
* @return The ItemStack in the chestplate slot
|
||||||
|
*/
|
||||||
|
public ItemStack getChestplate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ItemStack from the leg slot
|
||||||
|
*
|
||||||
|
* @return The ItemStack in the leg slot
|
||||||
|
*/
|
||||||
|
public ItemStack getLeggings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ItemStack from the boots slot
|
||||||
|
*
|
||||||
|
* @return The ItemStack in the boots slot
|
||||||
|
*/
|
||||||
|
public ItemStack getBoots();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put the given ItemStack into the helmet slot
|
||||||
|
* This does not check if the ItemStack is a helmet
|
||||||
|
*
|
||||||
|
* @param helmet The ItemStack to use as helmet
|
||||||
|
*/
|
||||||
|
public void setHelmet(ItemStack helmet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put the given ItemStack into the chestplate slot
|
||||||
|
* This does not check if the ItemStack is a chestplate
|
||||||
|
*
|
||||||
|
* @param chestplate The ItemStack to use as chestplate
|
||||||
|
*/
|
||||||
|
public void setChestplate(ItemStack chestplate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put the given ItemStack into the leg slot
|
||||||
|
* This does not check if the ItemStack is a pair of leggings
|
||||||
|
*
|
||||||
|
* @param leggings The ItemStack to use as leggings
|
||||||
|
*/
|
||||||
|
public void setLeggings(ItemStack leggings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put the given ItemStack into the boots slot
|
||||||
|
* This does not check if the ItemStack is a boots
|
||||||
|
*
|
||||||
|
* @param boots The ItemStack to use as boots
|
||||||
|
*/
|
||||||
|
public void setBoots(ItemStack boots);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ItemStack currently hold
|
||||||
|
*
|
||||||
|
* @return The currently holded ItemStack
|
||||||
|
*/
|
||||||
|
public ItemStack getItemInHand();
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +39,18 @@ public interface Server {
|
|||||||
*/
|
*/
|
||||||
public Player getPlayer(String name);
|
public Player getPlayer(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to match any players with the given name, and returns a list
|
||||||
|
* of all possibly matches
|
||||||
|
*
|
||||||
|
* This list is not sorted in any particular order. If an exact match is found,
|
||||||
|
* the returned list will only contain a single result.
|
||||||
|
*
|
||||||
|
* @param name Name to match
|
||||||
|
* @return List of all possible players
|
||||||
|
*/
|
||||||
|
public List<Player> matchPlayer(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the PluginManager for interfacing with plugins
|
* Gets the PluginManager for interfacing with plugins
|
||||||
*
|
*
|
||||||
|
@ -3,39 +3,25 @@ package org.bukkit;
|
|||||||
/**
|
/**
|
||||||
* Represents a slot in an inventory
|
* Represents a slot in an inventory
|
||||||
*/
|
*/
|
||||||
public class Slot {
|
public interface Slot {
|
||||||
private Inventory inventory;
|
|
||||||
private int index;
|
|
||||||
|
|
||||||
public Slot(Inventory inventory, int index) {
|
|
||||||
this.inventory = inventory;
|
|
||||||
this.index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the inventory this slot belongs to
|
* Gets the inventory this slot belongs to
|
||||||
*
|
*
|
||||||
* @return The inventory
|
* @return The inventory
|
||||||
*/
|
*/
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory();
|
||||||
return inventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the index this slot belongs to
|
* Get the index this slot belongs to
|
||||||
*
|
*
|
||||||
* @return Index of the slot
|
* @return Index of the slot
|
||||||
*/
|
*/
|
||||||
public int getIndex() {
|
public int getIndex();
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item from the slot.
|
* Get the item from the slot.
|
||||||
*
|
*
|
||||||
* @return ItemStack in the slot.
|
* @return ItemStack in the slot.
|
||||||
*/
|
*/
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem();
|
||||||
return inventory.getItem(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,11 @@ package org.bukkit;
|
|||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public interface StorageMinecart extends Minecart, Inventory {
|
public interface StorageMinecart extends Minecart {
|
||||||
|
/**
|
||||||
|
* Return the inventory object for this StorageMinecart.
|
||||||
|
*
|
||||||
|
* @return The inventory for this Minecart
|
||||||
|
*/
|
||||||
|
public Inventory getInventory();
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,17 @@ public interface Vehicle extends Entity {
|
|||||||
* Gets the primary passenger of a vehicle. For vehicles that could have
|
* Gets the primary passenger of a vehicle. For vehicles that could have
|
||||||
* multiple passengers, this will only return the primary passenger.
|
* multiple passengers, this will only return the primary passenger.
|
||||||
*
|
*
|
||||||
* @return a living entity
|
* @return an entity
|
||||||
*/
|
*/
|
||||||
public LivingEntity getPassenger();
|
public Entity getPassenger();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the passenger of a vehicle.
|
||||||
|
*
|
||||||
|
* @param passenger
|
||||||
|
* @return false if it could not be done for whatever reason
|
||||||
|
*/
|
||||||
|
public boolean setPassenger(Entity passenger);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the vehicle has no passengers.
|
* Returns true if the vehicle has no passengers.
|
||||||
@ -34,4 +42,11 @@ public interface Vehicle extends Entity {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isEmpty();
|
public boolean isEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eject any passenger. True if there was a passenger.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean eject();
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,24 @@ public interface World {
|
|||||||
*/
|
*/
|
||||||
public boolean isChunkLoaded(Chunk chunk);
|
public boolean isChunkLoaded(Chunk chunk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop an item exactly at the specified location.
|
||||||
|
*
|
||||||
|
* @param loc
|
||||||
|
* @param item
|
||||||
|
* @return dropped item entity
|
||||||
|
*/
|
||||||
|
public ItemDrop dropItem(Location loc, ItemStack item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop an item as if it was mined (randomly placed).
|
||||||
|
*
|
||||||
|
* @param loc
|
||||||
|
* @param item
|
||||||
|
* @return dropped item entity
|
||||||
|
*/
|
||||||
|
public ItemDrop dropItemNaturally(Location loc, ItemStack item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawns an arrow.
|
* Spawns an arrow.
|
||||||
*
|
*
|
||||||
@ -103,4 +121,28 @@ public interface World {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PoweredMinecart spawnPoweredMinecart(Location loc);
|
public PoweredMinecart spawnPoweredMinecart(Location loc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a boat.
|
||||||
|
*
|
||||||
|
* @param loc
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boat spawnBoat(Location loc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name of this world. This is not guaranteed to be unique.
|
||||||
|
*
|
||||||
|
* @return Name of this world
|
||||||
|
*/
|
||||||
|
public String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a semi-unique identifier for this world. While it is highly unlikely
|
||||||
|
* that this may be shared with another World, it is not guaranteed to be
|
||||||
|
* unique.
|
||||||
|
*
|
||||||
|
* @return Id of this world
|
||||||
|
*/
|
||||||
|
public long getId();
|
||||||
}
|
}
|
||||||
|
138
paper-api/src/main/java/org/bukkit/block/BlockState.java
Normal file
138
paper-api/src/main/java/org/bukkit/block/BlockState.java
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
|
||||||
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a captured state of a block, which will not change automatically.
|
||||||
|
*
|
||||||
|
* Unlike Block, which only one object can exist per coordinate, BlockState can
|
||||||
|
* exist multiple times for any given Block. Note that another plugin may change
|
||||||
|
* the state of the block and you will not know, or they may change the block to
|
||||||
|
* another type entirely, causing your BlockState to become invalid.
|
||||||
|
*/
|
||||||
|
public interface BlockState {
|
||||||
|
/**
|
||||||
|
* Gets the block represented by this BlockState
|
||||||
|
*
|
||||||
|
* @return Block that this BlockState represents
|
||||||
|
*/
|
||||||
|
Block getBlock();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the metadata for this block
|
||||||
|
*
|
||||||
|
* @return block specific metadata
|
||||||
|
*/
|
||||||
|
byte getData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of this block
|
||||||
|
*
|
||||||
|
* @return block type
|
||||||
|
*/
|
||||||
|
Material getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type-ID of this block
|
||||||
|
*
|
||||||
|
* @return block type-ID
|
||||||
|
*/
|
||||||
|
int getTypeID();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the light level between 0-15
|
||||||
|
*
|
||||||
|
* @return light level
|
||||||
|
*/
|
||||||
|
byte getLightLevel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the world which contains this Block
|
||||||
|
*
|
||||||
|
* @return World containing this block
|
||||||
|
*/
|
||||||
|
World getWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the x-coordinate of this block
|
||||||
|
*
|
||||||
|
* @return x-coordinate
|
||||||
|
*/
|
||||||
|
int getX();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the y-coordinate of this block
|
||||||
|
*
|
||||||
|
* @return y-coordinate
|
||||||
|
*/
|
||||||
|
int getY();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the z-coordinate of this block
|
||||||
|
*
|
||||||
|
* @return z-coordinate
|
||||||
|
*/
|
||||||
|
int getZ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the chunk which contains this block
|
||||||
|
*
|
||||||
|
* @return Containing Chunk
|
||||||
|
*/
|
||||||
|
Chunk getChunk();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the metadata for this block
|
||||||
|
*
|
||||||
|
* @param data New block specific metadata
|
||||||
|
*/
|
||||||
|
void setData(byte data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the type of this block
|
||||||
|
*
|
||||||
|
* @param type Material to change this block to
|
||||||
|
*/
|
||||||
|
void setType(Material type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the type-ID of this block
|
||||||
|
*
|
||||||
|
* @param type Type-ID to change this block to
|
||||||
|
*/
|
||||||
|
void setTypeID(int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to update the block represented by this state, setting it to the
|
||||||
|
* new values as defined by this state. <br />
|
||||||
|
* <br />
|
||||||
|
* This has the same effect as calling update(false). That is to say,
|
||||||
|
* this will not modify the state of a block if it is no longer the same
|
||||||
|
* type as it was when this state was taken. It will return false in this
|
||||||
|
* eventuality.
|
||||||
|
*
|
||||||
|
* @return true if the update was successful, otherwise false
|
||||||
|
* @see BlockState.update(boolean force)
|
||||||
|
*/
|
||||||
|
boolean update();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to update the block represented by this state, setting it to the
|
||||||
|
* new values as defined by this state. <br />
|
||||||
|
* <br />
|
||||||
|
* Unless force is true, this will not modify the state of a block if it is
|
||||||
|
* no longer the same type as it was when this state was taken. It will return
|
||||||
|
* false in this eventuality.<br />
|
||||||
|
* <br />
|
||||||
|
* If force is true, it will set the type of the block to match the new state,
|
||||||
|
* set the state data and then return true.
|
||||||
|
*
|
||||||
|
* @param force true to forcefully set the state
|
||||||
|
* @return true if the update was successful, otherwise false
|
||||||
|
*/
|
||||||
|
boolean update(boolean force);
|
||||||
|
}
|
37
paper-api/src/main/java/org/bukkit/block/Sign.java
Normal file
37
paper-api/src/main/java/org/bukkit/block/Sign.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents either a SignPost or a WallSign
|
||||||
|
*/
|
||||||
|
public interface Sign extends BlockState {
|
||||||
|
/**
|
||||||
|
* Gets all the lines of text currently on this sign.
|
||||||
|
*
|
||||||
|
* @return Array of Strings containing each line of text
|
||||||
|
*/
|
||||||
|
public String[] getLines();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the line of text at the specified index.
|
||||||
|
*
|
||||||
|
* For example, getLine(0) will return the first line of text.
|
||||||
|
*
|
||||||
|
* @param index Line number to get the text from, starting at 0
|
||||||
|
* @throws IndexOutOfBoundsException Thrown when the line does not exist
|
||||||
|
* @return Text on the given line
|
||||||
|
*/
|
||||||
|
public String getLine(int index) throws IndexOutOfBoundsException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the line of text at the specified index.
|
||||||
|
*
|
||||||
|
* For example, setLine(0, "Line One") will set the first line of text to
|
||||||
|
* "Line One".
|
||||||
|
*
|
||||||
|
* @param index Line number to set the text at, starting from 0
|
||||||
|
* @param line New text to set at the specified index
|
||||||
|
* @throws IndexOutOfBoundsException
|
||||||
|
*/
|
||||||
|
public void setLine(int index, String line) throws IndexOutOfBoundsException;
|
||||||
|
}
|
@ -129,6 +129,8 @@ public abstract class Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a lookup for all core events
|
* Provides a lookup for all core events
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.
|
||||||
*/
|
*/
|
||||||
public enum Type {
|
public enum Type {
|
||||||
/**
|
/**
|
||||||
@ -137,41 +139,64 @@ public abstract class Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player joins a server
|
* Called when a player joins a server
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_JOIN (Category.PLAYER),
|
PLAYER_JOIN (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player is attempting to join a server
|
* Called when a player is attempting to join a server
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerLoginEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_LOGIN (Category.PLAYER),
|
PLAYER_LOGIN (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player sends a chat message
|
* Called when a player sends a chat message
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerChatEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_CHAT (Category.PLAYER),
|
PLAYER_CHAT (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player attempts to use a command
|
* Called when a player attempts to use a command
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerChatEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_COMMAND (Category.PLAYER),
|
PLAYER_COMMAND (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player leaves a server
|
* Called when a player leaves a server
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_QUIT (Category.PLAYER),
|
PLAYER_QUIT (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player moves position in the world
|
* Called when a player moves position in the world
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerMoveEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_MOVE (Category.PLAYER),
|
PLAYER_MOVE (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player undergoes an animation, such as arm swinging
|
* Called when a player undergoes an animation, such as arm swinging
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
PLAYER_ANIMATION (Category.PLAYER),
|
PLAYER_ANIMATION (Category.PLAYER),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player uses an item
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerItemEvent
|
||||||
|
*/
|
||||||
|
PLAYER_ITEM (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player teleports from one position to another
|
* Called when a player teleports from one position to another
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerMoveEvent
|
||||||
*/
|
*/
|
||||||
PLAYER_TELEPORT (Category.PLAYER),
|
PLAYER_TELEPORT (Category.PLAYER),
|
||||||
|
|
||||||
@ -181,25 +206,33 @@ public abstract class Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is damaged (hit by a player)
|
* Called when a block is damaged (hit by a player)
|
||||||
|
* @todo: Add Javadoc see note here.
|
||||||
*/
|
*/
|
||||||
BLOCK_DAMAGED (Category.BLOCK),
|
BLOCK_DAMAGED (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is undergoing a check on whether it can be built
|
* Called when a block is undergoing a universe physics
|
||||||
|
* check on whether it can be built
|
||||||
*
|
*
|
||||||
* For example, cacti cannot be built on grass unless overridden here
|
* For example, cacti cannot be built on grass unless overridden here
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockCanBuildEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_CANBUILD (Category.BLOCK),
|
BLOCK_CANBUILD (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block of water or lava attempts to flow into another
|
* Called when a block of water or lava attempts to flow into another
|
||||||
* block
|
* block
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockFromToEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_FLOW (Category.BLOCK),
|
BLOCK_FLOW (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is being set on fire from another block, such as
|
* Called when a block is being set on fire from another block, such as
|
||||||
* an adjacent block of fire attempting to set fire to wood
|
* an adjacent block of fire attempting to set fire to wood
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockIgniteEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_IGNITE (Category.BLOCK),
|
BLOCK_IGNITE (Category.BLOCK),
|
||||||
|
|
||||||
@ -208,22 +241,44 @@ public abstract class Event {
|
|||||||
*
|
*
|
||||||
* A physics check is commonly called when an adjacent block changes
|
* A physics check is commonly called when an adjacent block changes
|
||||||
* type
|
* type
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockPhysicsEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_PHYSICS (Category.BLOCK),
|
BLOCK_PHYSICS (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player is attempting to place a block
|
* Called when a player is attempting to place a block
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockRightClickedEvent
|
||||||
|
*/
|
||||||
|
BLOCK_RIGHTCLICKED (Category.BLOCK),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player is attempting to place a block
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockPlacedEvent
|
||||||
*/
|
*/
|
||||||
BLOCK_PLACED (Category.BLOCK),
|
BLOCK_PLACED (Category.BLOCK),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an entity interacts with a block (lever, door, pressure plate, chest, furnace)
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockInteractEvent
|
||||||
|
*/
|
||||||
|
BLOCK_INTERACT (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when leaves are decaying naturally
|
* Called when leaves are decaying naturally
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.LeavesDecayEvent
|
||||||
*/
|
*/
|
||||||
LEAVES_DECAY (Category.BLOCK),
|
LEAVES_DECAY (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a liquid attempts to flow into a block which already
|
* Called when a liquid attempts to flow into a block which already
|
||||||
* contains a "breakable" block, such as redstone wire
|
* contains a "breakable" block, such as redstone wire
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
LIQUID_DESTROY (Category.BLOCK),
|
LIQUID_DESTROY (Category.BLOCK),
|
||||||
|
|
||||||
@ -231,6 +286,8 @@ public abstract class Event {
|
|||||||
* Called when a block changes redstone current. Only triggered on blocks
|
* Called when a block changes redstone current. Only triggered on blocks
|
||||||
* that are actually capable of transmitting or carrying a redstone
|
* that are actually capable of transmitting or carrying a redstone
|
||||||
* current
|
* current
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.BlockFromToEvent
|
||||||
*/
|
*/
|
||||||
REDSTONE_CHANGE (Category.BLOCK),
|
REDSTONE_CHANGE (Category.BLOCK),
|
||||||
|
|
||||||
@ -240,26 +297,36 @@ public abstract class Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player opens an inventory
|
* Called when a player opens an inventory
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_OPEN (Category.INVENTORY),
|
INVENTORY_OPEN (Category.INVENTORY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player closes an inventory
|
* Called when a player closes an inventory
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_CLOSE (Category.INVENTORY),
|
INVENTORY_CLOSE (Category.INVENTORY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player clicks on an inventory slot
|
* Called when a player clicks on an inventory slot
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_CLICK (Category.INVENTORY),
|
INVENTORY_CLICK (Category.INVENTORY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an inventory slot changes values or type
|
* Called when an inventory slot changes values or type
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_CHANGE (Category.INVENTORY),
|
INVENTORY_CHANGE (Category.INVENTORY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player is attempting to perform an inventory transaction
|
* Called when a player is attempting to perform an inventory transaction
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
INVENTORY_TRANSACTION (Category.INVENTORY),
|
INVENTORY_TRANSACTION (Category.INVENTORY),
|
||||||
|
|
||||||
@ -269,11 +336,15 @@ public abstract class Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a plugin is enabled
|
* Called when a plugin is enabled
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.server.PluginEvent
|
||||||
*/
|
*/
|
||||||
PLUGIN_ENABLE (Category.SERVER),
|
PLUGIN_ENABLE (Category.SERVER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a plugin is disabled
|
* Called when a plugin is disabled
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.server.PluginEvent
|
||||||
*/
|
*/
|
||||||
PLUGIN_DISABLE (Category.SERVER),
|
PLUGIN_DISABLE (Category.SERVER),
|
||||||
|
|
||||||
@ -286,21 +357,29 @@ public abstract class Event {
|
|||||||
*
|
*
|
||||||
* If a new chunk is being generated for loading, it will call
|
* If a new chunk is being generated for loading, it will call
|
||||||
* Type.CHUNK_GENERATION and then Type.CHUNK_LOADED upon completion
|
* Type.CHUNK_GENERATION and then Type.CHUNK_LOADED upon completion
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.world.ChunkLoadedEvent
|
||||||
*/
|
*/
|
||||||
CHUNK_LOADED (Category.WORLD),
|
CHUNK_LOADED (Category.WORLD),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a chunk is unloaded
|
* Called when a chunk is unloaded
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.world.ChunkUnloadedEvent
|
||||||
*/
|
*/
|
||||||
CHUNK_UNLOADED (Category.WORLD),
|
CHUNK_UNLOADED (Category.WORLD),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a chunk needs to be generated
|
* Called when a chunk needs to be generated
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
CHUNK_GENERATION (Category.WORLD),
|
CHUNK_GENERATION (Category.WORLD),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an ItemEntity spawns in the world
|
* Called when an ItemEntity spawns in the world
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
ITEM_SPAWN (Category.WORLD),
|
ITEM_SPAWN (Category.WORLD),
|
||||||
|
|
||||||
@ -311,29 +390,46 @@ public abstract class Event {
|
|||||||
/**
|
/**
|
||||||
* Called when a creature, either hostile or neutral, attempts to spawn
|
* Called when a creature, either hostile or neutral, attempts to spawn
|
||||||
* in the world "naturally"
|
* in the world "naturally"
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
CREATURE_SPAWN (Category.LIVING_ENTITY),
|
CREATURE_SPAWN (Category.LIVING_ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity is damaged by the environment (for example,
|
* Called when a LivingEntity is damaged by the environment (for example,
|
||||||
* falling or lava)
|
* falling or lava)
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.entity.EntityDamagedByBlockEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_DAMAGEDBY_BLOCK (Category.LIVING_ENTITY),
|
ENTITY_DAMAGEDBY_BLOCK (Category.LIVING_ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity is damaged by another LivingEntity
|
* Called when a LivingEntity is damaged by another LivingEntity
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.entity.EntityDamagedByEntityEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_DAMAGEDBY_ENTITY (Category.LIVING_ENTITY),
|
ENTITY_DAMAGEDBY_ENTITY (Category.LIVING_ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity is damaged with no source.
|
* Called when a LivingEntity is damaged with no source.
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.entity.EntityDamagedEvent
|
||||||
*/
|
*/
|
||||||
ENTITY_DAMAGED(Category.LIVING_ENTITY),
|
ENTITY_DAMAGED(Category.LIVING_ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity dies
|
* Called when a LivingEntity dies
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
ENTITY_DEATH (Category.LIVING_ENTITY),
|
ENTITY_DEATH (Category.LIVING_ENTITY),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a Skeleton or Zombie catch fire due to the sun
|
||||||
|
*
|
||||||
|
* @todo: add javadoc see comment
|
||||||
|
*/
|
||||||
|
ENTITY_COMBUST (Category.LIVING_ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VEHICLE EVENTS
|
* VEHICLE EVENTS
|
||||||
@ -341,36 +437,50 @@ public abstract class Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is placed by a player
|
* Called when a vehicle is placed by a player
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleCreateEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_CREATE (Category.VEHICLE),
|
VEHICLE_CREATE (Category.VEHICLE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is damaged by a LivingEntity
|
* Called when a vehicle is damaged by a LivingEntity
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleDamageEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_DAMAGE (Category.VEHICLE),
|
VEHICLE_DAMAGE (Category.VEHICLE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle collides with an Entity
|
* Called when a vehicle collides with an Entity
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleCollisionEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_COLLISION_ENTITY (Category.VEHICLE),
|
VEHICLE_COLLISION_ENTITY (Category.VEHICLE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle collides with a Block
|
* Called when a vehicle collides with a Block
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_COLLISION_BLOCK (Category.VEHICLE),
|
VEHICLE_COLLISION_BLOCK (Category.VEHICLE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is entered by a LivingEntity
|
* Called when a vehicle is entered by a LivingEntity
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleEnterEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_ENTER (Category.VEHICLE),
|
VEHICLE_ENTER (Category.VEHICLE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is exited by a LivingEntity
|
* Called when a vehicle is exited by a LivingEntity
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleExitEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_EXIT (Category.VEHICLE),
|
VEHICLE_EXIT (Category.VEHICLE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle moves position in the world
|
* Called when a vehicle moves position in the world
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.vehicle.VehicleMoveEvent
|
||||||
*/
|
*/
|
||||||
VEHICLE_MOVE (Category.VEHICLE),
|
VEHICLE_MOVE (Category.VEHICLE),
|
||||||
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package org.bukkit.event.block;
|
|
||||||
|
|
||||||
import org.bukkit.Block;
|
|
||||||
import org.bukkit.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Not implemented yet
|
|
||||||
*/
|
|
||||||
public class BlockBrokenEvent extends BlockEvent {
|
|
||||||
private Player player;
|
|
||||||
|
|
||||||
public BlockBrokenEvent(Type type, Block block ) {
|
|
||||||
super(type, block);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,48 @@
|
|||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.BlockDamageLevel;
|
||||||
|
import org.bukkit.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tkelly
|
||||||
|
*/
|
||||||
|
public class BlockDamagedEvent extends BlockEvent implements Cancellable {
|
||||||
|
private Player player;
|
||||||
|
private BlockDamageLevel damageLevel;
|
||||||
|
private boolean cancel;
|
||||||
|
|
||||||
|
public BlockDamagedEvent(Type type, Block block, BlockDamageLevel level, Player player) {
|
||||||
|
super(type, block);
|
||||||
|
this.damageLevel = level;
|
||||||
|
this.player = player;
|
||||||
|
this.cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player doing the damage
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the level of damage to the block
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BlockDamageLevel getDamageLevel() {
|
||||||
|
return damageLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,98 @@
|
|||||||
package org.bukkit.event.block;
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author durron597
|
* @author SpeaKeasY
|
||||||
*
|
*
|
||||||
|
* Represents a block ignite event.
|
||||||
*/
|
*/
|
||||||
public class BlockIgniteEvent extends Event {
|
public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||||
|
|
||||||
|
private IgniteCause cause;
|
||||||
|
private boolean cancel;
|
||||||
|
private Player thePlayer;
|
||||||
|
private Block theBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type
|
* @param Block, IgniteCause, Player or null.
|
||||||
*/
|
*/
|
||||||
public BlockIgniteEvent(Type type) {
|
public BlockIgniteEvent(Block theBlock, IgniteCause cause, Player thePlayer) {
|
||||||
super(type);
|
super(Event.Type.BLOCK_IGNITE, theBlock);
|
||||||
// TODO Auto-generated constructor stub
|
this.cause = cause;
|
||||||
|
this.theBlock = theBlock;
|
||||||
|
this.thePlayer = thePlayer;
|
||||||
|
this.cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins.
|
||||||
|
*
|
||||||
|
* If an ignite event is cancelled, the block will not be ignited.
|
||||||
|
* This will not fire an event.
|
||||||
|
*
|
||||||
|
* @return true if this event is cancelled
|
||||||
|
*/
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins.
|
||||||
|
*
|
||||||
|
* If an ignite event is cancelled, the block will not be ignited.
|
||||||
|
* This will not fire an event.
|
||||||
|
*
|
||||||
|
* @param cancel true if you wish to cancel this event
|
||||||
|
*/
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cause of block ignite.
|
||||||
|
* @return An IgniteCause value detailing the cause of block ignition.
|
||||||
|
*/
|
||||||
|
public IgniteCause getCause()
|
||||||
|
{
|
||||||
|
return cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the player who ignited this block
|
||||||
|
*
|
||||||
|
* @return Player who placed the block, if not ignited by player returns null.
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return thePlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum to specify the cause of the ignite
|
||||||
|
*/
|
||||||
|
public enum IgniteCause {
|
||||||
|
/**
|
||||||
|
* Block ignition caused by lava.
|
||||||
|
*/
|
||||||
|
LAVA,
|
||||||
|
/**
|
||||||
|
* Block ignition caused by player using flint-and-steel.
|
||||||
|
*/
|
||||||
|
FLINT_AND_STEEL,
|
||||||
|
/**
|
||||||
|
* Block ignition caused by dynamic spreading of fire.
|
||||||
|
*/
|
||||||
|
SPREAD,
|
||||||
|
/**
|
||||||
|
* Block ignition caused by VERY SLOW dynamic spreading of fire.
|
||||||
|
*/
|
||||||
|
SLOW_SPREAD
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.LivingEntity;
|
||||||
|
import org.bukkit.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is triggered whenever an entity interacts with the universe
|
||||||
|
* it's always called, on a left click or a right click, or walking on
|
||||||
|
* (as in the case of pressure plates). Use cancellable to prevent things
|
||||||
|
* from happening (doors opening, buttons, pressure plates being walked
|
||||||
|
* on, etc). Note: even though pressure plates work totally differently
|
||||||
|
* than the other interact events, it's still thrown in with this event.
|
||||||
|
*
|
||||||
|
* @author durron597
|
||||||
|
*/
|
||||||
|
public class BlockInteractEvent extends BlockEvent implements Cancellable {
|
||||||
|
protected boolean cancel;
|
||||||
|
protected LivingEntity theEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type The type of this event
|
||||||
|
* @param interactedBlock the block that was interacted with
|
||||||
|
* @param who The entity that interacted with
|
||||||
|
*/
|
||||||
|
public BlockInteractEvent(Type type, Block interactedBlock, LivingEntity who) {
|
||||||
|
super(type, interactedBlock);
|
||||||
|
theEntity = who;
|
||||||
|
cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* @return true if this event is cancelled
|
||||||
|
*/
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* @param cancel true if you wish to cancel this event
|
||||||
|
*/
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the entity that triggered this event
|
||||||
|
*
|
||||||
|
* @return Entity the entity that triggered this event
|
||||||
|
*/
|
||||||
|
public LivingEntity getEntity() {
|
||||||
|
return theEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method for seeing if this event was triggered by a player
|
||||||
|
*
|
||||||
|
* @return boolean whether this event was triggered by a player
|
||||||
|
*/
|
||||||
|
public boolean isPlayer() {
|
||||||
|
return theEntity instanceof Player;
|
||||||
|
}
|
||||||
|
}
|
@ -15,11 +15,11 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is broken (or destroyed)
|
* Called when a block is damaged (or broken)
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockBroken(BlockBrokenEvent event) {
|
public void onBlockDamaged(BlockDamagedEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,6 +59,22 @@ public class BlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
public void onBlockPlaced(BlockPlacedEvent event) {
|
public void onBlockPlaced(BlockPlacedEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a block is interacted with
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onBlockInteracted(BlockInteractEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player right clicks a block
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onBlockRightClicked(BlockRightClickedEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when redstone changes
|
* Called when redstone changes
|
||||||
@ -70,14 +86,6 @@ public class BlockListener implements Listener {
|
|||||||
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a player right clicks a block
|
|
||||||
*
|
|
||||||
* @param event Relevant event details
|
|
||||||
*/
|
|
||||||
public void onBlockRightClicked(BlockRightClickedEvent event) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when leaves are decaying naturally
|
* Called when leaves are decaying naturally
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.bukkit.event.block;
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
import org.bukkit.Block;
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.ItemStack;
|
||||||
import org.bukkit.Player;
|
import org.bukkit.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
@ -8,23 +9,21 @@ import org.bukkit.event.Cancellable;
|
|||||||
* Not implemented yet
|
* Not implemented yet
|
||||||
*/
|
*/
|
||||||
public class BlockPlacedEvent extends BlockEvent implements Cancellable {
|
public class BlockPlacedEvent extends BlockEvent implements Cancellable {
|
||||||
private boolean cancel;
|
protected boolean cancel;
|
||||||
private Player player;
|
protected boolean canBuild;
|
||||||
|
protected Block placedAgainst;
|
||||||
|
protected ItemStack itemInHand;
|
||||||
|
protected Player player;
|
||||||
|
|
||||||
public BlockPlacedEvent(Type type, Block theBlock) {
|
public BlockPlacedEvent(Type type, Block placedBlock, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild) {
|
||||||
super(type, theBlock);
|
super(type, placedBlock);
|
||||||
|
this.placedAgainst = placedAgainst;
|
||||||
|
this.itemInHand = itemInHand;
|
||||||
|
this.player = thePlayer;
|
||||||
|
this.canBuild = canBuild;
|
||||||
cancel = false;
|
cancel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the player who placed this block
|
|
||||||
*
|
|
||||||
* @return Player who placed the block
|
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the cancellation state of this event. A cancelled event will not
|
* Gets the cancellation state of this event. A cancelled event will not
|
||||||
* be executed in the server, but will still pass to other plugins
|
* be executed in the server, but will still pass to other plugins
|
||||||
@ -45,4 +44,62 @@ public class BlockPlacedEvent extends BlockEvent implements Cancellable {
|
|||||||
this.cancel = cancel;
|
this.cancel = cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the player who placed this block
|
||||||
|
*
|
||||||
|
* @return Player who placed the block
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clarity method for getting the placed block. Not really needed
|
||||||
|
* except for reasons of clarity
|
||||||
|
*
|
||||||
|
* @return Block the block that was placed
|
||||||
|
*/
|
||||||
|
public Block getBlockPlaced() {
|
||||||
|
return getBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the block that this block was placed against
|
||||||
|
*
|
||||||
|
* @return Block the block that the new block was placed against
|
||||||
|
*/
|
||||||
|
public Block getBlockAgainst() {
|
||||||
|
return placedAgainst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the item in your hand when you placed the block
|
||||||
|
*
|
||||||
|
* @return ItemStack the item in your hand when placing the block
|
||||||
|
*/
|
||||||
|
public ItemStack getItemInHand() {
|
||||||
|
return itemInHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value whether the player would be allowed to build here.
|
||||||
|
* Defaults to spawn if the server was going to stop them (such as, the
|
||||||
|
* player is in Spawn). Note that this is an entirely different check
|
||||||
|
* than BLOCK_CANBUILD, as this refers to a player, not universe-physics
|
||||||
|
* rule like cactus on dirt.
|
||||||
|
*
|
||||||
|
* @return boolean whether the server would allow a player to build here
|
||||||
|
*/
|
||||||
|
public boolean canBuild() {
|
||||||
|
return this.canBuild;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the canBuild state of this event. Set to true if you want the
|
||||||
|
* player to be able to build.
|
||||||
|
*/
|
||||||
|
public void setBuild(boolean canBuild) {
|
||||||
|
this.canBuild = canBuild;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.bukkit.event.block;
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
import org.bukkit.Block;
|
import org.bukkit.Block;
|
||||||
@ -9,45 +6,54 @@ import org.bukkit.ItemStack;
|
|||||||
import org.bukkit.Player;
|
import org.bukkit.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author durron597
|
* Not implemented yet
|
||||||
*/
|
*/
|
||||||
public class BlockRightClickedEvent extends BlockEvent {
|
public class BlockRightClickedEvent extends BlockEvent {
|
||||||
protected Player clicker;
|
protected Block clickedBlock;
|
||||||
protected BlockFace direction;
|
protected BlockFace direction;
|
||||||
protected ItemStack clickedWith;
|
protected ItemStack itemInHand;
|
||||||
|
protected Player player;
|
||||||
|
|
||||||
/**
|
public BlockRightClickedEvent(Type type, Block placedAgainst, BlockFace direction, ItemStack itemInHand, Player thePlayer) {
|
||||||
* @param type The type of event this is
|
super(type, placedAgainst);
|
||||||
* @param theBlock The clicked block
|
this.clickedBlock = placedAgainst;
|
||||||
* @param direction The face we clicked from
|
|
||||||
* @param clicker The player who clicked a block
|
|
||||||
* @param clickedWith Item in player's hand
|
|
||||||
*/
|
|
||||||
public BlockRightClickedEvent(Type type, Block theBlock, BlockFace direction, Player clicker, ItemStack clickedWith) {
|
|
||||||
super(type, theBlock);
|
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
this.clicker = clicker;
|
this.itemInHand = itemInHand;
|
||||||
this.clickedWith = clickedWith;
|
this.player = thePlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the clicker
|
* Gets the player who placed this block
|
||||||
|
*
|
||||||
|
* @return Player who placed the block
|
||||||
*/
|
*/
|
||||||
public Player getClicker() {
|
public Player getPlayer() {
|
||||||
return clicker;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the direction
|
* Get the block that this block was placed against
|
||||||
|
*
|
||||||
|
* @return Block the block that the new block was placed against
|
||||||
|
*/
|
||||||
|
public Block getBlockAgainst() {
|
||||||
|
return clickedBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return BlockFace the direction this block was clicked
|
||||||
*/
|
*/
|
||||||
public BlockFace getDirection() {
|
public BlockFace getDirection() {
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the clickedWith
|
* Returns the item in your hand when you placed the block
|
||||||
|
*
|
||||||
|
* @return ItemStack the item in your hand when placing the block
|
||||||
*/
|
*/
|
||||||
public ItemStack getClickedWith() {
|
public ItemStack getItemInHand() {
|
||||||
return clickedWith;
|
return itemInHand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
|
import org.bukkit.Entity;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The event when a skeleton or zombie catch on fire due to the sun.
|
||||||
|
* If the event is cancelled, the fire is stopped.
|
||||||
|
*/
|
||||||
|
public class EntityCombustEvent extends EntityEvent implements Cancellable {
|
||||||
|
private boolean cancel;
|
||||||
|
|
||||||
|
public EntityCombustEvent(Type type, Entity what) {
|
||||||
|
super(type, what);
|
||||||
|
this.cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package org.bukkit.event.entity;
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
import org.bukkit.Block;
|
|
||||||
import org.bukkit.Entity;
|
import org.bukkit.Entity;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.bukkit.event.entity;
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
import org.bukkit.Block;
|
|
||||||
import org.bukkit.Entity;
|
import org.bukkit.Entity;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.bukkit.event.entity;
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
import org.bukkit.Entity;
|
import org.bukkit.Entity;
|
||||||
import org.bukkit.LivingEntity;
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,4 +14,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
public void onEntityDamagedByEntity(EntityDamagedByEntityEvent event) {
|
public void onEntityDamagedByEntity(EntityDamagedByEntityEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onEntityCombust(EntityCombustEvent event) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.event.Cancellable;
|
|||||||
public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
private String message;
|
private String message;
|
||||||
|
private String format = "<%1$s> %2$s";
|
||||||
|
|
||||||
public PlayerChatEvent(final Type type, final Player player, final String message) {
|
public PlayerChatEvent(final Type type, final Player player, final String message) {
|
||||||
super(type, player);
|
super(type, player);
|
||||||
@ -63,4 +64,22 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
|||||||
public void setPlayer(final Player player) {
|
public void setPlayer(final Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the format to use to display this chat message
|
||||||
|
*
|
||||||
|
* @return String.Format compatible format string
|
||||||
|
*/
|
||||||
|
public String getFormat() {
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the format to use to display this chat message
|
||||||
|
*
|
||||||
|
* @param format String.Format compatible format string
|
||||||
|
*/
|
||||||
|
public void setFormat(final String format) {
|
||||||
|
this.format = format;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,103 @@
|
|||||||
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.BlockFace;
|
||||||
|
import org.bukkit.ItemStack;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author durron597
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PlayerItemEvent extends PlayerEvent implements Cancellable {
|
||||||
|
protected ItemStack item;
|
||||||
|
protected boolean cancel;
|
||||||
|
protected Block blockClicked;
|
||||||
|
protected BlockFace blockFace;
|
||||||
|
|
||||||
|
public PlayerItemEvent(Type type, Player who, ItemStack item, Block blockClicked, BlockFace blockFace) {
|
||||||
|
super(type, who);
|
||||||
|
this.item = item;
|
||||||
|
cancel = false;
|
||||||
|
this.blockClicked = blockClicked;
|
||||||
|
this.blockFace = blockFace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cancellation state of this event. Set to true if you
|
||||||
|
* want to prevent buckets from placing water and so forth
|
||||||
|
*
|
||||||
|
* @return boolean cancellation state
|
||||||
|
*/
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* Cancelling this event will prevent use of food (player won't lose the
|
||||||
|
* food item), prevent bows/snowballs/eggs from firing, etc. (player won't
|
||||||
|
* lose the ammo)
|
||||||
|
*
|
||||||
|
* @param cancel true if you wish to cancel this event
|
||||||
|
*/
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the item in hand represented by this event
|
||||||
|
*
|
||||||
|
* @return ItemStack the item used
|
||||||
|
*/
|
||||||
|
public ItemStack getItem() {
|
||||||
|
return this.item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method. Returns the material of the item represented by this
|
||||||
|
* event
|
||||||
|
*
|
||||||
|
* @return Material the material of the item used
|
||||||
|
*/
|
||||||
|
public Material getMaterial() {
|
||||||
|
if (this.item == null) return Material.Air;
|
||||||
|
|
||||||
|
return item.getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method to inform the user whether this was a block placement
|
||||||
|
* event.
|
||||||
|
*
|
||||||
|
* @return boolean true if the item in hand was a block
|
||||||
|
*/
|
||||||
|
public boolean isBlock() {
|
||||||
|
if (item == null) return false;
|
||||||
|
|
||||||
|
return item.getType().isBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the clicked block
|
||||||
|
*
|
||||||
|
* @return Block returns the block clicked with this item.
|
||||||
|
*/
|
||||||
|
public Block getBlockClicked() {
|
||||||
|
return blockClicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the face of the block that was clicked
|
||||||
|
*
|
||||||
|
* @return BlockFace returns the face of the block that was clicked
|
||||||
|
*/
|
||||||
|
public BlockFace getBlockFace() {
|
||||||
|
return blockFace;
|
||||||
|
}
|
||||||
|
}
|
@ -57,6 +57,14 @@ public class PlayerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
public void onPlayerTeleport(PlayerMoveEvent event) {
|
public void onPlayerTeleport(PlayerMoveEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player uses an item
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onPlayerItem(PlayerItemEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player attempts to log in to the server
|
* Called when a player attempts to log in to the server
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.Vehicle;
|
|||||||
*/
|
*/
|
||||||
public class VehicleCreateEvent extends VehicleEvent {
|
public class VehicleCreateEvent extends VehicleEvent {
|
||||||
public VehicleCreateEvent(Type type, Vehicle vehicle) {
|
public VehicleCreateEvent(Type type, Vehicle vehicle) {
|
||||||
|
|
||||||
super(type, vehicle);
|
super(type, vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
package org.bukkit.event.vehicle;
|
package org.bukkit.event.vehicle;
|
||||||
|
|
||||||
import org.bukkit.LivingEntity;
|
import org.bukkit.Entity;
|
||||||
import org.bukkit.Vehicle;
|
import org.bukkit.Vehicle;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raised when a living entity enters a vehicle.
|
* Raised when an entity enters a vehicle.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
|
public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private LivingEntity entered;
|
private Entity entered;
|
||||||
|
|
||||||
public VehicleEnterEvent(Type type, Vehicle vehicle, LivingEntity entered) {
|
public VehicleEnterEvent(Type type, Vehicle vehicle, Entity entered) {
|
||||||
super(type, vehicle);
|
super(type, vehicle);
|
||||||
|
|
||||||
this.entered = entered;
|
this.entered = entered;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the living entity that entered the vehicle.
|
* Get the entity that entered the vehicle.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public LivingEntity getEntered() {
|
public Entity getEntered() {
|
||||||
return entered;
|
return entered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,14 +2,18 @@ package org.bukkit.event.vehicle;
|
|||||||
|
|
||||||
import org.bukkit.Entity;
|
import org.bukkit.Entity;
|
||||||
import org.bukkit.Vehicle;
|
import org.bukkit.Vehicle;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raised when a vehicle collides with an entity.
|
* Raised when a vehicle collides with an entity.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class VehicleEntityCollisionEvent extends VehicleCollisionEvent {
|
public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implements Cancellable {
|
||||||
private Entity entity;
|
private Entity entity;
|
||||||
|
private boolean cancelled = false;
|
||||||
|
private boolean cancelledPickup = false;
|
||||||
|
private boolean cancelledCollision = false;
|
||||||
|
|
||||||
public VehicleEntityCollisionEvent(Type type, Vehicle vehicle, Entity entity) {
|
public VehicleEntityCollisionEvent(Type type, Vehicle vehicle, Entity entity) {
|
||||||
super(type, vehicle);
|
super(type, vehicle);
|
||||||
@ -19,4 +23,28 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent {
|
|||||||
public Entity getEntity() {
|
public Entity getEntity() {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPickupCancelled() {
|
||||||
|
return cancelledPickup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPickupCancelled(boolean cancel) {
|
||||||
|
cancelledPickup = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCollisionCancelled() {
|
||||||
|
return cancelledCollision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollisionCancelled(boolean cancel) {
|
||||||
|
cancelledCollision = cancel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
package org.bukkit.event.vehicle;
|
package org.bukkit.event.vehicle;
|
||||||
|
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener for vehicle events.
|
* Listener for vehicle events.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class VehicleListener {
|
public class VehicleListener implements Listener {
|
||||||
|
public VehicleListener() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a vehicle is created by a player. This hook will be called
|
* Called when a vehicle is created by a player. This hook will be called
|
||||||
* for all vehicles created.
|
* for all vehicles created.
|
||||||
|
@ -6,100 +6,96 @@ import org.bukkit.*;
|
|||||||
import org.bukkit.plugin.*;
|
import org.bukkit.plugin.*;
|
||||||
|
|
||||||
public class Checker {
|
public class Checker {
|
||||||
private static String directory = Fillr.directory;
|
private static String DIRECTORY = Fillr.DIRECTORY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks all the plugins in plugins/ for updates
|
* Checks all the plugins in plugins/ for updates
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* The player to send info to
|
* The player to send info to
|
||||||
*/
|
*/
|
||||||
void check(Player player) {
|
void check(Player player) {
|
||||||
File folder = new File(directory);
|
File folder = new File(DIRECTORY);
|
||||||
File[] files = folder.listFiles(new PluginFilter());
|
File[] files = folder.listFiles(new PluginFilter());
|
||||||
if (files.length == 0) {
|
if (files.length == 0) {
|
||||||
player.sendMessage("No plugins to update.");
|
player.sendMessage("No plugins to update.");
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("Status for " + files.length
|
player.sendMessage("Status for " + files.length + " plugins:");
|
||||||
+ " plugins:");
|
for (File file : files) {
|
||||||
for (File file : files) {
|
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
||||||
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
if (pdfFile == null) {
|
||||||
if (pdfFile == null) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
checkForUpdate(file, player);
|
||||||
checkForUpdate(file, player);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for an update for a given plugin
|
* Checks for an update for a given plugin
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* The plugin file to check for an update
|
* The plugin file to check for an update
|
||||||
* @param player
|
* @param player
|
||||||
* The player to send info to
|
* The player to send info to
|
||||||
*/
|
*/
|
||||||
private void checkForUpdate(File file, Player player) {
|
private void checkForUpdate(File file, Player player) {
|
||||||
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
||||||
FillReader reader = needsUpdate(pdfFile);
|
FillReader reader = needsUpdate(pdfFile);
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
player.sendMessage(Color.RED + reader.getName() + " "
|
player.sendMessage(Color.RED + reader.getName() + " " + pdfFile.getVersion() + " has an update to " + reader.getCurrVersion());
|
||||||
+ pdfFile.getVersion() + " has an update to "
|
} else {
|
||||||
+ reader.getCurrVersion());
|
player.sendMessage(pdfFile.getName() + " " + pdfFile.getVersion() + " is up to date!");
|
||||||
} else {
|
}
|
||||||
player.sendMessage(reader.getName() + " " + reader.getCurrVersion()
|
}
|
||||||
+ " is up to date!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a given plugin needs an update
|
* Checks if a given plugin needs an update
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* The .yml file to check
|
* The .yml file to check
|
||||||
* @return The FillReader for the online repo info on the plugin
|
* @return The FillReader for the online repo info on the plugin if the plugin needs an update
|
||||||
*/
|
* Returns null if no update is needed.
|
||||||
static FillReader needsUpdate(PluginDescriptionFile file) {
|
*/
|
||||||
FillReader reader = new FillReader(file.getName());
|
static FillReader needsUpdate(PluginDescriptionFile file) {
|
||||||
String version = file.getVersion();
|
FillReader reader = new FillReader(file.getName());
|
||||||
String currVersion = reader.getCurrVersion();
|
String version = file.getVersion();
|
||||||
String name = reader.getName();
|
String currVersion = reader.getCurrVersion();
|
||||||
if (currVersion.equalsIgnoreCase(version)
|
String name = reader.getName();
|
||||||
&& new File(directory, name + ".jar").exists()) {
|
if (currVersion.equalsIgnoreCase(version) && new File(DIRECTORY, name + ".jar").exists()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will grab the plugin's .yml file from the give file (hopefully a plugin).
|
* Will grab the plugin's .yml file from the give file (hopefully a plugin).
|
||||||
* It'll throw it into a PluginDescriptionFile
|
* It'll throw it into a PluginDescriptionFile
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* The plugin (jar) file
|
* The plugin (jar) file
|
||||||
* @return The PluginDescriptionFile representing the .yml
|
* @return The PluginDescriptionFile representing the .yml
|
||||||
*/
|
*/
|
||||||
static PluginDescriptionFile getPDF(File file) {
|
static PluginDescriptionFile getPDF(File file) {
|
||||||
// TODO supports only jar files for now. how will yml's be stored in
|
// TODO supports only jar files for now. how will yml's be stored in
|
||||||
// different languages?
|
// different languages?
|
||||||
if (file.getName().endsWith(".jar")) {
|
if (file.getName().endsWith(".jar")) {
|
||||||
JarFile jarFile;
|
JarFile jarFile;
|
||||||
try {
|
try {
|
||||||
jarFile = new JarFile(file);
|
jarFile = new JarFile(file);
|
||||||
JarEntry entry = jarFile.getJarEntry("plugin.yml");
|
JarEntry entry = jarFile.getJarEntry("plugin.yml");
|
||||||
InputStream input = jarFile.getInputStream(entry);
|
InputStream input = jarFile.getInputStream(entry);
|
||||||
return new PluginDescriptionFile(input);
|
return new PluginDescriptionFile(input);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
} catch (InvalidDescriptionException e) {
|
} catch (InvalidDescriptionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,158 +7,135 @@ import java.io.*;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
public class Downloader {
|
public class Downloader {
|
||||||
private final static String directory = Fillr.directory;
|
private final static String DIRECTORY = Fillr.DIRECTORY;
|
||||||
private final static String downloads = directory + File.separator + "downloads";
|
private final static String DOWNLOAD_DIR = DIRECTORY + File.separator + "downloads";
|
||||||
private final static String backup = "backup";
|
private final static String BACKUP = DIRECTORY + File.separator + "backups";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads the jar from a given url. If it is a compressed archive, it
|
* Downloads the jar from a given url. If it is a compressed archive, it
|
||||||
* tries to get the .jars out of it
|
* tries to get the .jars out of it
|
||||||
*
|
*
|
||||||
* @param url
|
* @param url
|
||||||
* The url to download from
|
* The url to download from
|
||||||
*/
|
*/
|
||||||
static void downloadJar(String url) throws Exception {
|
static void downloadJar(String url) throws Exception {
|
||||||
int index = url.lastIndexOf('/');
|
int index = url.lastIndexOf('/');
|
||||||
String name = url.substring(index + 1);
|
String name = url.substring(index + 1);
|
||||||
|
|
||||||
File file = new File(directory, name);
|
File file = new File(DIRECTORY, name);
|
||||||
if (url.endsWith(".jar") && file.exists()) {
|
if (url.endsWith(".jar") && file.exists()) {
|
||||||
backupFile(file);
|
backupFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
download(new URL(url), name, directory);
|
download(new URL(url), name, DIRECTORY);
|
||||||
file = new File("plugins", name);
|
file = new File("plugins", name);
|
||||||
/*if (name.endsWith(".zip") || name.endsWith(".tar")
|
}
|
||||||
|| name.endsWith(".rar") || name.endsWith(".7z")) {
|
|
||||||
unzipPlugin(file);
|
|
||||||
file.delete();
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads the file for a given plugin
|
* Downloads the file for a given plugin
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The name of the plugin to download
|
* The name of the plugin to download
|
||||||
* @param player
|
* @param player
|
||||||
* The player to send info to
|
* The player to send info to
|
||||||
*/
|
*/
|
||||||
void downloadFile(String name, Player player) throws Exception {
|
void downloadFile(String name, Player player) throws Exception {
|
||||||
File file = new File(directory, name + ".jar");
|
File file = new File(DIRECTORY, name + ".jar");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
player.sendMessage("Downloading " + name + "'s file");
|
player.sendMessage("Downloading " + name + "'s file");
|
||||||
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
||||||
FillReader reader = Checker.needsUpdate(pdfFile);
|
FillReader reader = Checker.needsUpdate(pdfFile);
|
||||||
downloadFile(new URL(reader.getFile()));
|
downloadFile(new URL(reader.getFile()));
|
||||||
player.sendMessage("Finished download");
|
player.sendMessage("Finished download");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Can't find " + name);
|
System.out.println("Can't find " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads the file to the plugin/downloads directory
|
* Downloads the file to the plugin/downloads directory
|
||||||
*
|
*
|
||||||
* @param u
|
* @param u
|
||||||
* The url of the file to download
|
* The url of the file to download
|
||||||
*/
|
*/
|
||||||
private void downloadFile(URL u) throws Exception {
|
private void downloadFile(URL u) throws Exception {
|
||||||
String name = u.getFile();
|
String name = u.getFile();
|
||||||
int index = name.lastIndexOf('/');
|
int index = name.lastIndexOf('/');
|
||||||
name = name.substring(index + 1);
|
name = name.substring(index + 1);
|
||||||
download(u, name, downloads);
|
download(u, name, DOWNLOAD_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads the file to a given directory with a given name
|
* Downloads the file to a given directory with a given name
|
||||||
*
|
*
|
||||||
* @param u
|
* @param u
|
||||||
* The url of the file to download
|
* The url of the file to download
|
||||||
* @param name
|
* @param name
|
||||||
* The name to give the file
|
* The name to give the file
|
||||||
* @param directory
|
* @param directory
|
||||||
* The directory to put the file
|
* The directory to put the file
|
||||||
*/
|
*/
|
||||||
private static void download(URL u, String name, String directory)
|
private static void download(URL u, String name, String directory) throws Exception {
|
||||||
throws Exception {
|
InputStream inputStream = null;
|
||||||
InputStream inputStream = null;
|
// try {
|
||||||
// try {
|
inputStream = u.openStream();
|
||||||
inputStream = u.openStream();
|
|
||||||
|
|
||||||
if (!new File(directory).exists()) {
|
if (!new File(directory).exists()) {
|
||||||
new File(directory).mkdir();
|
new File(directory).mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
File f = new File(directory, name);
|
File f = new File(directory, name);
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
f.createNewFile();
|
f.createNewFile();
|
||||||
|
|
||||||
copyInputStream(inputStream, new BufferedOutputStream(
|
copyInputStream(inputStream, new BufferedOutputStream(new FileOutputStream(f)));
|
||||||
new FileOutputStream(f)));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
System.out.println("[UPDATR]: Error closing inputStream");
|
System.out.println("[UPDATR]: Error closing inputStream");
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decompresses a file! How nice.
|
* Copies an InputStream to an OutputStream!
|
||||||
*
|
*
|
||||||
* @param f
|
* @param in
|
||||||
* the file to decompress
|
* InputStream
|
||||||
*/
|
* @param out
|
||||||
private static void unzipPlugin(File f) {
|
* OutputStream
|
||||||
try {
|
* @throws IOException
|
||||||
System.out.println("Extracting jars out of " + f.getName());
|
*/
|
||||||
//ExtractorUtil.extract(f, f.getAbsolutePath());
|
private static final void copyInputStream(InputStream in, OutputStream out) throws IOException {
|
||||||
} catch (Exception e) {
|
byte[] buffer = new byte[1024];
|
||||||
System.out.println("[UPDATR]: Error decompressing " + f.getName());
|
int len;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
while ((len = in.read(buffer)) >= 0) {
|
||||||
* Copies an InputStream to an OutputStream!
|
out.write(buffer, 0, len);
|
||||||
*
|
}
|
||||||
* @param in
|
|
||||||
* InputStream
|
|
||||||
* @param out
|
|
||||||
* OutputStream
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private static final void copyInputStream(InputStream in, OutputStream out)
|
|
||||||
throws IOException {
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
while ((len = in.read(buffer)) >= 0) {
|
in.close();
|
||||||
out.write(buffer, 0, len);
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
/**
|
||||||
out.close();
|
* Moves the file to the backup folder.
|
||||||
}
|
*
|
||||||
|
* @param file
|
||||||
/**
|
* The file to backup
|
||||||
* Moves the file to the backup folder.
|
*/
|
||||||
*
|
private static void backupFile(File file) {
|
||||||
* @param file
|
if (file.exists()) {
|
||||||
* The file to backup
|
System.out.println("Backing up old file: " + file.getName());
|
||||||
*/
|
if (!new File(BACKUP).exists()) {
|
||||||
private static void backupFile(File file) {
|
new File(BACKUP).mkdir();
|
||||||
if (file.exists()) {
|
}
|
||||||
System.out.println("Backing up old file: " + file.getName());
|
file.renameTo(new File(BACKUP, file.getName() + ".bak"));
|
||||||
if (!new File(backup).exists()) {
|
}
|
||||||
new File(backup).mkdir();
|
}
|
||||||
}
|
|
||||||
file.renameTo(new File(backup, file.getName() + ".bak"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import org.json.simple.parser.ParseException;
|
|||||||
*/
|
*/
|
||||||
public class FillReader {
|
public class FillReader {
|
||||||
//TODO change this to what it will actually be...
|
//TODO change this to what it will actually be...
|
||||||
private static String baseUrl = "http://taylorkelly.me/pnfo.php";
|
private static final String BASE_URL = "http://taylorkelly.me/pnfo.php";
|
||||||
private String currVersion;
|
private String currVersion;
|
||||||
private String file;
|
private String file;
|
||||||
private String name;
|
private String name;
|
||||||
@ -24,8 +24,8 @@ public class FillReader {
|
|||||||
try {
|
try {
|
||||||
String result = "";
|
String result = "";
|
||||||
try {
|
try {
|
||||||
URL url = new URL(baseUrl + "?name=" + name);
|
URL url = new URL(BASE_URL + "?name=" + name);
|
||||||
System.out.println(baseUrl + "?name=" + name);
|
System.out.println(BASE_URL + "?name=" + name);
|
||||||
URLConnection conn = url.openConnection();
|
URLConnection conn = url.openConnection();
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
BufferedReader rd = new BufferedReader(new InputStreamReader(
|
BufferedReader rd = new BufferedReader(new InputStreamReader(
|
||||||
|
@ -8,21 +8,24 @@ import org.bukkit.event.*;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class Fillr extends JavaPlugin {
|
public class Fillr extends JavaPlugin {
|
||||||
private FillrListener listener;
|
private FillrListener listener;
|
||||||
public static String name = "Fillr";
|
public static final String NAME = "Fillr";
|
||||||
public static String version = "1.0";
|
public static final String VERSION = "1.0";
|
||||||
public static String directory = "plugins";
|
public static final String DIRECTORY = "plugins";
|
||||||
|
|
||||||
public Fillr(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File plugin, ClassLoader cLoader) {
|
public Fillr(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File plugin, ClassLoader cLoader) {
|
||||||
super(pluginLoader, instance, desc, plugin, cLoader);
|
super(pluginLoader, instance, desc, plugin, cLoader);
|
||||||
registerEvents();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisable() {}
|
public void onDisable() {
|
||||||
public void onEnable() {}
|
}
|
||||||
|
|
||||||
private void registerEvents() {
|
public void onEnable() {
|
||||||
listener = new FillrListener(getServer());
|
registerEvents();
|
||||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, listener, Event.Priority.Normal, this);
|
}
|
||||||
}
|
|
||||||
|
private void registerEvents() {
|
||||||
|
listener = new FillrListener(getServer());
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, listener, Event.Priority.Normal, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.plugin.InvalidPluginException;
|
|||||||
|
|
||||||
public class Getter {
|
public class Getter {
|
||||||
private Server server;
|
private Server server;
|
||||||
private static String directory = Fillr.directory;
|
private static String DIRECTORY = Fillr.DIRECTORY;
|
||||||
|
|
||||||
public Getter(Server server) {
|
public Getter(Server server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
@ -36,7 +36,7 @@ public class Getter {
|
|||||||
private void enablePlugin(FillReader update) {
|
private void enablePlugin(FillReader update) {
|
||||||
final String name = update.getName();
|
final String name = update.getName();
|
||||||
//TODO again with the implicit jar support...
|
//TODO again with the implicit jar support...
|
||||||
File plugin = new File(directory, name + ".jar");
|
File plugin = new File(DIRECTORY, name + ".jar");
|
||||||
try {
|
try {
|
||||||
server.getPluginManager().loadPlugin(plugin);
|
server.getPluginManager().loadPlugin(plugin);
|
||||||
} catch (InvalidPluginException ex) {
|
} catch (InvalidPluginException ex) {
|
||||||
|
@ -8,7 +8,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class Updater {
|
public class Updater {
|
||||||
public static String directory = Fillr.directory;
|
public static String DIRECTORY = Fillr.DIRECTORY;
|
||||||
private final Server server;
|
private final Server server;
|
||||||
|
|
||||||
Updater(Server server) {
|
Updater(Server server) {
|
||||||
@ -22,7 +22,7 @@ public class Updater {
|
|||||||
* The player to send info to
|
* The player to send info to
|
||||||
*/
|
*/
|
||||||
void updateAll(Player player) {
|
void updateAll(Player player) {
|
||||||
File folder = new File(directory);
|
File folder = new File(DIRECTORY);
|
||||||
File[] files = folder.listFiles(new PluginFilter());
|
File[] files = folder.listFiles(new PluginFilter());
|
||||||
if (files.length == 0) {
|
if (files.length == 0) {
|
||||||
player.sendMessage("No plugins to update.");
|
player.sendMessage("No plugins to update.");
|
||||||
@ -52,7 +52,7 @@ public class Updater {
|
|||||||
*/
|
*/
|
||||||
void update(String string, Player player) {
|
void update(String string, Player player) {
|
||||||
//TODO so much .jars
|
//TODO so much .jars
|
||||||
File file = new File(directory, string + ".jar");
|
File file = new File(DIRECTORY, string + ".jar");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
PluginDescriptionFile pdfFile = Checker.getPDF(file);
|
||||||
FillReader reader = Checker.needsUpdate(pdfFile);
|
FillReader reader = Checker.needsUpdate(pdfFile);
|
||||||
@ -94,7 +94,7 @@ public class Updater {
|
|||||||
void enablePlugin(FillReader update) {
|
void enablePlugin(FillReader update) {
|
||||||
final String name = update.getName();
|
final String name = update.getName();
|
||||||
//TODO again with the implicit jar support...
|
//TODO again with the implicit jar support...
|
||||||
File plugin = new File(directory, name + ".jar");
|
File plugin = new File(DIRECTORY, name + ".jar");
|
||||||
try {
|
try {
|
||||||
server.getPluginManager().loadPlugin(plugin);
|
server.getPluginManager().loadPlugin(plugin);
|
||||||
} catch (InvalidPluginException ex) {
|
} catch (InvalidPluginException ex) {
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.event.CustomEventListener;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
import org.bukkit.event.entity.EntityDamagedByBlockEvent;
|
import org.bukkit.event.entity.EntityDamagedByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamagedByEntityEvent;
|
import org.bukkit.event.entity.EntityDamagedByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
import org.bukkit.event.entity.EntityListener;
|
||||||
@ -108,6 +109,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
case PLAYER_TELEPORT:
|
case PLAYER_TELEPORT:
|
||||||
trueListener.onPlayerTeleport((PlayerMoveEvent)event);
|
trueListener.onPlayerTeleport((PlayerMoveEvent)event);
|
||||||
break;
|
break;
|
||||||
|
case PLAYER_ITEM:
|
||||||
|
trueListener.onPlayerItem((PlayerItemEvent)event);
|
||||||
|
break;
|
||||||
case PLAYER_LOGIN:
|
case PLAYER_LOGIN:
|
||||||
trueListener.onPlayerLogin((PlayerLoginEvent)event);
|
trueListener.onPlayerLogin((PlayerLoginEvent)event);
|
||||||
break;
|
break;
|
||||||
@ -122,12 +126,27 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
case BLOCK_CANBUILD:
|
case BLOCK_CANBUILD:
|
||||||
trueListener.onBlockCanBuild((BlockCanBuildEvent)event);
|
trueListener.onBlockCanBuild((BlockCanBuildEvent)event);
|
||||||
break;
|
break;
|
||||||
|
case BLOCK_RIGHTCLICKED:
|
||||||
|
trueListener.onBlockRightClicked((BlockRightClickedEvent) event);
|
||||||
|
break;
|
||||||
|
case BLOCK_PLACED:
|
||||||
|
trueListener.onBlockPlaced((BlockPlacedEvent)event);
|
||||||
|
break;
|
||||||
|
case BLOCK_DAMAGED:
|
||||||
|
trueListener.onBlockDamaged((BlockDamagedEvent)event);
|
||||||
|
break;
|
||||||
|
case BLOCK_INTERACT:
|
||||||
|
trueListener.onBlockInteracted((BlockInteractEvent)event);
|
||||||
|
break;
|
||||||
case BLOCK_FLOW:
|
case BLOCK_FLOW:
|
||||||
trueListener.onBlockFlow((BlockFromToEvent)event);
|
trueListener.onBlockFlow((BlockFromToEvent)event);
|
||||||
break;
|
break;
|
||||||
case LEAVES_DECAY:
|
case LEAVES_DECAY:
|
||||||
trueListener.onLeavesDecay((LeavesDecayEvent)event);
|
trueListener.onLeavesDecay((LeavesDecayEvent)event);
|
||||||
break;
|
break;
|
||||||
|
case BLOCK_IGNITE:
|
||||||
|
trueListener.onBlockIgnite((BlockIgniteEvent)event);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if(listener instanceof ServerListener) {
|
} else if(listener instanceof ServerListener) {
|
||||||
ServerListener trueListener = (ServerListener)listener;
|
ServerListener trueListener = (ServerListener)listener;
|
||||||
@ -164,6 +183,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
case ENTITY_DEATH:
|
case ENTITY_DEATH:
|
||||||
// TODO: ENTITY_DEATH hook
|
// TODO: ENTITY_DEATH hook
|
||||||
break;
|
break;
|
||||||
|
case ENTITY_COMBUST:
|
||||||
|
trueListener.onEntityCombust((EntityCombustEvent)event);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (listener instanceof VehicleListener) {
|
} else if (listener instanceof VehicleListener) {
|
||||||
VehicleListener trueListener = (VehicleListener)listener;
|
VehicleListener trueListener = (VehicleListener)listener;
|
||||||
|
Loading…
Reference in New Issue
Block a user