mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-01 06:23:22 +01:00
7b6d7d59bd
- Added Bukkit Persistence Reimplemented by LennardF1989 - Made the plugin faster - Deleted unnecessary files (.jar size went down by 10 KB) - Added final and private keywords - Support for Bukkit's built-in permissions - Updated to newest Bukkit's standard (getFace -> getRelative)
38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
package com.Acrobot.ChestShop.Shop;
|
|
|
|
import com.Acrobot.ChestShop.Chests.MinecraftChest;
|
|
import com.Acrobot.ChestShop.Items.Items;
|
|
import com.Acrobot.ChestShop.Utils.uBlock;
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.block.Chest;
|
|
import org.bukkit.block.Sign;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class ShopManagement {
|
|
public static void buy(Sign sign, Player player) {
|
|
Chest chestMc = uBlock.findChest(sign);
|
|
ItemStack item = Items.getItemStack(sign.getLine(3));
|
|
if (item == null) {
|
|
player.sendMessage(ChatColor.RED + "[Shop] The item is not recognised!");
|
|
return;
|
|
}
|
|
Shop shop = new Shop(chestMc != null ? new MinecraftChest(chestMc) : null, true, sign, item);
|
|
shop.buy(player);
|
|
}
|
|
|
|
public static void sell(Sign sign, Player player) {
|
|
Chest chestMc = uBlock.findChest(sign);
|
|
ItemStack item = Items.getItemStack(sign.getLine(3));
|
|
if (item == null) {
|
|
player.sendMessage(ChatColor.RED + "[Shop] The item is not recognised!");
|
|
return;
|
|
}
|
|
Shop shop = new Shop(chestMc != null ? new MinecraftChest(chestMc) : null, false, sign, item);
|
|
shop.sell(player);
|
|
}
|
|
}
|