Added javadoc for events

This commit is contained in:
Eric 2016-07-06 21:34:08 +02:00
parent 99ab436346
commit 77f2476a70
9 changed files with 63 additions and 17 deletions

View File

@ -4,6 +4,9 @@ import de.epiceric.shopchest.shop.Shop;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
/**
* Called when a player buys or sells something from or to a shop
*/
public class ShopBuySellEvent extends ShopEvent implements Cancellable { public class ShopBuySellEvent extends ShopEvent implements Cancellable {
private Player player; private Player player;
private Shop shop; private Shop shop;
@ -21,6 +24,9 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable {
return shop; return shop;
} }
/**
* @return Whether the player buys or sells something
*/
public Type getType() { public Type getType() {
return type; return type;
} }
@ -36,8 +42,8 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancel) {
cancelled = b; cancelled = cancel;
} }
public enum Type { public enum Type {

View File

@ -4,6 +4,9 @@ import de.epiceric.shopchest.shop.Shop;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
/**
* Called when a player creates a shop (clicks on a chest)
*/
public class ShopCreateEvent extends ShopEvent implements Cancellable { public class ShopCreateEvent extends ShopEvent implements Cancellable {
private Player player; private Player player;
private Shop shop; private Shop shop;
@ -26,6 +29,9 @@ public class ShopCreateEvent extends ShopEvent implements Cancellable {
return player; return player;
} }
/**
* @return The price the player has to pay in order to create the shop (only if the event is not cancelled)
*/
public double getCreationPrice() { public double getCreationPrice() {
return creationPrice; return creationPrice;
} }
@ -36,8 +42,8 @@ public class ShopCreateEvent extends ShopEvent implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancel) {
cancelled = b; cancelled = cancel;
} }
} }

View File

@ -9,8 +9,14 @@ public abstract class ShopEvent extends Event {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
/**
* @return Shop which is involved in this event
*/
public abstract Shop getShop(); public abstract Shop getShop();
/**
* @return Player who is involved in this event
*/
public abstract Player getPlayer(); public abstract Player getPlayer();
@Override @Override

View File

@ -4,6 +4,9 @@ import de.epiceric.shopchest.shop.Shop;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
/**
* Called when a player retrieves information about a shop (clicks on a chest)
*/
public class ShopInfoEvent extends ShopEvent implements Cancellable { public class ShopInfoEvent extends ShopEvent implements Cancellable {
private Player player; private Player player;
private Shop shop; private Shop shop;
@ -30,7 +33,7 @@ public class ShopInfoEvent extends ShopEvent implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancel) {
cancelled = b; cancelled = cancel;
} }
} }

View File

@ -4,6 +4,9 @@ import de.epiceric.shopchest.shop.Shop;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
/**
* Called when a player wants to create a shop (enters the command)
*/
public class ShopPreCreateEvent extends ShopEvent implements Cancellable { public class ShopPreCreateEvent extends ShopEvent implements Cancellable {
private Player player; private Player player;
private Shop shop; private Shop shop;
@ -14,6 +17,7 @@ public class ShopPreCreateEvent extends ShopEvent implements Cancellable {
this.shop = shop; this.shop = shop;
} }
@Override
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
@ -29,7 +33,7 @@ public class ShopPreCreateEvent extends ShopEvent implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancel) {
cancelled = b; cancelled = cancel;
} }
} }

View File

@ -5,6 +5,9 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/**
* Called when a player wants to retrieve information about a shop (enters the command)
*/
public class ShopPreInfoEvent extends Event implements Cancellable { public class ShopPreInfoEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -15,6 +18,9 @@ public class ShopPreInfoEvent extends Event implements Cancellable {
this.player = player; this.player = player;
} }
/**
* @return Player who is involved in this event
*/
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
@ -25,8 +31,8 @@ public class ShopPreInfoEvent extends Event implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancel) {
this.cancelled = b; this.cancelled = cancel;
} }
@Override @Override

View File

@ -5,6 +5,9 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/**
* Called when a player wants to remove a shop (enters the command)
*/
public class ShopPreRemoveEvent extends Event implements Cancellable { public class ShopPreRemoveEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -15,6 +18,9 @@ public class ShopPreRemoveEvent extends Event implements Cancellable {
this.player = player; this.player = player;
} }
/**
* @return Player who is involved in this event
*/
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
@ -25,8 +31,8 @@ public class ShopPreRemoveEvent extends Event implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancel) {
this.cancelled = cancelled; cancelled = cancel;
} }
@Override @Override

View File

@ -5,6 +5,9 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/**
* Called when a player reloads the shops
*/
public class ShopReloadEvent extends Event implements Cancellable { public class ShopReloadEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -15,6 +18,9 @@ public class ShopReloadEvent extends Event implements Cancellable {
this.player = player; this.player = player;
} }
/**
* @return Player who is involved in this event
*/
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
@ -30,7 +36,7 @@ public class ShopReloadEvent extends Event implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancel) {
cancelled = b; cancelled = cancel;
} }
} }

View File

@ -4,6 +4,9 @@ import de.epiceric.shopchest.shop.Shop;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
/**
* Called when a player removes a shop (clicks on a chest)
*/
public class ShopRemoveEvent extends ShopEvent implements Cancellable { public class ShopRemoveEvent extends ShopEvent implements Cancellable {
private Player player; private Player player;
private Shop shop; private Shop shop;
@ -30,7 +33,7 @@ public class ShopRemoveEvent extends ShopEvent implements Cancellable {
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancel) {
cancelled = b; cancelled = cancel;
} }
} }