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.event.Cancellable;
/**
* Called when a player buys or sells something from or to a shop
*/
public class ShopBuySellEvent extends ShopEvent implements Cancellable {
private Player player;
private Shop shop;
@ -21,6 +24,9 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable {
return shop;
}
/**
* @return Whether the player buys or sells something
*/
public Type getType() {
return type;
}
@ -36,8 +42,8 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable {
}
@Override
public void setCancelled(boolean b) {
cancelled = b;
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
public enum Type {

View File

@ -4,6 +4,9 @@ import de.epiceric.shopchest.shop.Shop;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
* Called when a player creates a shop (clicks on a chest)
*/
public class ShopCreateEvent extends ShopEvent implements Cancellable {
private Player player;
private Shop shop;
@ -26,6 +29,9 @@ public class ShopCreateEvent extends ShopEvent implements Cancellable {
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() {
return creationPrice;
}
@ -36,8 +42,8 @@ public class ShopCreateEvent extends ShopEvent implements Cancellable {
}
@Override
public void setCancelled(boolean b) {
cancelled = b;
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
}

View File

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

View File

@ -4,6 +4,9 @@ import de.epiceric.shopchest.shop.Shop;
import org.bukkit.entity.Player;
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 {
private Player player;
private Shop shop;
@ -30,7 +33,7 @@ public class ShopInfoEvent extends ShopEvent implements Cancellable {
}
@Override
public void setCancelled(boolean b) {
cancelled = b;
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
}

View File

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

View File

@ -5,6 +5,9 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
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 {
private static final HandlerList handlers = new HandlerList();
@ -15,6 +18,9 @@ public class ShopPreInfoEvent extends Event implements Cancellable {
this.player = player;
}
/**
* @return Player who is involved in this event
*/
public Player getPlayer() {
return player;
}
@ -25,8 +31,8 @@ public class ShopPreInfoEvent extends Event implements Cancellable {
}
@Override
public void setCancelled(boolean b) {
this.cancelled = b;
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
@Override

View File

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

View File

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

View File

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