Use ShopPlayer in events instead of Player

This commit is contained in:
Eric 2019-08-18 14:27:00 +02:00
parent 5b8452cd96
commit eebefa348a
12 changed files with 41 additions and 36 deletions

View File

@ -1,8 +1,8 @@
package de.epiceric.shopchest.api.event;
import de.epiceric.shopchest.api.player.ShopPlayer;
import de.epiceric.shopchest.api.shop.Shop;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
@ -16,7 +16,7 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable {
private double price;
private boolean cancelled;
public ShopBuySellEvent(Player player, Shop shop, Type type, int amount, double price) {
public ShopBuySellEvent(ShopPlayer player, Shop shop, Type type, int amount, double price) {
super(player, shop);
this.type = type;
this.amount = amount;

View File

@ -1,7 +1,7 @@
package de.epiceric.shopchest.api.event;
import de.epiceric.shopchest.api.player.ShopPlayer;
import de.epiceric.shopchest.api.shop.Shop;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
@ -13,7 +13,7 @@ public class ShopCreateEvent extends ShopEvent implements Cancellable {
private double creationPrice;
private boolean cancelled;
public ShopCreateEvent(Player player, Shop shop, double creationPrice) {
public ShopCreateEvent(ShopPlayer player, Shop shop, double creationPrice) {
super(player, shop);
this.creationPrice = creationPrice;
}

View File

@ -1,7 +1,7 @@
package de.epiceric.shopchest.api.event;
import de.epiceric.shopchest.api.player.ShopPlayer;
import de.epiceric.shopchest.api.shop.Shop;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@ -14,9 +14,9 @@ public abstract class ShopEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private Shop shop;
private Player player;
private ShopPlayer player;
public ShopEvent(Player player, Shop shop) {
public ShopEvent(ShopPlayer player, Shop shop) {
this.player = player;
this.shop = shop;
}
@ -37,7 +37,7 @@ public abstract class ShopEvent extends Event {
* @return the player
* @since 1.13
*/
public Player getPlayer() {
public ShopPlayer getPlayer() {
return player;
}

View File

@ -1,9 +1,9 @@
package de.epiceric.shopchest.api.event;
import de.epiceric.shopchest.api.player.ShopPlayer;
import de.epiceric.shopchest.api.shop.Shop;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
@ -15,7 +15,7 @@ public class ShopExtendEvent extends ShopEvent implements Cancellable {
private boolean cancelled;
private Location newChestLocation;
public ShopExtendEvent(Player player, Shop shop, Location newChest) {
public ShopExtendEvent(ShopPlayer player, Shop shop, Location newChest) {
super(player, shop);
this.newChestLocation = newChest;
}

View File

@ -1,7 +1,7 @@
package de.epiceric.shopchest.api.event;
import de.epiceric.shopchest.api.player.ShopPlayer;
import de.epiceric.shopchest.api.shop.Shop;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
@ -12,7 +12,7 @@ import org.bukkit.event.Cancellable;
public class ShopInfoEvent extends ShopEvent implements Cancellable {
private boolean cancelled;
public ShopInfoEvent(Player player, Shop shop) {
public ShopInfoEvent(ShopPlayer player, Shop shop) {
super(player, shop);
}

View File

@ -1,7 +1,7 @@
package de.epiceric.shopchest.api.event;
import de.epiceric.shopchest.api.player.ShopPlayer;
import de.epiceric.shopchest.api.shop.Shop;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
@ -12,7 +12,7 @@ import org.bukkit.event.Cancellable;
public class ShopOpenEvent extends ShopEvent implements Cancellable {
private boolean cancelled;
public ShopOpenEvent(Player player, Shop shop) {
public ShopOpenEvent(ShopPlayer player, Shop shop) {
super(player, shop);
}

View File

@ -1,11 +1,12 @@
package de.epiceric.shopchest.api.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import de.epiceric.shopchest.api.player.ShopPlayer;
/**
* Called when a player enters the command to create a shop
* <p>
@ -18,7 +19,7 @@ import org.bukkit.inventory.ItemStack;
public class ShopPreCreateEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player;
private ShopPlayer player;
private ItemStack itemStack;
private int amount;
private double buyPrice;
@ -26,7 +27,7 @@ public class ShopPreCreateEvent extends Event implements Cancellable {
private boolean admin;
private boolean cancelled;
public ShopPreCreateEvent(Player player, ItemStack itemStack, int amount, double buyPrice, double sellPrice, boolean admin) {
public ShopPreCreateEvent(ShopPlayer player, ItemStack itemStack, int amount, double buyPrice, double sellPrice, boolean admin) {
this.player = player;
this.itemStack = itemStack;
this.amount = amount;
@ -41,7 +42,7 @@ public class ShopPreCreateEvent extends Event implements Cancellable {
* @return the player
* @since 1.13
*/
public Player getPlayer() {
public ShopPlayer getPlayer() {
return player;
}

View File

@ -1,10 +1,11 @@
package de.epiceric.shopchest.api.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import de.epiceric.shopchest.api.player.ShopPlayer;
/**
* Called when a player enters the command to retrieve information about a shop
*
@ -13,10 +14,10 @@ import org.bukkit.event.HandlerList;
public class ShopPreInfoEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player;
private ShopPlayer player;
private boolean cancelled;
public ShopPreInfoEvent(Player player) {
public ShopPreInfoEvent(ShopPlayer player) {
this.player = player;
}
@ -26,7 +27,7 @@ public class ShopPreInfoEvent extends Event implements Cancellable {
* @return the player
* @since 1.13
*/
public Player getPlayer() {
public ShopPlayer getPlayer() {
return player;
}

View File

@ -1,10 +1,11 @@
package de.epiceric.shopchest.api.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import de.epiceric.shopchest.api.player.ShopPlayer;
/**
* Called when a player enters the command to open a shop
*
@ -13,10 +14,10 @@ import org.bukkit.event.HandlerList;
public class ShopPreOpenEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player;
private ShopPlayer player;
private boolean cancelled;
public ShopPreOpenEvent(Player player) {
public ShopPreOpenEvent(ShopPlayer player) {
this.player = player;
}
@ -26,7 +27,7 @@ public class ShopPreOpenEvent extends Event implements Cancellable {
* @return the player
* @since 1.13
*/
public Player getPlayer() {
public ShopPlayer getPlayer() {
return player;
}

View File

@ -1,10 +1,11 @@
package de.epiceric.shopchest.api.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import de.epiceric.shopchest.api.player.ShopPlayer;
/**
* Called when a player enters the command to remove a shop
*
@ -13,10 +14,10 @@ import org.bukkit.event.HandlerList;
public class ShopPreRemoveEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player;
private ShopPlayer player;
private boolean cancelled;
public ShopPreRemoveEvent(Player player) {
public ShopPreRemoveEvent(ShopPlayer player) {
this.player = player;
}
@ -26,7 +27,7 @@ public class ShopPreRemoveEvent extends Event implements Cancellable {
* @return the player
* @since 1.13
*/
public Player getPlayer() {
public ShopPlayer getPlayer() {
return player;
}

View File

@ -1,7 +1,7 @@
package de.epiceric.shopchest.api.event;
import de.epiceric.shopchest.api.player.ShopPlayer;
import de.epiceric.shopchest.api.shop.Shop;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
@ -12,7 +12,7 @@ import org.bukkit.event.Cancellable;
public class ShopRemoveEvent extends ShopEvent implements Cancellable {
private boolean cancelled;
public ShopRemoveEvent(Player player, Shop shop) {
public ShopRemoveEvent(ShopPlayer player, Shop shop) {
super(player, shop);
}

View File

@ -1,11 +1,12 @@
package de.epiceric.shopchest.api.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import de.epiceric.shopchest.api.player.ShopPlayer;
/**
* Called when a player has selected an item
*
@ -14,7 +15,7 @@ import org.bukkit.inventory.ItemStack;
public class ShopSelectItemEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player;
private ShopPlayer player;
private ItemStack item;
private int amount;
private double buyPrice;
@ -22,7 +23,7 @@ public class ShopSelectItemEvent extends Event implements Cancellable {
private boolean admin;
private boolean cancelled;
public ShopSelectItemEvent(Player player, ItemStack item, int amount, double buyPrice, double sellPrice, boolean admin) {
public ShopSelectItemEvent(ShopPlayer player, ItemStack item, int amount, double buyPrice, double sellPrice, boolean admin) {
this.player = player;
this.item = item == null ? null : item.clone();
this.amount = amount;
@ -37,7 +38,7 @@ public class ShopSelectItemEvent extends Event implements Cancellable {
* @return the player
* @since 1.13
*/
public Player getPlayer() {
public ShopPlayer getPlayer() {
return player;
}