mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-23 15:29:34 +01:00
Standardized indentation to 4 spaces
By: durron597 <martin.jared@gmail.com>
This commit is contained in:
parent
50a71db923
commit
2254c3dce2
16 changed files with 168 additions and 169 deletions
|
@ -33,10 +33,10 @@ public class SampleBlockListener extends BlockListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
||||||
Material mat = event.getMaterial();
|
Material mat = event.getMaterial();
|
||||||
|
|
||||||
if (mat.equals(Material.Cactus)) {
|
if (mat.equals(Material.Cactus)) {
|
||||||
event.setBuildable(true);
|
event.setBuildable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.bukkit.event;
|
package org.bukkit.event;
|
||||||
|
|
||||||
public interface Cancellable {
|
public interface Cancellable {
|
||||||
public boolean isCancelled();
|
public boolean isCancelled();
|
||||||
public void setCancelled(boolean cancel);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,21 +50,21 @@ public abstract class Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
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),
|
||||||
|
@ -87,27 +87,27 @@ public abstract class Event {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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),
|
||||||
|
@ -117,11 +117,11 @@ 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);
|
||||||
|
@ -130,11 +130,11 @@ public abstract class Event {
|
||||||
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,16 +24,16 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,12 @@ import org.bukkit.event.Event;
|
||||||
*/
|
*/
|
||||||
public class BlockIgniteEvent extends Event {
|
public class BlockIgniteEvent extends Event {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
public BlockIgniteEvent(Type type) {
|
public BlockIgniteEvent(Type type) {
|
||||||
super(type);
|
super(type);
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ 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() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,26 +7,26 @@ 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;
|
private boolean cancel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type
|
* @param type
|
||||||
* @param theBlock
|
* @param theBlock
|
||||||
*/
|
*/
|
||||||
public BlockPlacedEvent(Type type, Block theBlock) {
|
public BlockPlacedEvent(Type type, Block theBlock) {
|
||||||
super(type, theBlock);
|
super(type, theBlock);
|
||||||
cancel = false;
|
cancel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return cancel;
|
return cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCancelled(boolean cancel) {
|
public void setCancelled(boolean cancel) {
|
||||||
this.cancel = cancel;
|
this.cancel = cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,42 +12,42 @@ import org.bukkit.Player;
|
||||||
* @author durron597
|
* @author durron597
|
||||||
*/
|
*/
|
||||||
public class BlockRightClickedEvent extends BlockEvent {
|
public class BlockRightClickedEvent extends BlockEvent {
|
||||||
protected Player clicker;
|
protected Player clicker;
|
||||||
protected BlockFace direction;
|
protected BlockFace direction;
|
||||||
protected ItemStack clickedWith;
|
protected ItemStack clickedWith;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type The type of event this is
|
* @param type The type of event this is
|
||||||
* @param theBlock The clicked block
|
* @param theBlock The clicked block
|
||||||
* @param direction The face we clicked from
|
* @param direction The face we clicked from
|
||||||
* @param clicker The player who clicked a block
|
* @param clicker The player who clicked a block
|
||||||
* @param clickedWith Item in player's hand
|
* @param clickedWith Item in player's hand
|
||||||
*/
|
*/
|
||||||
public BlockRightClickedEvent(Type type, Block theBlock, BlockFace direction, Player clicker, ItemStack clickedWith) {
|
public BlockRightClickedEvent(Type type, Block theBlock, BlockFace direction, Player clicker, ItemStack clickedWith) {
|
||||||
super(type, theBlock);
|
super(type, theBlock);
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
this.clicker = clicker;
|
this.clicker = clicker;
|
||||||
this.clickedWith = clickedWith;
|
this.clickedWith = clickedWith;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the clicker
|
* @return the clicker
|
||||||
*/
|
*/
|
||||||
public Player getClicker() {
|
public Player getClicker() {
|
||||||
return clicker;
|
return clicker;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the direction
|
* @return the direction
|
||||||
*/
|
*/
|
||||||
public BlockFace getDirection() {
|
public BlockFace getDirection() {
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the clickedWith
|
* @return the clickedWith
|
||||||
*/
|
*/
|
||||||
public ItemStack getClickedWith() {
|
public ItemStack getClickedWith() {
|
||||||
return clickedWith;
|
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
|
||||||
|
|
|
@ -24,7 +24,7 @@ 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) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue