Split project
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
package com.alttd.playershops;
|
||||
|
||||
import com.alttd.playershops.api.ShopHandler;
|
||||
import com.alttd.playershops.config.Config;
|
||||
import com.alttd.playershops.handler.ShopHandlerImpl;
|
||||
import com.alttd.playershops.listener.PlayerListener;
|
||||
import com.alttd.playershops.listener.ShopListener;
|
||||
import lombok.Getter;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class PlayerShops extends JavaPlugin {
|
||||
|
||||
@Getter
|
||||
private static PlayerShops instance;
|
||||
@Getter
|
||||
private Economy econ;
|
||||
@Getter
|
||||
private ShopHandler shopHandler;
|
||||
|
||||
private ShopListener shopListener;
|
||||
private PlayerListener playerListener;
|
||||
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
if(!setupEconomy()) {
|
||||
Bukkit.getLogger().warning("Error loading Vault and economy.\n Disabling plugin");
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
Bukkit.getLogger().info("Hooked into Vault economy provided by " + econ.getName());
|
||||
reloadConfigs();
|
||||
|
||||
registerListeners();
|
||||
registerCommands();
|
||||
|
||||
shopHandler = new ShopHandlerImpl(instance);
|
||||
}
|
||||
|
||||
private boolean setupEconomy() {
|
||||
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
return false;
|
||||
}
|
||||
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Economy getEconomy() {
|
||||
if(econ == null)
|
||||
setupEconomy();
|
||||
return econ;
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
shopListener = new ShopListener(this);
|
||||
playerListener = new PlayerListener(this);
|
||||
}
|
||||
|
||||
private void UnregisterListeners() {
|
||||
shopListener.unregister();
|
||||
playerListener.unregister();
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
// for(String command : this.getDescription().getCommands().keySet()) {
|
||||
// getCommand(command).setExecutor();
|
||||
// }
|
||||
}
|
||||
|
||||
public void reloadConfigs() {
|
||||
Config.reload();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.alttd.playershops.api;
|
||||
|
||||
import com.alttd.playershops.shop.ShopType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Shop { // TODO finish docs
|
||||
|
||||
String getOwnerName();
|
||||
|
||||
UUID getOwnerUUID();
|
||||
|
||||
ShopType getType();
|
||||
|
||||
Location getSignLocation();
|
||||
|
||||
Location getContainerLocation();
|
||||
|
||||
String getServer();
|
||||
|
||||
double getPrice();
|
||||
|
||||
void setPrice(double price);
|
||||
|
||||
int getAmount();
|
||||
|
||||
void setAmount(int amount);
|
||||
|
||||
double getBalance();
|
||||
|
||||
void setBalance(double balance);
|
||||
|
||||
ItemStack getItemStack();
|
||||
|
||||
void setItemStack(ItemStack itemStack);
|
||||
|
||||
ItemStack getSecondaryItem();
|
||||
|
||||
void setSecondaryItem(ItemStack itemStack);
|
||||
|
||||
boolean isInitialized();
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.alttd.playershops.api;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ShopHandler { // TODO finish docs
|
||||
|
||||
/**
|
||||
* Get the shop at a given location
|
||||
*
|
||||
* @param location Location of the shop
|
||||
* @return Shop at the given location or <b>null</b> if no shop is found there
|
||||
*/
|
||||
Shop getShop(Location location);
|
||||
|
||||
/**
|
||||
* Checks whether there is a shop at a given location
|
||||
* @param location Location to check
|
||||
* @return Whether there is a shop at the given location
|
||||
*/
|
||||
boolean isShop(Location location);
|
||||
|
||||
/**
|
||||
* Get a collection of all loaded shops
|
||||
*
|
||||
* This collection is safe to use for looping over and removing shops.
|
||||
*
|
||||
* @return Read-only collection of all shops
|
||||
*/
|
||||
Collection<Shop> getShops();
|
||||
|
||||
/**
|
||||
* Add a player's custom shop limit
|
||||
*
|
||||
* @param uuid The uuid linked to this player
|
||||
* @param limit The new maximum amount of shops this player can have
|
||||
*/
|
||||
void addPlayerLimit(UUID uuid, int limit);
|
||||
|
||||
/**
|
||||
* Get the maximum amount of shops this player is allowed to have
|
||||
*
|
||||
* @param uuid The uuid linked to this player
|
||||
* @return The limit of shops for this player
|
||||
*/
|
||||
int getShopLimit(UUID uuid);
|
||||
|
||||
/**
|
||||
* Checks wether this block is valid to be used as a shop
|
||||
*
|
||||
* @param block the block to check
|
||||
* @return true if this block can be a shop
|
||||
*/
|
||||
boolean isShopMaterial(Block block);
|
||||
|
||||
/**
|
||||
* Get all the shops owned by a player
|
||||
*
|
||||
* @param uuid The uuid linked to this player
|
||||
* @return List of shops this player owns
|
||||
*/
|
||||
List<Shop> getShops(UUID uuid);
|
||||
|
||||
ArrayList<Material> getShopMaterials();
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.alttd.playershops.config;
|
||||
|
||||
import com.alttd.galaxy.configuration.AbstractConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class Config extends AbstractConfiguration {
|
||||
|
||||
private Config() {
|
||||
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + "playershops"), "config");
|
||||
}
|
||||
|
||||
static Config config;
|
||||
static int version;
|
||||
|
||||
public static void reload() {
|
||||
config = new Config();
|
||||
|
||||
version = config.getInt("config-version", 1);
|
||||
config.set("config-version", 1);
|
||||
|
||||
config.readConfig(Config.class, null);
|
||||
}
|
||||
|
||||
public static int shopLimit = 100;
|
||||
public static boolean usePermissionShopLimit = false;
|
||||
private static void shopSettings() {
|
||||
String path = "shop-settings.";
|
||||
shopLimit = config.getInt(path + "player-shop-limit", shopLimit);
|
||||
usePermissionShopLimit = config.getBoolean(path + "use-permission-based-shop-limit", usePermissionShopLimit);
|
||||
}
|
||||
|
||||
public static String shopLimitPermission = "shop.buildlimit";
|
||||
private static void permissionSettings() {
|
||||
String path = "permission.";
|
||||
shopLimitPermission = config.getString(path + "build-limit", shopLimitPermission);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.alttd.playershops.config;
|
||||
|
||||
public class ShopTypeConfig {
|
||||
|
||||
private final String shopType;
|
||||
private final String configPath;
|
||||
private final String defaultPath;
|
||||
|
||||
public ShopTypeConfig(String shopType) {
|
||||
this.shopType = shopType;
|
||||
this.configPath = "shop.type." + this.shopType + ".";
|
||||
this.defaultPath = "shop.type.default.";
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Config.config.readConfig(ShopTypeConfig.class, this);
|
||||
}
|
||||
|
||||
private static void set(String path, Object def) {
|
||||
Config.config.set(path, def);
|
||||
}
|
||||
|
||||
private String getString(String path, String def) {
|
||||
set(defaultPath + path, def);
|
||||
return Config.config.getNode(configPath + path).getString(
|
||||
Config.config.getNode(defaultPath + path).getString(def));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.alttd.playershops.handler;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.api.Shop;
|
||||
import com.alttd.playershops.api.ShopHandler;
|
||||
import com.alttd.playershops.config.Config;
|
||||
import com.alttd.playershops.shop.AbstractShop;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ShopHandlerImpl implements ShopHandler {
|
||||
|
||||
private final PlayerShops plugin;
|
||||
@Getter
|
||||
private final Object2IntMap<UUID> shopBuildLimits;
|
||||
@Getter
|
||||
private final Map<Location, Shop> shopLocation;
|
||||
@Getter
|
||||
private final ArrayList<Material> shopMaterials;
|
||||
|
||||
public ShopHandlerImpl(PlayerShops instance) {
|
||||
plugin = instance;
|
||||
shopLocation = new ConcurrentHashMap<>();
|
||||
shopBuildLimits = new Object2IntOpenHashMap<>();
|
||||
shopBuildLimits.defaultReturnValue(Config.shopLimit);
|
||||
shopMaterials = new ArrayList<>(); // TODO move into parent method where materials are loaded in.
|
||||
}
|
||||
|
||||
public Shop getShop(Location location) {
|
||||
Location newLocation = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
|
||||
return shopLocation.get(newLocation);
|
||||
}
|
||||
|
||||
public boolean isShop(Location location) {
|
||||
return getShop(location) != null;
|
||||
}
|
||||
|
||||
public Collection<Shop> getShops() {
|
||||
return Collections.unmodifiableCollection(shopLocation.values());
|
||||
}
|
||||
|
||||
public void addPlayerLimit(UUID uuid, int limit) {
|
||||
shopBuildLimits.put(uuid, limit);
|
||||
}
|
||||
|
||||
public int getShopLimit(UUID uuid) {
|
||||
return shopBuildLimits.getInt(uuid);
|
||||
}
|
||||
|
||||
public void removeShops() {
|
||||
shopLocation.clear();
|
||||
}
|
||||
|
||||
public boolean isShopMaterial(Block block) {
|
||||
if (Tag.SHULKER_BOXES.isTagged(block.getType())) {
|
||||
return true;
|
||||
}
|
||||
return shopMaterials.contains(block.getType());
|
||||
}
|
||||
|
||||
public List<Shop> getShops(UUID uuid) {
|
||||
List<Shop> shops = new ArrayList<>();
|
||||
for (Shop shop : shopLocation.values()) {
|
||||
if (shop.getOwnerUUID().equals(uuid))
|
||||
shops.add(shop);
|
||||
}
|
||||
return shops;
|
||||
}
|
||||
|
||||
public Shop getShopBySignLocation(Location signLocation) {
|
||||
for (Shop shop : shopLocation.values()) {
|
||||
if (shop.getSignLocation().equals(signLocation))
|
||||
return shop;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Shop getShopNearBlock(Block block) {
|
||||
BlockFace[] faces = {BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST};
|
||||
for (BlockFace face : faces) {
|
||||
if (this.isShopMaterial(block.getRelative(face))) {
|
||||
Block blockRelative = block.getRelative(face);
|
||||
if (isShop(blockRelative.getLocation()))
|
||||
return getShop(blockRelative.getLocation());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.alttd.playershops.listener;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class EventListener implements Listener {
|
||||
protected boolean isRegistered = false;
|
||||
|
||||
public void register(JavaPlugin instance) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(this, instance);
|
||||
isRegistered = true;
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
HandlerList.unregisterAll(this);
|
||||
isRegistered = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.alttd.playershops.listener;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class InventoryListener extends EventListener {
|
||||
|
||||
protected final Inventory inventory;
|
||||
protected boolean cancelCloseUnregister = false;
|
||||
|
||||
public InventoryListener(Inventory inv) {
|
||||
this.inventory = inv;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void unregisterOnClose(InventoryCloseEvent event) {
|
||||
if (event.getView().getTopInventory().equals(inventory) && !cancelCloseUnregister) unregister();
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void unregisterOnLeaveEvent(PlayerQuitEvent event) {
|
||||
if ((inventory.getHolder() instanceof OfflinePlayer) && event.getPlayer().getUniqueId().equals(((OfflinePlayer) inventory.getHolder()).getUniqueId()))
|
||||
unregister();
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onInventoryDrag(InventoryDragEvent event) {
|
||||
if (event.getView().getTopInventory().equals(inventory)) for (int slot : event.getRawSlots()) if (slot < inventory.getSize()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.alttd.playershops.listener;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.api.Shop;
|
||||
import com.alttd.playershops.api.ShopHandler;
|
||||
import com.alttd.playershops.config.Config;
|
||||
import com.alttd.playershops.shop.AbstractShop;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerListener extends EventListener {
|
||||
|
||||
private final PlayerShops plugin;
|
||||
|
||||
public PlayerListener(PlayerShops plugin) {
|
||||
this.plugin = plugin;
|
||||
this.register(this.plugin);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!this.isRegistered || !Config.usePermissionShopLimit) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if (!player.hasPermission(Config.shopLimitPermission)) return;
|
||||
|
||||
ShopHandler shopHandler = plugin.getShopHandler();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
// early return to not check this all the time, if this changes by rankup etc handle it in another event
|
||||
if (shopHandler.getShopLimit(uuid) != Config.shopLimit) return;
|
||||
|
||||
int buildPermissionNumber = -1;
|
||||
|
||||
for (PermissionAttachmentInfo permInfo : player.getEffectivePermissions()) {
|
||||
if (permInfo.getPermission().contains("shop.buildlimit.")) {
|
||||
try {
|
||||
int tempNum = Integer.parseInt(permInfo.getPermission().substring(permInfo.getPermission().lastIndexOf(".") + 1));
|
||||
if (tempNum > buildPermissionNumber) {
|
||||
buildPermissionNumber = tempNum;
|
||||
}
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
}
|
||||
if (buildPermissionNumber == -1)
|
||||
shopHandler.addPlayerLimit(player.getUniqueId(), buildPermissionNumber);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (!(block.getState() instanceof Sign)) return;
|
||||
|
||||
Shop shop = plugin.getShopHandler().getShop(block.getLocation());
|
||||
if(shop == null) return;
|
||||
|
||||
if(shop.isInitialized()) event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.alttd.playershops.listener;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
|
||||
public class ShopListener extends EventListener {
|
||||
|
||||
private final PlayerShops plugin;
|
||||
|
||||
public ShopListener(PlayerShops plugin) {
|
||||
this.plugin = plugin;
|
||||
this.register(this.plugin);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
import com.alttd.playershops.api.Shop;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class AbstractShop implements Shop {
|
||||
|
||||
@Getter
|
||||
private int id;
|
||||
private String ownerName;
|
||||
@Getter
|
||||
private UUID ownerUUID;
|
||||
@Getter @Setter
|
||||
private ShopType type;
|
||||
@Getter
|
||||
private Location signLocation;
|
||||
@Getter
|
||||
private Location containerLocation;
|
||||
@Getter
|
||||
private String server;
|
||||
@Getter @Setter
|
||||
private double price;
|
||||
@Getter @Setter
|
||||
private int amount;
|
||||
@Getter @Setter
|
||||
private double balance;
|
||||
@Getter @Setter
|
||||
private ItemStack itemStack;
|
||||
@Getter @Setter
|
||||
private ItemStack secondaryItem;
|
||||
@Getter @Setter
|
||||
private long lastTransaction;
|
||||
|
||||
protected boolean initialized;
|
||||
|
||||
AbstractShop(Location signLocation, UUID uuid, double price, int amount) {
|
||||
this.signLocation = signLocation;
|
||||
if (signLocation != null) {
|
||||
Directional sign = (Directional) signLocation.getBlock().getState().getBlockData();
|
||||
this.containerLocation = signLocation.getBlock().getRelative(sign.getFacing().getOppositeFace()).getLocation();
|
||||
}
|
||||
this.ownerUUID = uuid;
|
||||
ownerName = getOwnerName();
|
||||
this.price = price;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public static AbstractShop create(Location signLocation, UUID player, double price, int amount, ShopType shopType) {
|
||||
return switch (shopType) {
|
||||
case SELL -> new SellShop(signLocation, player, price, amount);
|
||||
case BUY -> new BuyShop(signLocation, player, price, amount);
|
||||
case GAMBLE -> new GambleShop(signLocation, player, price, amount);
|
||||
case BARTER -> new BarterShop(signLocation, player, price, amount);
|
||||
};
|
||||
}
|
||||
|
||||
public String getOwnerName() {
|
||||
if(this.ownerName != null) return ownerName;
|
||||
if (this.getOwnerUUID() != null) {
|
||||
ownerName = Bukkit.getOfflinePlayer(this.getOwnerUUID()).getName();
|
||||
return ownerName;
|
||||
}
|
||||
return ChatColor.RED + "[CLOSED]";
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BarterShop extends AbstractShop {
|
||||
|
||||
public BarterShop(Location location, UUID player, double price, int amount) {
|
||||
super(location, player, price, amount);
|
||||
|
||||
this.setType(ShopType.BARTER);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BuyShop extends AbstractShop {
|
||||
|
||||
public BuyShop(Location location, UUID player, double price, int amount) {
|
||||
super(location, player, price, amount);
|
||||
|
||||
this.setType(ShopType.BUY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GambleShop extends AbstractShop {
|
||||
|
||||
private ItemStack gambleItem;
|
||||
|
||||
public GambleShop(Location location, UUID player, double price, int amount) {
|
||||
super(location, player, price, amount);
|
||||
|
||||
this.setType(ShopType.GAMBLE);
|
||||
this.gambleItem = this.getItemStack();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class SellShop extends AbstractShop {
|
||||
|
||||
public SellShop(Location location, UUID player, double price, int amount) {
|
||||
super(location, player, price, amount);
|
||||
|
||||
this.setType(ShopType.SELL);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
public class ShopTransaction {
|
||||
|
||||
public enum ShopTransactionError {
|
||||
CANCELLED,
|
||||
INSUFFICIENT_FUNDS_SHOP,
|
||||
INSUFFICIENT_FUNDS_PLAYER,
|
||||
INVENTORY_FULL_SHOP,
|
||||
INVENTORY_FULL_PLAYER,
|
||||
NONE;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
public enum ShopTransactionError {
|
||||
CANCELLED,
|
||||
INSUFFICIENT_FUNDS_SHOP,
|
||||
INSUFFICIENT_FUNDS_PLAYER,
|
||||
INVENTORY_FULL_SHOP,
|
||||
INVENTORY_FULL_PLAYER,
|
||||
NONE;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
import com.alttd.playershops.config.ShopTypeConfig;
|
||||
|
||||
public enum ShopType {
|
||||
|
||||
SELL,
|
||||
BUY,
|
||||
GAMBLE,
|
||||
BARTER;
|
||||
|
||||
private final ShopTypeConfig shopTypeConfig;
|
||||
|
||||
ShopType() {
|
||||
this.shopTypeConfig = new ShopTypeConfig(toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.alttd.playershops.utils;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Logger
|
||||
{
|
||||
|
||||
public static void info(String str) {
|
||||
log(Level.INFO,"&e" + str);
|
||||
}
|
||||
|
||||
public static void warn(String str) {
|
||||
log(Level.SEVERE,"&6" + str);
|
||||
}
|
||||
|
||||
public static void severe(String str) {
|
||||
log(Level.SEVERE,"&c" + str);
|
||||
}
|
||||
|
||||
public static void log(Level level, String str) {
|
||||
Bukkit.getLogger().log(level,
|
||||
ChatColor.translateAlternateColorCodes('&',
|
||||
"&r " + str));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user