mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
Merge remote branch 'upstream/master' into HEAD
By: durron597 <martin.jared@gmail.com>
This commit is contained in:
commit
fef6ae3d7f
47 changed files with 302 additions and 271 deletions
19
paper-api/.gitignore
vendored
19
paper-api/.gitignore
vendored
|
@ -1,11 +1,20 @@
|
||||||
|
# Eclipse stuff
|
||||||
|
/.classpath
|
||||||
|
/.project
|
||||||
|
/.settings
|
||||||
|
|
||||||
/build
|
# netbeans
|
||||||
/nbproject
|
/nbproject
|
||||||
/build.xml
|
|
||||||
/manifest.mf
|
# maven
|
||||||
/dist
|
/target
|
||||||
|
|
||||||
|
# vim
|
||||||
|
.*.sw[a-p]
|
||||||
|
|
||||||
|
# test stuff (do remove me!)
|
||||||
/sample/test
|
/sample/test
|
||||||
/sample/build.xml
|
/sample/build.xml
|
||||||
/sample/build
|
/sample/build
|
||||||
/sample/dist
|
/sample/dist
|
||||||
/sample/nbproject
|
/sample/nbproject
|
||||||
|
|
17
paper-api/pom.xml
Executable file
17
paper-api/pom.xml
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>Bukkit</name>
|
||||||
|
<url>http://www.bukkit.org</url>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +25,7 @@ public interface Entity {
|
||||||
* @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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a unique ID for this entity
|
* Returns a unique ID for this entity
|
||||||
*
|
*
|
|
@ -11,7 +11,7 @@ public interface HumanEntity extends LivingEntity {
|
||||||
* @return Player name
|
* @return Player name
|
||||||
*/
|
*/
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the item this entity has currently selected, which will be shown in
|
* Gets the item this entity has currently selected, which will be shown in
|
||||||
* their hand
|
* their hand
|
|
@ -181,7 +181,7 @@ public enum Material {
|
||||||
CookedFish(350),
|
CookedFish(350),
|
||||||
GoldRecord(2256),
|
GoldRecord(2256),
|
||||||
GreenRecord(2257);
|
GreenRecord(2257);
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private static final Map<Integer, Material> lookup = new HashMap<Integer, Material>();
|
private static final Map<Integer, Material> lookup = new HashMap<Integer, Material>();
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package org.bukkit.event;
|
||||||
|
|
||||||
|
public interface Cancellable {
|
||||||
|
public boolean isCancelled();
|
||||||
|
public void setCancelled(boolean cancel);
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ public abstract class Event {
|
||||||
* @return Server which this event was triggered on
|
* @return Server which this event was triggered on
|
||||||
*/
|
*/
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,23 +48,23 @@ public abstract class Event {
|
||||||
*/
|
*/
|
||||||
Lowest
|
Lowest
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Category {
|
public enum Category {
|
||||||
PLAYER,
|
PLAYER,
|
||||||
BLOCK,
|
BLOCK,
|
||||||
ITEM,
|
ITEM,
|
||||||
ENVIRONMENT,
|
ENVIRONMENT,
|
||||||
ENTITY,
|
ENTITY,
|
||||||
VEHICLE,
|
VEHICLE,
|
||||||
INVENTORY,
|
INVENTORY,
|
||||||
SIGN,
|
SIGN,
|
||||||
CUSTOM;
|
CUSTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
/**
|
/**
|
||||||
* Player Events
|
* Player Events
|
||||||
*/
|
*/
|
||||||
PLAYER_JOIN (Category.PLAYER),
|
PLAYER_JOIN (Category.PLAYER),
|
||||||
PLAYER_LOGIN (Category.PLAYER),
|
PLAYER_LOGIN (Category.PLAYER),
|
||||||
PLAYER_CHAT (Category.PLAYER),
|
PLAYER_CHAT (Category.PLAYER),
|
||||||
|
@ -74,8 +74,8 @@ public abstract class Event {
|
||||||
//PLAYER_ANIMATION (Category.PLAYER),
|
//PLAYER_ANIMATION (Category.PLAYER),
|
||||||
PLAYER_TELEPORT (Category.PLAYER),
|
PLAYER_TELEPORT (Category.PLAYER),
|
||||||
/**
|
/**
|
||||||
* Block Events
|
* Block Events
|
||||||
*/
|
*/
|
||||||
BLOCK_BROKEN (Category.BLOCK),
|
BLOCK_BROKEN (Category.BLOCK),
|
||||||
BLOCK_CANBUILD (Category.BLOCK),
|
BLOCK_CANBUILD (Category.BLOCK),
|
||||||
BLOCK_FLOW (Category.BLOCK),
|
BLOCK_FLOW (Category.BLOCK),
|
||||||
|
@ -84,31 +84,31 @@ public abstract class Event {
|
||||||
BLOCK_PLACED (Category.BLOCK),
|
BLOCK_PLACED (Category.BLOCK),
|
||||||
BLOCK_RIGHTCLICKED (Category.BLOCK),
|
BLOCK_RIGHTCLICKED (Category.BLOCK),
|
||||||
REDSTONE_CHANGE (Category.BLOCK);
|
REDSTONE_CHANGE (Category.BLOCK);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item Events
|
* Item Events
|
||||||
|
|
||||||
ITEM_DROP (Category.ITEM),
|
ITEM_DROP (Category.ITEM),
|
||||||
ITEM_PICK_UP (Category.ITEM),
|
ITEM_PICK_UP (Category.ITEM),
|
||||||
ITEM_USE (Category.ITEM),
|
ITEM_USE (Category.ITEM),
|
||||||
/**
|
/**
|
||||||
* Environment Events
|
* Environment Events
|
||||||
|
|
||||||
IGNITE (Category.ENVIRONMENT),
|
IGNITE (Category.ENVIRONMENT),
|
||||||
FLOW (Category.ENVIRONMENT),
|
FLOW (Category.ENVIRONMENT),
|
||||||
EXPLODE (Category.ENVIRONMENT),
|
EXPLODE (Category.ENVIRONMENT),
|
||||||
LIQUID_DESTROY (Category.ENVIRONMENT),
|
LIQUID_DESTROY (Category.ENVIRONMENT),
|
||||||
/**
|
/**
|
||||||
* Non-player Entity Events
|
* Non-player Entity Events
|
||||||
|
|
||||||
MOB_SPAWN (Category.ENTITY),
|
MOB_SPAWN (Category.ENTITY),
|
||||||
DAMAGE (Category.ENTITY),
|
DAMAGE (Category.ENTITY),
|
||||||
HEALTH_CHANGE (Category.ENTITY),
|
HEALTH_CHANGE (Category.ENTITY),
|
||||||
ATTACK (Category.ENTITY), // Need to look into this category more
|
ATTACK (Category.ENTITY), // Need to look into this category more
|
||||||
/**
|
/**
|
||||||
* Vehicle Events
|
* Vehicle Events
|
||||||
|
|
||||||
VEHICLE_CREATE (Category.VEHICLE),
|
VEHICLE_CREATE (Category.VEHICLE),
|
||||||
VEHICLE_UPDATE (Category.VEHICLE),
|
VEHICLE_UPDATE (Category.VEHICLE),
|
||||||
VEHICLE_DAMAGE (Category.VEHICLE),
|
VEHICLE_DAMAGE (Category.VEHICLE),
|
||||||
|
@ -117,24 +117,24 @@ public abstract class Event {
|
||||||
VEHICLE_ENTERED (Category.VEHICLE),
|
VEHICLE_ENTERED (Category.VEHICLE),
|
||||||
VEHICLE_POSITIONCHANGE (Category.VEHICLE),
|
VEHICLE_POSITIONCHANGE (Category.VEHICLE),
|
||||||
/**
|
/**
|
||||||
* Inventory Events
|
* Inventory Events
|
||||||
|
|
||||||
OPEN_INVENTORY (Category.INVENTORY),
|
OPEN_INVENTORY (Category.INVENTORY),
|
||||||
/**
|
/**
|
||||||
* Sign Events (Item events??)
|
* Sign Events (Item events??)
|
||||||
|
|
||||||
SIGN_SHOW (Category.SIGN),
|
SIGN_SHOW (Category.SIGN),
|
||||||
SIGN_CHANGE (Category.SIGN);
|
SIGN_CHANGE (Category.SIGN);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Category category;
|
private Category category;
|
||||||
|
|
||||||
private Type(Category category) {
|
private Type(Category category) {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Category getCategory() {
|
public Category getCategory() {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package org.bukkit.event;
|
package org.bukkit.event;
|
||||||
|
|
||||||
public class EventException extends Exception {
|
public class EventException extends Exception {
|
||||||
private static final long serialVersionUID = 3532808232324183999L;
|
private static final long serialVersionUID = 3532808232324183999L;
|
||||||
private final Throwable cause;
|
private final Throwable cause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new EventException based on the given Exception
|
* Constructs a new EventException based on the given Exception
|
||||||
|
@ -24,18 +24,18 @@ public class EventException extends Exception {
|
||||||
* Constructs a new EventException with the given message
|
* Constructs a new EventException with the given message
|
||||||
*/
|
*/
|
||||||
public EventException(Throwable cause, String message) {
|
public EventException(Throwable cause, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.cause = cause;
|
this.cause = cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new EventException with the given message
|
* Constructs a new EventException with the given message
|
||||||
*/
|
*/
|
||||||
public EventException(String message) {
|
public EventException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
cause = null;
|
cause = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If applicable, returns the Exception that triggered this Exception
|
* If applicable, returns the Exception that triggered this Exception
|
||||||
*
|
*
|
|
@ -7,7 +7,7 @@ import org.bukkit.Block;
|
||||||
*/
|
*/
|
||||||
public class BlockBrokenEvent extends BlockEvent {
|
public class BlockBrokenEvent extends BlockEvent {
|
||||||
|
|
||||||
public BlockBrokenEvent(Type type, Block block ) {
|
public BlockBrokenEvent(Type type, Block block ) {
|
||||||
super(type, block);
|
super(type, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author durron597
|
||||||
|
*/
|
||||||
|
public class BlockCanBuildEvent extends BlockEvent {
|
||||||
|
protected boolean buildable;
|
||||||
|
protected int material;
|
||||||
|
|
||||||
|
public BlockCanBuildEvent(Type type, Block block, int id, boolean canBuild) {
|
||||||
|
super(type, block);
|
||||||
|
buildable = canBuild;
|
||||||
|
material = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether or not the block can be built here. By default, returns
|
||||||
|
* Minecraft's answer on whether the block can be built
|
||||||
|
*
|
||||||
|
* @return boolean whether or not the block can be built
|
||||||
|
*/
|
||||||
|
public boolean isBuildable() {
|
||||||
|
return buildable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the block can be built here.
|
||||||
|
*/
|
||||||
|
public void setBuildable(boolean cancel) {
|
||||||
|
this.buildable = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Material getMaterial() {
|
||||||
|
return Material.getMaterial(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaterialID() {
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,9 +10,9 @@ import org.bukkit.event.Event;
|
||||||
*/
|
*/
|
||||||
public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||||
protected Block from;
|
protected Block from;
|
||||||
protected BlockFace face;
|
protected BlockFace face;
|
||||||
protected boolean cancel;
|
protected boolean cancel;
|
||||||
|
|
||||||
public BlockFromToEvent(final Event.Type type, final Block block, final BlockFace face) {
|
public BlockFromToEvent(final Event.Type type, final Block block, final BlockFace face) {
|
||||||
super(type, block);
|
super(type, block);
|
||||||
this.face = face;
|
this.face = face;
|
||||||
|
@ -28,21 +28,23 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||||
public BlockFace getFace() {
|
public BlockFace getFace() {
|
||||||
return face;
|
return face;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method for getting the faced block
|
* Convenience method for getting the faced block
|
||||||
*
|
*
|
||||||
* @return Block the faced block
|
* @return Block the faced block
|
||||||
*/
|
*/
|
||||||
public Block getFromBlock() {
|
public Block getFromBlock() {
|
||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCancelled() {
|
@Override
|
||||||
return cancel;
|
public boolean isCancelled() {
|
||||||
}
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCancelled(boolean cancel) {
|
@Override
|
||||||
this.cancel = cancel;
|
public void setCancelled(boolean cancel) {
|
||||||
}
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author durron597
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockIgniteEvent extends Event {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
|
public BlockIgniteEvent(Type type) {
|
||||||
|
super(type);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,12 +8,12 @@ import org.bukkit.event.Listener;
|
||||||
* @author durron597
|
* @author durron597
|
||||||
*/
|
*/
|
||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
public BlockListener() {
|
public BlockListener() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is broken (or destroyed)
|
* Called when a block is broken (or destroyed)
|
||||||
*
|
*
|
||||||
|
@ -27,7 +27,7 @@ public class BlockListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block flows (water/lava)
|
* Called when a block flows (water/lava)
|
||||||
*
|
*
|
||||||
|
@ -43,7 +43,7 @@ public class BlockListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when block physics occurs
|
* Called when block physics occurs
|
||||||
*
|
*
|
||||||
|
@ -51,7 +51,7 @@ public class BlockListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player places a block
|
* Called when a player places a block
|
||||||
*
|
*
|
||||||
|
@ -69,7 +69,7 @@ public class BlockListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player right clicks a block
|
* Called when a player right clicks a block
|
||||||
*
|
*
|
|
@ -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.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not implemented yet
|
||||||
|
*/
|
||||||
|
public class BlockPlacedEvent extends BlockEvent implements Cancellable {
|
||||||
|
private boolean cancel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
* @param theBlock
|
||||||
|
*/
|
||||||
|
public BlockPlacedEvent(Type type, Block theBlock) {
|
||||||
|
super(type, theBlock);
|
||||||
|
cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Block;
|
||||||
|
import org.bukkit.BlockFace;
|
||||||
|
import org.bukkit.ItemStack;
|
||||||
|
import org.bukkit.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author durron597
|
||||||
|
*/
|
||||||
|
public class BlockRightClickedEvent extends BlockEvent {
|
||||||
|
protected Player clicker;
|
||||||
|
protected BlockFace direction;
|
||||||
|
protected ItemStack clickedWith;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type The type of event this is
|
||||||
|
* @param theBlock The clicked block
|
||||||
|
* @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.clicker = clicker;
|
||||||
|
this.clickedWith = clickedWith;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the clicker
|
||||||
|
*/
|
||||||
|
public Player getClicker() {
|
||||||
|
return clicker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the direction
|
||||||
|
*/
|
||||||
|
public BlockFace getDirection() {
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the clickedWith
|
||||||
|
*/
|
||||||
|
public ItemStack getClickedWith() {
|
||||||
|
return clickedWith;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,8 +5,8 @@ package org.bukkit.plugin;
|
||||||
* Thrown when attempting to load an invalid PluginDescriptionFile
|
* Thrown when attempting to load an invalid PluginDescriptionFile
|
||||||
*/
|
*/
|
||||||
public class InvalidDescriptionException extends Exception {
|
public class InvalidDescriptionException extends Exception {
|
||||||
private static final long serialVersionUID = 5721389122281775894L;
|
private static final long serialVersionUID = 5721389122281775894L;
|
||||||
private final Throwable cause;
|
private final Throwable cause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new InvalidDescriptionException based on the given Exception
|
* Constructs a new InvalidDescriptionException based on the given Exception
|
|
@ -5,8 +5,8 @@ package org.bukkit.plugin;
|
||||||
* Thrown when attempting to load an invalid Plugin file
|
* Thrown when attempting to load an invalid Plugin file
|
||||||
*/
|
*/
|
||||||
public class InvalidPluginException extends Exception {
|
public class InvalidPluginException extends Exception {
|
||||||
private static final long serialVersionUID = -8242141640709409542L;
|
private static final long serialVersionUID = -8242141640709409542L;
|
||||||
private final Throwable cause;
|
private final Throwable cause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new InvalidPluginException based on the given Exception
|
* Constructs a new InvalidPluginException based on the given Exception
|
|
@ -81,7 +81,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||||
} catch (InvalidPluginException ex) {
|
} catch (InvalidPluginException ex) {
|
||||||
Logger.getLogger(SimplePluginManager.class.getName()).log(Level.SEVERE, "Could not load " + file.getPath() + " in " + directory.getPath(), ex);
|
Logger.getLogger(SimplePluginManager.class.getName()).log(Level.SEVERE, "Could not load " + file.getPath() + " in " + directory.getPath(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
result.add(plugin);
|
result.add(plugin);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given plugin is loaded and returns it when applicable
|
* Checks if the given plugin is loaded and returns it when applicable
|
||||||
*
|
*
|
||||||
|
@ -203,7 +203,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||||
if (registration.getPriority().compareTo(priority) < 0) {
|
if (registration.getPriority().compareTo(priority) < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
|
@ -24,13 +24,13 @@ import org.bukkit.plugin.*;
|
||||||
public final class JavaPluginLoader implements PluginLoader {
|
public final class JavaPluginLoader implements PluginLoader {
|
||||||
private final Server server;
|
private final Server server;
|
||||||
private final Pattern[] fileFilters = new Pattern[] {
|
private final Pattern[] fileFilters = new Pattern[] {
|
||||||
Pattern.compile("\\.jar$"),
|
Pattern.compile("\\.jar$"),
|
||||||
};
|
};
|
||||||
|
|
||||||
public JavaPluginLoader(Server instance) {
|
public JavaPluginLoader(Server instance) {
|
||||||
server = instance;
|
server = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin loadPlugin(File file) throws InvalidPluginException {
|
public Plugin loadPlugin(File file) throws InvalidPluginException {
|
||||||
JavaPlugin result = null;
|
JavaPlugin result = null;
|
||||||
PluginDescriptionFile description = null;
|
PluginDescriptionFile description = null;
|
||||||
|
@ -82,41 +82,41 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
PlayerListener trueListener = (PlayerListener)listener;
|
PlayerListener trueListener = (PlayerListener)listener;
|
||||||
|
|
||||||
switch (event.getType()) {
|
switch (event.getType()) {
|
||||||
case PLAYER_JOIN:
|
case PLAYER_JOIN:
|
||||||
trueListener.onPlayerJoin((PlayerEvent)event);
|
trueListener.onPlayerJoin((PlayerEvent)event);
|
||||||
break;
|
break;
|
||||||
case PLAYER_QUIT:
|
case PLAYER_QUIT:
|
||||||
trueListener.onPlayerQuit((PlayerEvent)event);
|
trueListener.onPlayerQuit((PlayerEvent)event);
|
||||||
break;
|
break;
|
||||||
case PLAYER_COMMAND:
|
case PLAYER_COMMAND:
|
||||||
trueListener.onPlayerCommand((PlayerChatEvent)event);
|
trueListener.onPlayerCommand((PlayerChatEvent)event);
|
||||||
break;
|
break;
|
||||||
case PLAYER_CHAT:
|
case PLAYER_CHAT:
|
||||||
trueListener.onPlayerChat((PlayerChatEvent)event);
|
trueListener.onPlayerChat((PlayerChatEvent)event);
|
||||||
break;
|
break;
|
||||||
case PLAYER_MOVE:
|
case PLAYER_MOVE:
|
||||||
trueListener.onPlayerMove((PlayerMoveEvent)event);
|
trueListener.onPlayerMove((PlayerMoveEvent)event);
|
||||||
break;
|
break;
|
||||||
case PLAYER_TELEPORT:
|
case PLAYER_TELEPORT:
|
||||||
trueListener.onPlayerTeleport((PlayerMoveEvent)event);
|
trueListener.onPlayerTeleport((PlayerMoveEvent)event);
|
||||||
break;
|
break;
|
||||||
case PLAYER_LOGIN:
|
case PLAYER_LOGIN:
|
||||||
trueListener.onPlayerLogin((PlayerLoginEvent)event);
|
trueListener.onPlayerLogin((PlayerLoginEvent)event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (listener instanceof BlockListener) {
|
} else if (listener instanceof BlockListener) {
|
||||||
BlockListener trueListener = (BlockListener)listener;
|
BlockListener trueListener = (BlockListener)listener;
|
||||||
|
|
||||||
switch (event.getType()) {
|
switch (event.getType()) {
|
||||||
case BLOCK_PHYSICS:
|
case BLOCK_PHYSICS:
|
||||||
trueListener.onBlockPhysics((BlockPhysicsEvent)event);
|
trueListener.onBlockPhysics((BlockPhysicsEvent)event);
|
||||||
break;
|
break;
|
||||||
case BLOCK_CANBUILD:
|
case BLOCK_CANBUILD:
|
||||||
trueListener.onBlockCanBuild((BlockCanBuildEvent)event);
|
trueListener.onBlockCanBuild((BlockCanBuildEvent)event);
|
||||||
break;
|
break;
|
||||||
case BLOCK_FLOW:
|
case BLOCK_FLOW:
|
||||||
trueListener.onBlockFlow((BlockFromToEvent)event);
|
trueListener.onBlockFlow((BlockFromToEvent)event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
package org.bukkit.event;
|
|
||||||
|
|
||||||
public interface Cancellable {
|
|
||||||
public boolean isCancelled();
|
|
||||||
public void setCancelled(boolean cancel);
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.bukkit.event.block;
|
|
||||||
|
|
||||||
import org.bukkit.Block;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author durron597
|
|
||||||
*/
|
|
||||||
public class BlockCanBuildEvent extends BlockEvent {
|
|
||||||
protected boolean buildable;
|
|
||||||
protected int material;
|
|
||||||
|
|
||||||
public BlockCanBuildEvent(Type type, Block block, int id, boolean canBuild) {
|
|
||||||
super(type, block);
|
|
||||||
buildable = canBuild;
|
|
||||||
material = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not the block can be built here. By default, returns
|
|
||||||
* Minecraft's answer on whether the block can be built
|
|
||||||
*
|
|
||||||
* @return boolean whether or not the block can be built
|
|
||||||
*/
|
|
||||||
public boolean isBuildable() {
|
|
||||||
return buildable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set whether the block can be built here.
|
|
||||||
*/
|
|
||||||
public void setBuildable(boolean cancel) {
|
|
||||||
this.buildable = cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Material getMaterial() {
|
|
||||||
return Material.getMaterial(material);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaterialID() {
|
|
||||||
return material;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package org.bukkit.event.block;
|
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author durron597
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class BlockIgniteEvent extends Event {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param type
|
|
||||||
*/
|
|
||||||
public BlockIgniteEvent(Type type) {
|
|
||||||
super(type);
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package org.bukkit.event.block;
|
|
||||||
|
|
||||||
import org.bukkit.Block;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Not implemented yet
|
|
||||||
*/
|
|
||||||
public class BlockPlacedEvent extends BlockEvent implements Cancellable {
|
|
||||||
private boolean cancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param type
|
|
||||||
* @param theBlock
|
|
||||||
*/
|
|
||||||
public BlockPlacedEvent(Type type, Block theBlock) {
|
|
||||||
super(type, theBlock);
|
|
||||||
cancel = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean cancel) {
|
|
||||||
this.cancel = cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.bukkit.event.block;
|
|
||||||
|
|
||||||
import org.bukkit.Block;
|
|
||||||
import org.bukkit.BlockFace;
|
|
||||||
import org.bukkit.ItemStack;
|
|
||||||
import org.bukkit.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author durron597
|
|
||||||
*/
|
|
||||||
public class BlockRightClickedEvent extends BlockEvent {
|
|
||||||
protected Player clicker;
|
|
||||||
protected BlockFace direction;
|
|
||||||
protected ItemStack clickedWith;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param type The type of event this is
|
|
||||||
* @param theBlock The clicked block
|
|
||||||
* @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.clicker = clicker;
|
|
||||||
this.clickedWith = clickedWith;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the clicker
|
|
||||||
*/
|
|
||||||
public Player getClicker() {
|
|
||||||
return clicker;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the direction
|
|
||||||
*/
|
|
||||||
public BlockFace getDirection() {
|
|
||||||
return direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the clickedWith
|
|
||||||
*/
|
|
||||||
public ItemStack getClickedWith() {
|
|
||||||
return clickedWith;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue