From 7ab25550b7f30dff45220aec40a6f6b2833e9127 Mon Sep 17 00:00:00 2001
From: tianyu <32282861@qq.com>
Date: Wed, 24 Jul 2024 07:42:23 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 38 +
pom.xml | 42 +
.../me/Demon/DemonSystemShop/Buy/BuyAPI.java | 69 ++
.../me/Demon/DemonSystemShop/Buy/BuyShop.java | 152 ++++
.../me/Demon/DemonSystemShop/Buy/ExpShop.java | 93 +++
.../DemonSystemShop/DayShop/BuyShopPro.java | 182 +++++
.../DemonSystemShop/DayShop/DayShopAPI.java | 41 +
.../java/me/Demon/DemonSystemShop/Main.java | 190 +++++
.../DemonSystemShop/Minion/MinionShop.java | 262 ++++++
.../Demon/DemonSystemShop/Sell/BlockShop.java | 108 +++
.../Demon/DemonSystemShop/Sell/MoneyShop.java | 133 +++
.../Demon/DemonSystemShop/Sell/SellAPI.java | 13 +
.../Demon/DemonSystemShop/Sell/SellShop.java | 147 ++++
.../DemonSystemShop/util/ItemNameUtil.java | 42 +
.../Demon/DemonSystemShop/util/SqlUtil.java | 108 +++
.../util/database/MegumiSQL.java | 15 +
.../util/database/SqlManager.java | 94 +++
src/main/resources/ItemName.yml | 769 ++++++++++++++++++
src/main/resources/Log.yml | 0
src/main/resources/config.yml | 1 +
src/main/resources/plugin.yml | 7 +
21 files changed, 2506 insertions(+)
create mode 100644 .gitignore
create mode 100644 pom.xml
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Buy/BuyAPI.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Buy/BuyShop.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Buy/ExpShop.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/DayShop/BuyShopPro.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/DayShop/DayShopAPI.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Main.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Minion/MinionShop.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Sell/BlockShop.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Sell/MoneyShop.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Sell/SellAPI.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/Sell/SellShop.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/util/ItemNameUtil.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/util/SqlUtil.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/util/database/MegumiSQL.java
create mode 100644 src/main/java/me/Demon/DemonSystemShop/util/database/SqlManager.java
create mode 100644 src/main/resources/ItemName.yml
create mode 100644 src/main/resources/Log.yml
create mode 100644 src/main/resources/config.yml
create mode 100644 src/main/resources/plugin.yml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ff6309
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..f93e60b
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,42 @@
+
+
+ 4.0.0
+
+ org.example
+ DemonSystemShop
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+ public-rpg
+ https://repo.aurora-pixels.com/repository/public-rpg/
+
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.12.2
+
+
+ me.Demon.DemonPlugin
+ DemonAPI
+ 1.2.0
+
+
+ cn.hamster3.cdapi
+ CDTimeAPI
+ 1.0
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/Demon/DemonSystemShop/Buy/BuyAPI.java b/src/main/java/me/Demon/DemonSystemShop/Buy/BuyAPI.java
new file mode 100644
index 0000000..7379821
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Buy/BuyAPI.java
@@ -0,0 +1,69 @@
+package me.Demon.DemonSystemShop.Buy;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Material;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+
+public class BuyAPI {
+
+ public static int getBuyPrice(int slot, int type) {
+ FileConfiguration yml = Main.plugin.getConfig();
+ if (type == 2) {
+ int price = yml.getInt("BuyShop." + slot + ".price");
+ return price * 27;
+ }
+ return yml.getInt("BuyShop." + slot + ".price");
+ }
+
+ public static int getInvAmount(Player p, ItemStack item) {
+ int amount = 0;
+ Inventory inv = p.getInventory();
+ Material material = item.getType();
+ for (int i = 0; i < 36; i++) {
+ ItemStack items = inv.getItem(i);
+ if (!DemonAPI.itemIsNull(items) && DemonAPI.itemIsLore(items)) {
+ Material inv_type = items.getType();
+ if (inv_type == material) {
+ amount = amount + items.getAmount();
+ }
+ }
+ }
+ return amount;
+ }
+
+ public static void SellItemEvent(Inventory inv, int playerAmount, ItemStack item, int sellAmount) {
+ int last = playerAmount - sellAmount;
+ for (int i = 0; i < 36; i++) {
+ ItemStack items = inv.getItem(i);
+ if (!DemonAPI.itemIsNull(items) && DemonAPI.itemIsLore(items)) {
+ Material inv_type = items.getType();
+ if (inv_type == item.getType()) {
+ inv.setItem(i, new ItemStack(Material.AIR));
+ }
+ }
+ }
+ if (last >= 1) {
+ ItemStack newItem = new ItemStack(item.getType());
+ newItem.setAmount(last);
+ inv.addItem(newItem);
+ }
+ }
+
+ // 获取商品收购总金额
+ public static int getBuyMoney(String playName, String type) {
+ FileConfiguration yml = Main.RdDataG;
+ return yml.getInt("Data." + playName + "." + type);
+ }
+
+ // 增加商品收购总金额
+ public static void addBuyMoney(String playName, String type, int money) {
+ FileConfiguration yml = Main.RdDataG;
+ int a = getBuyMoney(playName, type);
+ yml.set("Data." + playName + "." + type, (a + money));
+ Main.saveRdDataConfig();
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Buy/BuyShop.java b/src/main/java/me/Demon/DemonSystemShop/Buy/BuyShop.java
new file mode 100644
index 0000000..9749551
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Buy/BuyShop.java
@@ -0,0 +1,152 @@
+package me.Demon.DemonSystemShop.Buy;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class BuyShop implements Listener {
+
+ public static String invTitle = "战争领域 - 收购商店(VIP减税)";
+
+ @EventHandler
+ public void onclick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if (e.getView().getTitle().equalsIgnoreCase(invTitle)) {
+ e.setCancelled(true);
+ if ((e.getRawSlot() >= 0) && (e.getRawSlot() < e.getInventory().getSize() - 9)) {
+ ItemStack item = e.getCurrentItem();
+ if (!DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) {
+ if (e.getClick() == ClickType.LEFT) {
+ if (item.getType() == Material.CAKE) {
+ SellItemsEvant(p, item, 1, e.getRawSlot(), 1);
+ } else if (e.getCurrentItem().getType() == Material.EGG) {
+ SellItemsEvant(p, item, 16, e.getRawSlot(), 1);
+ } else {
+ SellItemsEvant(p, item, 64, e.getRawSlot(), 1);
+ }
+ }
+ if (e.getClick() == ClickType.RIGHT) {
+ if (item.getType() == Material.CAKE) {
+ SellItemsEvant(p, item, 27, e.getRawSlot(), 2);
+ } else if (e.getCurrentItem().getType() == Material.EGG) {
+ SellItemsEvant(p, item, 16 * 27, e.getRawSlot(), 2);
+ } else {
+ SellItemsEvant(p, item, 1728, e.getRawSlot(), 2);
+ }
+ }
+ }
+ }
+ if (e.getRawSlot() == 49) {
+ TabooMenuAPI.openMenu(p, "商城菜单", true);
+ }
+ }
+ }
+
+ public static void SellItemsEvant(Player p, ItemStack item, int sellAmount, int slot, int type) {
+ //检测玩家是否拥有这么多的物品出售
+ int PlayerAmount = BuyAPI.getInvAmount(p, item);
+ if (PlayerAmount < sellAmount) {
+ p.sendMessage(Main.prefix + "你没有足够的物品.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ BuyAPI.SellItemEvent(p.getInventory(), PlayerAmount, item, sellAmount);
+ int price = BuyAPI.getBuyPrice(slot, type);
+ double tax = 0.05;
+ if (p.hasPermission("vip2.use")) {
+ tax = 0.02;
+ } else if (p.hasPermission("vip1.use")) {
+ tax = 0.03;
+ }
+ price = (int) (price - (price * tax));
+ double taxMoney = price * tax;
+ DemonAPI.giveMoney(p, price);
+ p.updateInventory();
+ p.sendMessage(Main.prefix + "你获得了: §f$" + price + "金币 §6(纳税: " + new DecimalFormat("#.##").format(taxMoney) + "金币)");
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
+ if (item.getType() == Material.DIAMOND) {
+ if (type == 2) {
+ Bukkit.getConsoleSender().sendMessage("[商店-日志] 玩家" + p.getName() + "正在出售大量钻石.");
+ } else {
+ Bukkit.getConsoleSender().sendMessage("[商店-日志] 玩家" + p.getName() + "正在出售钻石.");
+ }
+ }
+ if (item.getType() == Material.DIAMOND) {
+ BuyAPI.addBuyMoney(p.getName(), "DIAMOND", price);
+ } else if (item.getType() == Material.CACTUS) {
+ BuyAPI.addBuyMoney(p.getName(), "CACTUS", price);
+ } else if (item.getType() == Material.WHEAT) {
+ BuyAPI.addBuyMoney(p.getName(), "WHEAT", price);
+ }
+ }
+
+ public static void OpenGui(Player p) {
+ Inventory inv = Bukkit.createInventory(null, 54, invTitle);
+ for (int i = 45; i < inv.getSize(); i++) {
+ inv.setItem(i, glass("§7[[§a▧▧§7]]", 7));
+ }
+ inv.setItem(48, glass("§7[[§a▧▧§7]]", 15));
+ inv.setItem(49, BackBook("§a返回菜单"));
+ inv.setItem(50, glass("§7[[§a▧▧§7]]", 15));
+ FileConfiguration yml = Main.plugin.getConfig();
+ if (yml.getString("BuyShop") != null) {
+ for (String slot_key : yml.getConfigurationSection("BuyShop").getKeys(false)) {
+ ItemStack item = yml.getItemStack("BuyShop." + slot_key + ".items");
+ int price = yml.getInt("BuyShop." + slot_key + ".price");
+ inv.setItem(Integer.parseInt(slot_key), shopitem(item, price));
+ }
+ }
+ p.openInventory(inv);
+ }
+
+ public static ItemStack glass(String name, int date) {
+ ItemStack item = new ItemStack(160, 1, (short) date);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack BackBook(String name) {
+ ItemStack item = new ItemStack(Material.BOOK);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack shopitem(ItemStack items, int money) {
+ ItemStack item = items.clone();
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §r" + DemonAPI.getItemName(item));
+ List lore = new ArrayList<>();
+ if (item.getType() == Material.CAKE) {
+ lore.add("§a§l★§7左键出售1个 §f| §7价格: " + money + "元");
+ lore.add("§a§l★§7右键出售27个 §f| §7价格: " + (money * 27) + "元");
+ } else if (item.getType() == Material.EGG) {
+ lore.add("§a§l★§7左键出售16个 §f| §7价格: " + money + "元");
+ lore.add("§a§l★§7右键出售27组 §f| §7价格: " + (money * 27) + "元");
+ } else {
+ lore.add("§a§l★§7左键出售64个 §f| §7价格: " + money + "元");
+ lore.add("§a§l★§7右键出售27组 §f| §7价格: " + (money * 27) + "元");
+ }
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Buy/ExpShop.java b/src/main/java/me/Demon/DemonSystemShop/Buy/ExpShop.java
new file mode 100644
index 0000000..0e2ab1f
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Buy/ExpShop.java
@@ -0,0 +1,93 @@
+package me.Demon.DemonSystemShop.Buy;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExpShop implements Listener {
+
+ public static String invTitle = "战争领域 - 经验出售";
+
+ @EventHandler
+ public void onclick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if (e.getView().getTitle().equalsIgnoreCase(invTitle)) {
+ e.setCancelled(true);
+ if (e.getRawSlot() == 0) {
+ BuyExpLevel(p, 100, 500);
+ }
+ if (e.getRawSlot() == 2) {
+ BuyExpLevel(p, 500, 2500);
+ }
+ if (e.getRawSlot() == 4) {
+ BuyExpLevel(p, 2000, 10000);
+ }
+ if (e.getRawSlot() == 8) {
+ TabooMenuAPI.openMenu(p, "商城菜单", true);
+ }
+ }
+ }
+
+ public void BuyExpLevel(Player p, int sell_exp, int money) {
+ int exp = (int) p.getTotalExperience();
+ if (exp < sell_exp) {
+ p.sendMessage(Main.prefix + "你没有足够的生存经验用于出售.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ int take_exp = -sell_exp;
+ p.giveExp(take_exp);
+ DemonAPI.giveMoney(p, money);
+ p.sendMessage(Main.prefix + "你获得了: §f$" + money + "金币");
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 2);
+ }
+
+ public static void OpenGui(Player p) {
+ Inventory inv = Bukkit.createInventory(null, 9, invTitle);
+ inv.setItem(0, shopitem(100, 500));
+ inv.setItem(2, shopitem(500, 2500));
+ inv.setItem(4, shopitem(2000, 10000));
+ inv.setItem(8, BackBook("§a返回菜单"));
+ p.openInventory(inv);
+ }
+
+ public static ItemStack glass(String name, int date) {
+ ItemStack item = new ItemStack(160, 1, (short) date);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack BackBook(String name) {
+ ItemStack item = new ItemStack(Material.BOOK);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack shopitem(int exp, int money) {
+ ItemStack item = new ItemStack(Material.EXP_BOTTLE);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7[§c出售§7] §f生存经验");
+ List lore = new ArrayList<>();
+ lore.add("§7§l★§7" + exp + "经验 = " + money + "元");
+ lore.add("§a§l✔§7点击出售");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/DayShop/BuyShopPro.java b/src/main/java/me/Demon/DemonSystemShop/DayShop/BuyShopPro.java
new file mode 100644
index 0000000..a109d60
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/DayShop/BuyShopPro.java
@@ -0,0 +1,182 @@
+package me.Demon.DemonSystemShop.DayShop;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Buy.BuyAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class BuyShopPro implements Listener {
+
+ public static String invTitle = "战争领域 - 每日特价商店(VIP减税)";
+
+ @EventHandler
+ public void onclick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if (e.getView().getTitle().equalsIgnoreCase(invTitle)) {
+ e.setCancelled(true);
+ if (e.getRawSlot() == 15) {
+ TabooMenuAPI.openMenu(p, "商城菜单", true);
+ }
+ if (e.getRawSlot() == 13) {
+ if (DemonAPI.hasPoints(p, 2)) {
+ DemonAPI.takePoints(p, 2);
+ DayShopAPI dataAPI = Main.dataAPI.get(p);
+ dataAPI.getDayRandomType();
+ String type = dataAPI.getType();
+ ItemStack item = new ItemStack(Material.valueOf(type));
+ String item_Name = DemonAPI.getItemName(item);
+ p.sendMessage(Main.prefix + "刷新成功!当前特价出售商品为: §e" + item_Name);
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 2);
+ BuyShopPro.OpenGui(p);
+ } else {
+ p.sendMessage(Main.prefix + "你需要§d2§f点券才能操作.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ }
+ }
+ if (e.getRawSlot() == 11) {
+ if (e.getClick() == ClickType.LEFT) {
+ if (e.getCurrentItem().getType() == Material.CAKE) {
+ SellItemsEvant(p, e.getCurrentItem(), 1, 1);
+ } else if (e.getCurrentItem().getType() == Material.EGG) {
+ SellItemsEvant(p, e.getCurrentItem(), 16, 1);
+ } else {
+ SellItemsEvant(p, e.getCurrentItem(), 64, 1);
+ }
+ }
+ if (e.getClick() == ClickType.RIGHT) {
+ if (e.getCurrentItem().getType() == Material.CAKE) {
+ SellItemsEvant(p, e.getCurrentItem(), 27, 2);
+ } else if (e.getCurrentItem().getType() == Material.EGG) {
+ SellItemsEvant(p, e.getCurrentItem(), 16 * 27, 2);
+ } else {
+ SellItemsEvant(p, e.getCurrentItem(), 1728, 2);
+ }
+ }
+ }
+ }
+ }
+
+ public static void SellItemsEvant(Player p, ItemStack item, int sellAmount, int type) {
+ //检测玩家是否拥有这么多的物品出售
+ int PlayerAmount = BuyAPI.getInvAmount(p, item);
+ if (PlayerAmount < sellAmount) {
+ p.sendMessage(Main.prefix + "你没有足够的物品.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ BuyAPI.SellItemEvent(p.getInventory(), PlayerAmount, item, sellAmount);
+ String type_Name = String.valueOf(item.getType());
+ int price = Main.BuyItemsMap.get(type_Name);
+ if (type == 2) {
+ price = price * 27;
+ }
+ double tax = 0.05;
+ if (p.hasPermission("vip2.use")) {
+ tax = 0.02;
+ } else if (p.hasPermission("vip1.use")) {
+ tax = 0.03;
+ }
+ price = (int) (price - (price * tax));
+ double taxMoney = price * tax;
+ DemonAPI.giveMoney(p, price);
+ p.sendMessage(Main.prefix + "你获得了: §f$" + new DecimalFormat(",###.##").format(price) + "金币 §6(纳税: " + new DecimalFormat("#.##").format(taxMoney) + "金币)");
+ p.updateInventory();
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 2);
+ if (item.getType() == Material.DIAMOND) {
+ BuyAPI.addBuyMoney(p.getName(), "DIAMOND", price);
+ } else if (item.getType() == Material.CACTUS) {
+ BuyAPI.addBuyMoney(p.getName(), "CACTUS", price);
+ } else if (item.getType() == Material.WHEAT) {
+ BuyAPI.addBuyMoney(p.getName(), "WHEAT", price);
+ }
+ }
+
+ public static void OpenGui(Player p) {
+ Inventory inv = Bukkit.createInventory(null, 27, invTitle);
+ inv.setItem(0, glass("§7[§6每日特价§7]", 15));
+ inv.setItem(8, glass("§7[§6每日特价§7]", 15));
+ inv.setItem(9, glass("§7[§6每日特价§7]", 15));
+ inv.setItem(17, glass("§7[§6每日特价§7]", 15));
+ inv.setItem(18, glass("§7[§6每日特价§7]", 15));
+ inv.setItem(26, glass("§7[§6每日特价§7]", 15));
+ inv.setItem(13, UpdateType());
+ inv.setItem(15, BackBook("§a返回菜单"));
+ // 获取玩家今日特价出售的商品
+ if (Main.dataAPI.get(p) == null) {
+ Main.dataAPI.put(p, new DayShopAPI(p));
+ }
+ DayShopAPI dataAPI = Main.dataAPI.get(p);
+ String type = dataAPI.getType();
+ Material material = Material.valueOf(type);
+ int price = Main.BuyItemsMap.get(type);
+ inv.setItem(11, shopitem(material, price));
+ p.openInventory(inv);
+ }
+
+
+ public static ItemStack glass(String name, int date) {
+ ItemStack item = new ItemStack(160, 1, (short) date);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack BackBook(String name) {
+ ItemStack item = new ItemStack(Material.BOOK);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack UpdateType() {
+ ItemStack item = new ItemStack(Material.LEVER);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§8« §a刷新商品 §8»");
+ List lore = new ArrayList<>();
+ lore.add("§c§l★§7点击刷新今日特价商品");
+ lore.add("§d§l★§7费用: §d2点券");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack shopitem(Material material, int money) {
+ ItemStack item = new ItemStack(material);
+ ItemMeta meta = item.getItemMeta();
+ String item_Name = DemonAPI.getItemName(item);
+ meta.setDisplayName("§a每日特价 §e" + item_Name);
+ List lore = new ArrayList<>();
+ lore.add("§b今日特价§7出售品是 §7" + item_Name);
+ lore.add("§7按下出售 §7" + item_Name);
+ lore.add(" ");
+ if (item.getType() == Material.CAKE) {
+ lore.add("§a§l★§7左键出售1个 §f| §7价格: " + money + "元");
+ lore.add("§a§l★§7右键出售27个 §f| §7价格: " + (money * 27) + "元");
+ } else if (item.getType() == Material.EGG) {
+ lore.add("§a§l★§7左键出售16个 §f| §7价格: " + money + "元");
+ lore.add("§a§l★§7右键出售27组 §f| §7价格: " + (money * 27) + "元");
+ } else {
+ lore.add("§a§l★§7左键出售64个 §f| §7价格: " + money + "元");
+ lore.add("§a§l★§7右键出售27组 §f| §7价格: " + (money * 27) + "元");
+ }
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/DayShop/DayShopAPI.java b/src/main/java/me/Demon/DemonSystemShop/DayShop/DayShopAPI.java
new file mode 100644
index 0000000..373d7ca
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/DayShop/DayShopAPI.java
@@ -0,0 +1,41 @@
+package me.Demon.DemonSystemShop.DayShop;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Main;
+import me.Demon.DemonSystemShop.util.database.SqlManager;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DayShopAPI {
+
+ private final Player p;
+
+ private String type;
+
+ public DayShopAPI(Player p) {
+ this.p = p;
+ SqlManager sqlManager = Main.plugin.getSqlManager();
+ String sqlType = sqlManager.getPlayerData(p);
+ if (sqlType == null) {
+ sqlManager.createPlayerTableData(p);
+ sqlType = sqlManager.getPlayerData(p);
+ }
+ this.type = sqlType;
+ }
+
+ public String getType() {
+ if (Main.BuyItemsMap.get(this.type) == null) {
+ return "COBBLESTONE";
+ }
+ return this.type;
+ }
+
+ public void getDayRandomType() {
+ List list = new ArrayList<>(Main.BuyItemsList);
+ int suijishu = (DemonAPI.getRandomInt(list.size(), 1) - 1);
+ this.type = list.get(suijishu);
+ Main.plugin.getSqlManager().SavePlayerData(p, type);
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Main.java b/src/main/java/me/Demon/DemonSystemShop/Main.java
new file mode 100644
index 0000000..dab0382
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Main.java
@@ -0,0 +1,190 @@
+package me.Demon.DemonSystemShop;
+
+import me.Demon.DemonMySql;
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Buy.BuyShop;
+import me.Demon.DemonSystemShop.Buy.ExpShop;
+import me.Demon.DemonSystemShop.DayShop.BuyShopPro;
+import me.Demon.DemonSystemShop.DayShop.DayShopAPI;
+import me.Demon.DemonSystemShop.Minion.MinionShop;
+import me.Demon.DemonSystemShop.Sell.BlockShop;
+import me.Demon.DemonSystemShop.Sell.MoneyShop;
+import me.Demon.DemonSystemShop.Sell.SellShop;
+import me.Demon.DemonSystemShop.util.ItemNameUtil;
+import me.Demon.DemonSystemShop.util.SqlUtil;
+import me.Demon.DemonSystemShop.util.database.SqlManager;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class Main extends JavaPlugin {
+
+ public static String pluginName = "系统商店";
+ private SqlUtil sqlUtil;
+ private SqlManager sqlManager;
+ public static Main plugin;
+ public static boolean isJetsMinions = false;
+ public static String prefix = "§7[§6战争领域§7] §f";
+
+ public static HashMap BuyItemsMap = new HashMap<>();
+ public static List BuyItemsList = new ArrayList<>();
+ public static File ReDatafile = new File("plugins/DemonSystemShop", "Log.yml");
+ public static FileConfiguration RdDataG = YamlConfiguration.loadConfiguration(ReDatafile);
+
+ public static void saveRdDataConfig() {
+ try {
+ RdDataG.save(ReDatafile);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static HashMap dataAPI = new HashMap<>();
+
+ public SqlUtil getSqlUtil() {
+ return sqlUtil;
+ }
+
+ public SqlManager getSqlManager() {
+ return sqlManager;
+ }
+
+ @Override
+ public void onEnable() {
+ plugin = this;
+ saveDefaultConfig();
+ ItemNameUtil.inits(plugin);
+ Plugin JetsMinions = Bukkit.getPluginManager().getPlugin("JetsMinions");
+ if (JetsMinions != null) {
+ isJetsMinions = true;
+ }
+ Bukkit.getServer().getPluginManager().registerEvents(new MinionShop(), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new BuyShop(), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new SellShop(), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new BuyShopPro(), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new BlockShop(), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new MoneyShop(), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new ExpShop(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§e[系统商城] §r正在启动插件...");
+ // 数据库配置
+ sqlManager = new SqlManager(this);
+ String SQL_Host = DemonMySql.SQL_Host;
+ String SQL_Port = DemonMySql.SQL_Port;
+ String SQL_Database = DemonMySql.SQL_Database;
+ String SQL_Users = DemonMySql.SQL_Users;
+ String SQL_Password = DemonMySql.SQL_Password;
+ sqlUtil = new SqlUtil(this, SQL_Host, SQL_Port, SQL_Database, SQL_Users, SQL_Password);
+ sqlManager.createTable();
+ loadBuyItemsMap();
+ // 数据库配置
+ for (Player p : Bukkit.getOnlinePlayers()) {
+ if (Main.dataAPI.get(p) == null) {
+ Main.dataAPI.put(p, new DayShopAPI(p));
+ }
+ }
+ }
+
+ public void loadBuyItemsMap() {
+ FileConfiguration yml = Main.plugin.getConfig();
+ for (String slot_key : yml.getConfigurationSection("BuyShop").getKeys(false)) {
+ ItemStack item = yml.getItemStack("BuyShop." + slot_key + ".items");
+ int price = (int) (yml.getInt("BuyShop." + slot_key + ".price") * 1.3);
+ String type = String.valueOf(item.getType());
+ BuyItemsMap.put(type, price);
+ BuyItemsList.add(type);
+ }
+ }
+
+ @Override
+ public void onDisable() {
+ getSqlUtil().closeConnection();
+ Bukkit.getConsoleSender().sendMessage("§e[系统商城] §r正在关闭插件...");
+ }
+
+ public boolean onCommand(CommandSender sender, Command cmd, String Command, String[] args) {
+ if (Command.equalsIgnoreCase("systemshop")) {
+ if (args.length == 1 && args[0].equalsIgnoreCase("buyshop")) {
+ BuyShop.OpenGui((Player) sender);
+ }
+ if (args.length == 2 && args[0].equalsIgnoreCase("buyshop")) {
+ Player player = Bukkit.getPlayer(args[1]);
+ if (player != null) {
+ BuyShop.OpenGui(player);
+ }
+ }
+ if (args.length == 1 && args[0].equalsIgnoreCase("jiqiren")) {
+ MinionShop.OpenGui((Player) sender);
+ }
+ if (args.length == 2 && args[0].equalsIgnoreCase("jiqiren")) {
+ Player player = Bukkit.getPlayer(args[1]);
+ if (player != null) {
+ MinionShop.OpenGui(player);
+ }
+ }
+ if (args.length == 1 && args[0].equalsIgnoreCase("sellshop")) {
+ SellShop.OpenGui((Player) sender);
+ }
+ if (args.length == 2 && args[0].equalsIgnoreCase("sellshop")) {
+ Player player = Bukkit.getPlayer(args[1]);
+ if (player != null) {
+ SellShop.OpenGui(player);
+ }
+ }
+ if (args.length == 1 && args[0].equalsIgnoreCase("dayshop")) {
+ BuyShopPro.OpenGui((Player) sender);
+ }
+ if (args.length == 2 && args[0].equalsIgnoreCase("dayshop")) {
+ Player player = Bukkit.getPlayer(args[1]);
+ if (player != null) {
+ BuyShopPro.OpenGui(player);
+ }
+ }
+ if (args.length == 1 && args[0].equalsIgnoreCase("blockshop")) {
+ BlockShop.OpenGui((Player) sender);
+ }
+ if (args.length == 2 && args[0].equalsIgnoreCase("blockshop")) {
+ Player player = Bukkit.getPlayer(args[1]);
+ if (player != null) {
+ BlockShop.OpenGui(player);
+ }
+ }
+ if (args.length == 1 && args[0].equalsIgnoreCase("moneyshop")) {
+ MoneyShop.OpenGui((Player) sender);
+ }
+ if (args.length == 2 && args[0].equalsIgnoreCase("moneyshop")) {
+ Player player = Bukkit.getPlayer(args[1]);
+ if (player != null) {
+ MoneyShop.OpenGui(player);
+ }
+ }
+ if (args.length == 1 && args[0].equalsIgnoreCase("expshop")) {
+ ExpShop.OpenGui((Player) sender);
+ }
+ if (args.length == 2 && args[0].equalsIgnoreCase("expshop")) {
+ Player player = Bukkit.getPlayer(args[1]);
+ if (player != null) {
+ ExpShop.OpenGui(player);
+ }
+ }
+ }
+ return false;
+ }
+
+ public static String getDayRandomType() {
+ List list = new ArrayList<>(Main.BuyItemsList);
+ int suijishu = (DemonAPI.getRandomInt(list.size(), 1) - 1);
+ return list.get(suijishu);
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Minion/MinionShop.java b/src/main/java/me/Demon/DemonSystemShop/Minion/MinionShop.java
new file mode 100644
index 0000000..c4c037d
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Minion/MinionShop.java
@@ -0,0 +1,262 @@
+package me.Demon.DemonSystemShop.Minion;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MinionShop implements Listener {
+
+ public static String invTitle = "战争领域 - 小管家专卖店";
+
+ @EventHandler
+ public void onclick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if (e.getView().getTitle().equalsIgnoreCase(invTitle)) {
+ e.setCancelled(true);
+ if (e.getRawSlot() == 1) {
+ String minion_type = "Miner";
+ BuyEvent(p, minion_type, e.getCurrentItem());
+ }
+ if (e.getRawSlot() == 3) {
+ String minion_type = "Lumberjack";
+ BuyEvent(p, minion_type, e.getCurrentItem());
+ }
+ if (e.getRawSlot() == 5) {
+ String minion_type = "Farmer";
+ BuyEvent(p, minion_type, e.getCurrentItem());
+ }
+ if (e.getRawSlot() == 7) {
+ String minion_type = "Fisher";
+ BuyEvent(p, minion_type, e.getCurrentItem());
+ }
+ if (e.getRawSlot() == 11) {
+ String minion_type = "Collector";
+ BuyEvent(p, minion_type, e.getCurrentItem());
+ }
+ if (e.getRawSlot() == 13) {
+ String minion_type = "Slayer";
+ BuyEvent(p, minion_type, e.getCurrentItem());
+ }
+ if (e.getRawSlot() == 15) {
+ String minion_type = "Feeder";
+ BuyEvent(p, minion_type, e.getCurrentItem());
+ }
+ if (e.getRawSlot() == 31) {
+ TabooMenuAPI.openMenu(p, "商城菜单", true);
+ }
+ }
+ }
+
+ public static void BuyEvent(Player p, String minion_type, ItemStack items) {
+ int price = 100000;
+ if (!DemonAPI.hasMoney(p, price)) {
+ p.sendMessage(Main.prefix + "你需要§6" + new DecimalFormat(",###.##").format(price) + "§f金币才能操作.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ if (!Main.isJetsMinions) {
+ p.sendMessage(Main.prefix + "您需要进入岛屿服后才能购买...");
+ return;
+ }
+ MinionProperties minionProperties = Core.getInstance().getMinionManager().getMinionProperties(minion_type);
+ if (minionProperties == null) {
+ p.sendMessage(Main.prefix + "这个机器人貌似不存在,请联系管理员进行修复.");
+ return;
+ }
+ // 扣除金币
+ DemonAPI.takeMoney(p, price);
+ // 给玩家发货
+ Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "jetsminion give " + p.getName() + " " + minion_type + " 1");
+ ItemMeta meta = items.getItemMeta();
+ p.sendMessage(Main.prefix + "你获得了: §f" + meta.getDisplayName().replace("§7物品: ", ""));
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 2);
+ }
+
+ public static void OpenGui(Player p) {
+ Inventory inv = Bukkit.createInventory(null, 36, invTitle);
+ for (int i = 27; i < inv.getSize(); i++) {
+ inv.setItem(i, glass("§7[[§a▧▧§7]]", 7));
+ }
+ inv.setItem(30, glass("§7[[§a▧▧§7]]", 15));
+ inv.setItem(31, BackBook("§a返回菜单"));
+ inv.setItem(32, glass("§7[[§a▧▧§7]]", 15));
+ inv.setItem(1, Miner());
+ inv.setItem(3, Lumberjack());
+ inv.setItem(5, Farmer());
+ inv.setItem(7, Fisher());
+ inv.setItem(11, Collector());
+ inv.setItem(13, Slayer());
+ inv.setItem(15, Feeder());
+ p.openInventory(inv);
+ }
+
+ public static ItemStack glass(String name, int date) {
+ ItemStack item = new ItemStack(160, 1, (short) date);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack BackBook(String name) {
+ ItemStack item = new ItemStack(Material.SHEARS);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack Miner() {
+ ItemStack item = new ItemStack(Material.DIAMOND_PICKAXE);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §6矿工小管家");
+ List lore = new ArrayList<>();
+ lore.add("§b§l★§f管家用途§7: ");
+ lore.add("§7- §9自动破坏正前方的方块");
+ lore.add("§b§l★§f升级效果§7: ");
+ lore.add("§7- §9增加破坏距离");
+ lore.add(" ");
+ lore.add("§e§l★§7价格: §6" + new DecimalFormat(",###").format(100000) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack Lumberjack() {
+ ItemStack item = new ItemStack(Material.IRON_AXE);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §6伐木小管家");
+ List lore = new ArrayList<>();
+ lore.add("§b§l★§f管家用途§7: ");
+ lore.add("§7- §9自动砍伐周围的原木");
+ lore.add("§b§l★§f升级效果§7: ");
+ lore.add("§7- §9增加砍伐范围");
+ lore.add(" ");
+ lore.add("§e§l★§7价格: §6" + new DecimalFormat(",###").format(100000) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack Farmer() {
+ ItemStack item = new ItemStack(Material.GOLD_HOE);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §6种植小管家");
+ List lore = new ArrayList<>();
+ lore.add("§b§l★§f管家用途§7: ");
+ lore.add("§7- §9自动开垦和收获周围农作物");
+ lore.add("§b§l★§f升级效果§7: ");
+ lore.add("§7- §9增加开垦和收获作物范围");
+ lore.add(" ");
+ lore.add("§e§l★§7价格: §6" + new DecimalFormat(",###").format(100000) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack Fisher() {
+ ItemStack item = new ItemStack(Material.RAW_FISH);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §6渔夫小管家");
+ List lore = new ArrayList<>();
+ lore.add("§b§l★§f管家用途§7: ");
+ lore.add("§7- §9自动在周围水域捕鱼");
+ lore.add("§b§l★§f升级效果§7: ");
+ lore.add("§7- §9增加捕鱼范围");
+ lore.add(" ");
+ lore.add("§e§l★§7价格: §6" + new DecimalFormat(",###").format(100000) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack Collector() {
+ ItemStack item = new ItemStack(Material.COMPASS);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §6清道夫小管家");
+ List lore = new ArrayList<>();
+ lore.add("§b§l★§f管家用途§7: ");
+ lore.add("§7- §9自动收集周围掉落物");
+ lore.add("§b§l★§f升级效果§7: ");
+ lore.add("§7- §9增加收集范围");
+ lore.add(" ");
+ lore.add("§e§l★§7价格: §6" + new DecimalFormat(",###").format(100000) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack Slayer() {
+ ItemStack item = new ItemStack(Material.IRON_SWORD);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §6杀手小管家");
+ List lore = new ArrayList<>();
+ lore.add("§b§l★§f管家用途§7: ");
+ lore.add("§7- §9自动击杀周围生物");
+ lore.add("§b§l★§f升级效果§7: ");
+ lore.add("§7- §9增加击杀范围");
+ lore.add(" ");
+ lore.add("§e§l★§7价格: §6" + new DecimalFormat(",###").format(100000) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack Feeder() {
+ ItemStack item = new ItemStack(Material.GOLDEN_APPLE);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §6充能小管家");
+ List lore = new ArrayList<>();
+ lore.add("§b§l★§f管家用途§7: ");
+ lore.add("§7- §9自动为周围其他小管家充能");
+ lore.add("§b§l★§f升级效果§7: ");
+ lore.add("§7- §9增加充能范围");
+ lore.add(" ");
+ lore.add("§e§l★§7价格: §6" + new DecimalFormat(",###").format(100000) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack shopitem(ItemStack items, int price) {
+ ItemStack item = items;
+ item.setAmount(1);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §r" + DemonAPI.getItemName(item));
+ List lore = new ArrayList<>();
+ lore.add("§7价格: " + new DecimalFormat(",###.##").format(price) + "金币");
+ lore.add("§7数量: 1280个(20组)");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Sell/BlockShop.java b/src/main/java/me/Demon/DemonSystemShop/Sell/BlockShop.java
new file mode 100644
index 0000000..f2d6cb0
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Sell/BlockShop.java
@@ -0,0 +1,108 @@
+package me.Demon.DemonSystemShop.Sell;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class BlockShop implements Listener {
+ public static String invTitle = "战争领域 - 大量购买矿物块";
+
+ @EventHandler
+ public void onclick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if (e.getView().getTitle().equalsIgnoreCase(invTitle)) {
+ e.setCancelled(true);
+ if ((e.getRawSlot() >= 0) && (e.getRawSlot() < e.getInventory().getSize() - 9)) {
+ int price = -1;
+ if (e.getRawSlot() == 0) {
+ price = 576000;
+ } else if (e.getRawSlot() == 1) {
+ price = 806400;
+ } else if (e.getRawSlot() == 2) {
+ price = 2304000;
+ } else if (e.getRawSlot() == 3) {
+ price = 3456000;
+ }
+ if (price <= 0) {
+ return;
+ }
+ if (!DemonAPI.hasMoney(p, price)) {
+ p.sendMessage(Main.prefix + "你需要§6" + new DecimalFormat(",###.##").format(price) + "§f金币才能操作.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ // 扣除金币
+ DemonAPI.takeMoney(p, price);
+ // 获取玩家购买物品
+ ItemStack item = e.getCurrentItem();
+ ItemStack shop_item = new ItemStack(item.getType());
+ int amount = 1280;
+ shop_item.setAmount(amount);
+ p.getInventory().addItem(shop_item);
+ p.sendMessage(Main.prefix + "你获得了: §f" + DemonAPI.getItemName(shop_item) + "§7x§f" + amount);
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 2);
+ }
+ if (e.getRawSlot() == 31) {
+ TabooMenuAPI.openMenu(p, "商城菜单", true);
+ }
+ }
+ }
+
+ public static void OpenGui(Player p) {
+ Inventory inv = Bukkit.createInventory(null, 36, invTitle);
+ for (int i = 27; i < inv.getSize(); i++) {
+ inv.setItem(i, glass("§7[[§a▧▧§7]]", 7));
+ }
+ inv.setItem(30, glass("§7[[§a▧▧§7]]", 15));
+ inv.setItem(31, BackBook("§a返回菜单"));
+ inv.setItem(32, glass("§7[[§a▧▧§7]]", 15));
+ inv.setItem(0, shopitem(new ItemStack(Material.IRON_BLOCK), 576000));
+ inv.setItem(1, shopitem(new ItemStack(Material.GOLD_BLOCK), 806400));
+ inv.setItem(2, shopitem(new ItemStack(Material.DIAMOND_BLOCK), 2304000));
+ inv.setItem(3, shopitem(new ItemStack(Material.EMERALD_BLOCK), 3456000));
+ p.openInventory(inv);
+ }
+
+ public static ItemStack glass(String name, int date) {
+ ItemStack item = new ItemStack(160, 1, (short) date);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack BackBook(String name) {
+ ItemStack item = new ItemStack(Material.BOOK);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack shopitem(ItemStack items, int price) {
+ ItemStack item = items;
+ item.setAmount(1);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7物品: §r" + DemonAPI.getItemName(item));
+ List lore = new ArrayList<>();
+ lore.add("§7价格: " + new DecimalFormat(",###.##").format(price) + "金币");
+ lore.add("§7数量: 1280个(20组)");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Sell/MoneyShop.java b/src/main/java/me/Demon/DemonSystemShop/Sell/MoneyShop.java
new file mode 100644
index 0000000..f447bd6
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Sell/MoneyShop.java
@@ -0,0 +1,133 @@
+package me.Demon.DemonSystemShop.Sell;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Buy.BuyAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyShop implements Listener {
+ public static String invTitle = "战争领域 - 现金兑换";
+
+ @EventHandler
+ public void onclick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if (e.getView().getTitle().equalsIgnoreCase(invTitle)) {
+ e.setCancelled(true);
+ if ((e.getRawSlot() >= 0) && (e.getRawSlot() < e.getInventory().getSize() - 9)) {
+ if (e.getRawSlot() == 1) {
+ BuyMoneyPaper(p, 100, "现金券_100");
+ }
+ if (e.getRawSlot() == 3) {
+ BuyMoneyPaper(p, 500, "现金券_500");
+ }
+ if (e.getRawSlot() == 5) {
+ BuyMoneyPaper(p, 1000, "现金券_1000");
+ }
+ if (e.getRawSlot() == 7) {
+ BuyMoneyPaper(p, 5000, "现金券_5000");
+ }
+ if (e.getRawSlot() == 9) {
+ BuyMoneyPaper(p, 10000, "现金券_1W");
+ }
+ if (e.getRawSlot() == 11) {
+ BuyMoneyPaper(p, 50000, "现金券_5W");
+ }
+ if (e.getRawSlot() == 13) {
+ BuyMoneyPaper(p, 100000, "现金券_10W");
+ }
+ if (e.getRawSlot() == 15) {
+ BuyMoneyPaper(p, 500000, "现金券_50W");
+ }
+ if (e.getRawSlot() == 17) {
+ BuyMoneyPaper(p, 1000000, "现金券_100W");
+ }
+ }
+ if (e.getRawSlot() == 31) {
+ TabooMenuAPI.openMenu(p, "商城菜单", true);
+ }
+ }
+ }
+
+ public void BuyMoneyPaper(Player p, int money, String item_Key) {
+ int price = (int) (money * 1.05);
+ if (!DemonAPI.hasMoney(p, price)) {
+ p.sendMessage(Main.prefix + "你需要§6" + new DecimalFormat(",###.##").format(price) + "§f金币才能操作.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ // 扣除金币
+ DemonAPI.takeMoney(p, price);
+ // 获取玩家购买物品
+ ItemStack item = ItemKuAPI.getItems(p, item_Key, 1);
+ p.getInventory().addItem(item);
+ p.sendMessage(Main.prefix + "你获得了: §f" + DemonAPI.getItemName(item));
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 2);
+ if (price >= 50000) {
+ BuyAPI.addBuyMoney(p.getName(), item_Key, 1);
+ }
+ }
+
+ public static void OpenGui(Player p) {
+ Inventory inv = Bukkit.createInventory(null, 36, invTitle);
+ for (int i = 27; i < inv.getSize(); i++) {
+ inv.setItem(i, glass("§7[[§a▧▧§7]]", 7));
+ }
+ inv.setItem(30, glass("§7[[§a▧▧§7]]", 15));
+ inv.setItem(31, BackBook("§a返回菜单"));
+ inv.setItem(32, glass("§7[[§a▧▧§7]]", 15));
+ inv.setItem(1, shopitem("§e现金券 §7[§6100§7]", 100));
+ inv.setItem(3, shopitem("§e现金券 §7[§6500§7]", 500));
+ inv.setItem(5, shopitem("§e现金券 §7[§61000§7]", 1000));
+ inv.setItem(7, shopitem("§e现金券 §7[§65000§7]", 5000));
+
+ inv.setItem(9, shopitem("§e现金券 §7[§610000§7]", 10000));
+ inv.setItem(11, shopitem("§e现金券 §7[§650000§7]", 50000));
+ inv.setItem(13, shopitem("§e现金券 §7[§b10W§7]", 100000));
+ inv.setItem(15, shopitem("§e现金券 §7[§b50W§7]", 500000));
+ inv.setItem(17, shopitem("§e现金券 §7[§b100W§7]", 1000000));
+ p.openInventory(inv);
+ }
+
+ public static ItemStack glass(String name, int date) {
+ ItemStack item = new ItemStack(160, 1, (short) date);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack BackBook(String name) {
+ ItemStack item = new ItemStack(Material.BOOK);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName(name);
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack shopitem(String name, int money) {
+ ItemStack item = new ItemStack(Material.PAPER);
+ item.setAmount(1);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§7[§a购买§7] §r" + name);
+ List lore = new ArrayList<>();
+ int price = (int) (money * 1.05);
+ lore.add("§7价格: " + new DecimalFormat(",###.##").format(price) + "金币");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Sell/SellAPI.java b/src/main/java/me/Demon/DemonSystemShop/Sell/SellAPI.java
new file mode 100644
index 0000000..6804389
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Sell/SellAPI.java
@@ -0,0 +1,13 @@
+package me.Demon.DemonSystemShop.Sell;
+
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.configuration.file.FileConfiguration;
+
+public abstract class SellAPI {
+
+ public static int getSellPrice(int slot) {
+ FileConfiguration yml = Main.plugin.getConfig();
+ return yml.getInt("SellShop." + slot + ".price");
+ }
+
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/Sell/SellShop.java b/src/main/java/me/Demon/DemonSystemShop/Sell/SellShop.java
new file mode 100644
index 0000000..db10841
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/Sell/SellShop.java
@@ -0,0 +1,147 @@
+package me.Demon.DemonSystemShop.Sell;
+
+import cn.hamster3.cdapi.CDTimeAPI;
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonSystemShop.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SellShop implements Listener {
+
+ public static String invTitle = "战争领域 - 出售商店";
+
+ @EventHandler
+ public void onclick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if(e.getView().getTitle().equalsIgnoreCase(invTitle)) {
+ e.setCancelled(true);
+ if ((e.getRawSlot() >= 0) && (e.getRawSlot() < e.getInventory().getSize() - 9)) {
+ ItemStack item = e.getCurrentItem();
+ if(!DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)){
+ FileConfiguration yml = Main.plugin.getConfig();
+ if (e.getClick() == ClickType.LEFT) {
+ int price = SellAPI.getSellPrice(e.getRawSlot());
+ ItemStack shop_item = yml.getItemStack("SellShop."+e.getRawSlot()+".items").clone();
+ SellItemEvent(p,shop_item,price,1);
+ }
+ if (e.getClick() == ClickType.RIGHT) {
+ int price = SellAPI.getSellPrice(e.getRawSlot());
+ ItemStack shop_item = yml.getItemStack("SellShop."+e.getRawSlot()+".items").clone();
+ SellItemEvent(p,shop_item,price,16);
+ }
+ if (e.getClick() == ClickType.MIDDLE) {
+ int price = SellAPI.getSellPrice(e.getRawSlot());
+ ItemStack shop_item = yml.getItemStack("SellShop."+e.getRawSlot()+".items").clone();
+ SellItemEvent(p,shop_item,price,64);
+ }
+ }
+ }
+ if(e.getRawSlot() == 49){
+ TabooMenuAPI.openMenu(p,"商城菜单",true);
+ }
+ }
+ }
+
+ public static void SellItemEvent(Player p,ItemStack shop_item,int price,int amount){
+ if(CDTimeAPI.getCD(p.getUniqueId(),"sellshop_cd") >= 0){
+ p.sendMessage(Main.prefix+"请勿频繁进行此操作.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ int new_price = price * amount;
+ if(!DemonAPI.hasMoney(p,new_price)){
+ p.sendMessage(Main.prefix+"你需要§6"+new DecimalFormat(",###.##").format(new_price)+"§f金币才能操作.");
+ p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
+ return;
+ }
+ CDTimeAPI.setPlayerCD(p.getUniqueId(),"sellshop_cd",1000*3);
+ // 扣除金币
+ DemonAPI.takeMoney(p,new_price);
+ // 获取玩家购买物品
+ shop_item.setAmount(amount);
+ p.getInventory().addItem(shop_item);
+ if(shop_item.getAmount() == 1) {
+ p.sendMessage(Main.prefix + "你获得了: §f" + DemonAPI.getItemName(shop_item));
+ }else{
+ p.sendMessage(Main.prefix + "你获得了: §f" + DemonAPI.getItemName(shop_item)+"§7x§f"+shop_item.getAmount());
+ }
+ p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 2);
+ }
+
+ public static void OpenGui(Player p){
+ Inventory inv = Bukkit.createInventory(null,54,invTitle);
+ for (int i = 45;i lore = new ArrayList<>();
+ lore.add("§7价格: "+new DecimalFormat(",###.##").format(price)+"金币");
+ lore.add("§7数量: "+item.getAmount()+"个");
+ lore.add("§a§l✔§7点击购买");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+ public static ItemStack shopItems(ItemStack items,int money){
+ ItemStack item = items.clone();
+ item.setAmount(1);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§e§l★ §a购买物品: §r"+DemonAPI.getItemName(item));
+ List lore = new ArrayList<>();
+ double price_2 = money*16;
+ double price_3 = money*64;
+ lore.add("§a§l★ §7物品单价: §6"+new DecimalFormat(",###.##").format(money)+" §7金币");
+ lore.add("§a§l★ §6左键 §7支付 §6"+new DecimalFormat(",###.##").format(money)+" §7金币购买 §b1 §7个");
+ lore.add("§a§l★ §6右键 §7支付 §6"+new DecimalFormat(",###.##").format(price_2)+" §7金币购买 §b16 §7个");
+ lore.add("§a§l★ §6中键 §7支付 §6"+new DecimalFormat(",###.##").format(price_3)+" §7金币购买 §b64 §7个");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/util/ItemNameUtil.java b/src/main/java/me/Demon/DemonSystemShop/util/ItemNameUtil.java
new file mode 100644
index 0000000..258d5c4
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/util/ItemNameUtil.java
@@ -0,0 +1,42 @@
+package me.Demon.DemonSystemShop.util;
+
+import com.google.common.base.Charsets;
+import org.bukkit.Material;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
+
+import java.io.File;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Objects;
+
+public class ItemNameUtil {
+
+ private static FileConfiguration fileConfiguration = null;
+
+ public static void inits(Plugin plugin){
+ File configFile = new File(plugin.getDataFolder(), "ItemName.yml");
+ if (!configFile.exists()){
+ plugin.saveResource("ItemName.yml", false);
+ }
+ fileConfiguration = YamlConfiguration.loadConfiguration(configFile);
+ Reader defConfigStream = new InputStreamReader(plugin.getResource("ItemName.yml"), Charsets.UTF_8);
+ YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+ fileConfiguration.setDefaults(defConfig);
+ }
+
+ public static String getChineseName(ItemStack itemStack) {
+ Material material = itemStack.getType();
+ short data = itemStack.getData().getData();
+ String type = material.name();
+ if(data != 0){
+ type = material.name()+":"+data;
+ }
+ if (fileConfiguration.getString(type) != null) {
+ return fileConfiguration.getString(type);
+ }
+ return type;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/util/SqlUtil.java b/src/main/java/me/Demon/DemonSystemShop/util/SqlUtil.java
new file mode 100644
index 0000000..bb6e6ae
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/util/SqlUtil.java
@@ -0,0 +1,108 @@
+package me.Demon.DemonSystemShop.util;
+
+import me.Demon.DemonSystemShop.Main;
+import me.Demon.DemonSystemShop.util.database.MegumiSQL;
+import org.bukkit.Bukkit;
+
+import java.sql.*;
+
+public class SqlUtil extends MegumiSQL {
+
+ private Main plugin;
+ private final String hostname;
+ private final String port;
+ private final String database;
+ private final String username;
+ private final String password;
+ private Connection connection;
+
+ public SqlUtil(Main plugin, String hostname, String port, String database, String username, String password) {
+ this.plugin = plugin;
+ this.hostname = hostname;
+ this.port = port;
+ this.database = database;
+ this.username = username;
+ this.password = password;
+ this.connection = null;
+ }
+
+ @Override
+ public void openConnection() {
+ try {
+ Class.forName("com.mysql.jdbc.Driver");
+ this.connection = DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database + "?useSSL=false", this.username, this.password);
+ } catch (SQLException e) {
+ Bukkit.getConsoleSender().sendMessage("§6["+ Main.pluginName+"] §c数据库连接失败!");
+ this.connection = null;
+ } catch (ClassNotFoundException e) {
+ Bukkit.getConsoleSender().sendMessage("§6["+ Main.pluginName+"] §c未找到JDBC驱动程序!");
+ this.connection = null;
+ }
+ }
+
+ @Override
+ public boolean checkConnection() {
+ return this.connection != null;
+ }
+
+ @Override
+ public Connection getConnection() {
+ return this.connection;
+ }
+
+ @Override
+ public void closeConnection() {
+ if (this.connection != null) {
+ try {
+ this.connection.close();
+ this.connection = null;
+ } catch (SQLException e) {
+ Bukkit.getConsoleSender().sendMessage("§6["+ Main.pluginName+"] §c关闭数据库失败!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public ResultSet querySQL(String query) {
+ Connection conn;
+ if (checkConnection())
+ conn = getConnection();
+ else
+ return null;
+ Statement stat = null;
+ try {
+ stat = conn.createStatement();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ ResultSet result = null;
+ try {
+ if (stat != null)
+ result = stat.executeQuery(query);
+ else
+ return null;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ return null;
+ }
+ return result;
+ }
+
+ public boolean updateSQL(String data) {
+ Connection conn;
+ if (checkConnection()) {
+ conn = getConnection();
+ }else {
+ return false;
+ }
+ Statement stat = null;
+ try {
+ stat = conn.createStatement();
+ stat.executeUpdate(data);
+ return true;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/util/database/MegumiSQL.java b/src/main/java/me/Demon/DemonSystemShop/util/database/MegumiSQL.java
new file mode 100644
index 0000000..9134f2b
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/util/database/MegumiSQL.java
@@ -0,0 +1,15 @@
+package me.Demon.DemonSystemShop.util.database;
+
+import java.sql.Connection;
+
+public abstract class MegumiSQL {
+
+ public abstract void openConnection();
+
+ public abstract boolean checkConnection();
+
+ public abstract Connection getConnection();
+
+ public abstract void closeConnection();
+
+}
diff --git a/src/main/java/me/Demon/DemonSystemShop/util/database/SqlManager.java b/src/main/java/me/Demon/DemonSystemShop/util/database/SqlManager.java
new file mode 100644
index 0000000..bae3db6
--- /dev/null
+++ b/src/main/java/me/Demon/DemonSystemShop/util/database/SqlManager.java
@@ -0,0 +1,94 @@
+package me.Demon.DemonSystemShop.util.database;
+
+import me.Demon.DemonSystemShop.DayShop.DayShopAPI;
+import me.Demon.DemonSystemShop.Main;
+import me.Demon.DemonSystemShop.util.SqlUtil;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import java.sql.ResultSet;
+import java.util.Date;
+
+public class SqlManager {
+
+ private Main plugin;
+
+ public String table = "skyblock_dayshop";
+
+ public SqlManager(Main plugin) {
+ this.plugin = plugin;
+ }
+
+ private SqlUtil getSQL() {
+ return plugin.getSqlUtil();
+ }
+
+ // 创建数据库表格格式
+ public void createTable() {
+ // 数据库结构组成
+ // 玩家名字(VARCHAR) 出售品类型(VARCHAR) 刷新时间(VARCHAR)
+ String s = "CREATE TABLE IF NOT EXISTS "+table+"(" +
+ " `name` VARCHAR(32) NOT NULL," +
+ " `type` VARCHAR(32) NOT NULL," +
+ " `date` VARCHAR(10) NOT NULL" +
+ ") ENGINE = InnoDB";
+ getSQL().openConnection();
+ getSQL().updateSQL(s);
+ getSQL().closeConnection();
+ }
+
+ // 创建玩家数据表格
+ public void createPlayerTableData(Player p){
+ // MySQL.update("INSERT INTO "+ table+" VALUES ('" + p.getName() + "','" + p.getUniqueId() + "','默认','默认');");
+ String set = "INSERT INTO "+table+" (`name`, `type`, `date`) VALUES ('%player%', '%type%', '%updata%')";
+ Date date = new Date();
+ getSQL().openConnection();
+ getSQL().updateSQL(set.replace("%player%", p.getName())
+ .replace("%type%", String.valueOf("COBBLESTONE"))
+ .replace("%updata%", date.getMonth()+"."+date.getDate()));
+ getSQL().closeConnection();
+ Bukkit.getConsoleSender().sendMessage("§6[系统商店] §a玩家首次数据创建完成。");
+ }
+
+ // 从数据库中获取玩家所有数据
+ public String getPlayerData(Player p){
+ String string = null;
+ String select = "SELECT * FROM "+table+" WHERE name = '%playerName%'";
+ try {
+ getSQL().openConnection();
+ ResultSet set = getSQL().querySQL(select.replace("%playerName%", p.getName()));
+ if (set.next()) {
+ String type = set.getString("type");
+ String update = set.getString("date");
+ Date date = new Date();
+ if (update.equalsIgnoreCase(date.getMonth()+"."+date.getDate())) {
+ string = type;
+ } else {
+ String updataType = Main.getDayRandomType();
+ SavePlayerData(p,updataType);
+ string = updataType;
+ Bukkit.getConsoleSender().sendMessage("§6["+ Main.pluginName+"] §f玩家<"+p.getName()+">的特价商店已刷新.");
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ getSQL().closeConnection();
+ }
+ return string;
+ }
+
+ // 更新玩家数据
+ public void SavePlayerData(Player player,String type){
+ String set = "UPDATE `"+table+"` SET " +
+ "`type` = '%type%'," +
+ "`date` = '%updata%' WHERE `"+table+"`.`name` = '%player%'";
+ getSQL().openConnection();
+ Date date = new Date();
+ String updata_time = date.getMonth()+"."+date.getDate();
+ getSQL().updateSQL(set.replace("%player%", player.getName())
+ .replace("%type%", String.valueOf(type))
+ .replace("%updata%", updata_time));
+ getSQL().closeConnection();
+ }
+}
diff --git a/src/main/resources/ItemName.yml b/src/main/resources/ItemName.yml
new file mode 100644
index 0000000..a23104b
--- /dev/null
+++ b/src/main/resources/ItemName.yml
@@ -0,0 +1,769 @@
+'STONE': 石头
+'STONE:1': 花岗岩
+'STONE:2': 磨制花岗岩
+'STONE:3': 闪长岩
+'STONE:4': 磨制闪长岩
+'STONE:5': 安山岩
+'STONE:6': 磨制安山岩
+'GRASS': 草方块
+'DIRT': 泥土
+'DIRT:1': 砂土
+'DIRT:2': 灰化土
+'COBBLESTONE': 圆石
+'WOOD': 橡木木板
+'WOOD:1': 云杉木板
+'WOOD:2': 白桦木板
+'WOOD:3': 丛林木板
+'WOOD:4': 金合欢木板
+'WOOD:5': 深色橡木木板
+'SAPLING': 橡树树苗
+'SAPLING:1': 云杉树苗
+'SAPLING:2': 白桦树苗
+'SAPLING:3': 丛林树苗
+'SAPLING:4': 金合欢树苗
+'SAPLING:5': 深色橡树树苗
+'BEDROCK': 基岩
+'WATER': 空气
+'STATIONARY_WATER': 空气
+'LAVA': 空气
+'STATIONARY_LAVA': 空气
+'SAND': 沙子
+'SAND:1': 红沙
+'GRAVEL': 沙砾
+'GOLD_ORE': 金矿石
+'IRON_ORE': 铁矿石
+'COAL_ORE': 煤矿石
+'LOG': 橡木
+'LOG:1': 云杉木
+'LOG:2': 白桦木
+'LOG:3': 丛林木
+'LOG:4': 金合欢木
+'LOG:5': 深色橡木
+'LEAVES': 橡树树叶
+'LEAVES:1': 云杉树叶
+'LEAVES:2': 白桦树叶
+'LEAVES:3': 丛林树叶
+'SPONGE': 海绵
+'SPONGE:1': 湿海绵
+'GLASS': 玻璃
+'LAPIS_ORE': 青金石矿石
+'LAPIS_BLOCK': 青金石块
+'DISPENSER': 发射器
+'SANDSTONE': 砂岩
+'SANDSTONE:1': 錾制砂岩
+'SANDSTONE:2': 平滑砂岩
+'NOTE_BLOCK': 音符盒
+'BED_BLOCK': 空气
+'POWERED_RAIL': 充能铁轨
+'DETECTOR_RAIL': 探测铁轨
+'PISTON_STICKY_BASE': 粘性活塞
+'WEB': 蜘蛛网
+'LONG_GRASS': 灌木
+'LONG_GRASS:1': 草
+'LONG_GRASS:2': 蕨
+'DEAD_BUSH': 枯死的灌木
+'PISTON_BASE': 活塞
+'PISTON_EXTENSION': 空气
+'WOOL': 白色羊毛
+'WOOL:1': 橙色羊毛
+'WOOL:2': 品红色羊毛
+'WOOL:3': 淡蓝色羊毛
+'WOOL:4': 黄色羊毛
+'WOOL:5': 黄绿色羊毛
+'WOOL:6': 粉红色羊毛
+'WOOL:7': 灰色羊毛
+'WOOL:8': 淡灰色羊毛
+'WOOL:9': 青色羊毛
+'WOOL:10': 紫色羊毛
+'WOOL:11': 蓝色羊毛
+'WOOL:12': 棕色羊毛
+'WOOL:13': 绿色羊毛
+'WOOL:14': 红色羊毛
+'WOOL:15': 黑色羊毛
+'PISTON_MOVING_PIECE': 空气
+'YELLOW_FLOWER': 蒲公英
+'RED_ROSE': 虞美人
+'RED_ROSE:1': 兰花
+'RED_ROSE:2': 绒球葱
+'RED_ROSE:3': 茜草花
+'RED_ROSE:4': 红色郁金香
+'RED_ROSE:5': 橙色郁金香
+'RED_ROSE:6': 白色郁金香
+'RED_ROSE:7': 粉红色郁金香
+'RED_ROSE:8': 滨菊
+'BROWN_MUSHROOM': 蘑菇
+'RED_MUSHROOM': 蘑菇
+'GOLD_BLOCK': 金块
+'IRON_BLOCK': 铁块
+'DOUBLE_STEP': 空气
+'STEP': 石台阶
+'STEP:1': 砂岩台阶
+'STEP:2': 木台阶
+'STEP:3': 圆石台阶
+'STEP:4': 砖台阶
+'STEP:5': 石砖台阶
+'STEP:6': 地狱砖台阶
+'STEP:7': 石英台阶
+'BRICK': 砖块
+'TNT': TNT
+'BOOKSHELF': 书架
+'MOSSY_COBBLESTONE': 苔石
+'OBSIDIAN': 黑曜石
+'TORCH': 火把
+'FIRE': 空气
+'MOB_SPAWNER': 刷怪箱
+'WOOD_STAIRS': 橡木楼梯
+'CHEST': 箱子
+'REDSTONE_WIRE': 空气
+'DIAMOND_ORE': 钻石矿石
+'DIAMOND_BLOCK': 钻石块
+'WORKBENCH': 工作台
+'CROPS': 空气
+'SOIL': 耕地
+'FURNACE': 熔炉
+'BURNING_FURNACE': 空气
+'SIGN_POST': 空气
+'WOODEN_DOOR': 空气
+'LADDER': 梯子
+'RAILS': 铁轨
+'COBBLESTONE_STAIRS': 圆石楼梯
+'WALL_SIGN': 空气
+'LEVER': 拉杆
+'STONE_PLATE': 石质压力板
+'IRON_DOOR_BLOCK': 空气
+'WOOD_PLATE': 木质压力板
+'REDSTONE_ORE': 红石矿石
+'GLOWING_REDSTONE_ORE': 空气
+'REDSTONE_TORCH_OFF': 空气
+'REDSTONE_TORCH_ON': 红石火把
+'STONE_BUTTON': 按钮
+'SNOW': 雪
+'ICE': 冰
+'SNOW_BLOCK': 雪
+'CACTUS': 仙人掌
+'CLAY': 粘土块
+'SUGAR_CANE_BLOCK': 空气
+'JUKEBOX': 唱片机
+'FENCE': 橡木栅栏
+'PUMPKIN': 南瓜
+'NETHERRACK': 地狱岩
+'SOUL_SAND': 灵魂沙
+'GLOWSTONE': 荧石
+'PORTAL': 空气
+'JACK_O_LANTERN': 南瓜灯
+'CAKE_BLOCK': 空气
+'DIODE_BLOCK_OFF': 空气
+'DIODE_BLOCK_ON': 空气
+'STAINED_GLASS': 白色染色玻璃
+'STAINED_GLASS:1': 橙色染色玻璃
+'STAINED_GLASS:2': 品红色染色玻璃
+'STAINED_GLASS:3': 淡蓝色染色玻璃
+'STAINED_GLASS:4': 黄色染色玻璃
+'STAINED_GLASS:5': 黄绿色染色玻璃
+'STAINED_GLASS:6': 粉红色染色玻璃
+'STAINED_GLASS:7': 灰色染色玻璃
+'STAINED_GLASS:8': 淡灰色染色玻璃
+'STAINED_GLASS:9': 青色染色玻璃
+'STAINED_GLASS:10': 紫色染色玻璃
+'STAINED_GLASS:11': 蓝色染色玻璃
+'STAINED_GLASS:12': 棕色染色玻璃
+'STAINED_GLASS:13': 绿色染色玻璃
+'STAINED_GLASS:14': 红色染色玻璃
+'STAINED_GLASS:15': 黑色染色玻璃
+'TRAP_DOOR': 活板门
+'MONSTER_EGGS': 石头怪物蛋
+'MONSTER_EGGS:1': 圆石怪物蛋
+'MONSTER_EGGS:2': 石砖怪物蛋
+'MONSTER_EGGS:3': 苔石砖怪物蛋
+'MONSTER_EGGS:4': 裂石砖怪物蛋
+'MONSTER_EGGS:5': 錾制石砖怪物蛋
+'SMOOTH_BRICK': 石砖
+'SMOOTH_BRICK:1': 苔石砖
+'SMOOTH_BRICK:2': 裂石砖
+'SMOOTH_BRICK:3': 錾制石砖
+'HUGE_MUSHROOM_1': 蘑菇
+'HUGE_MUSHROOM_2': 蘑菇
+'IRON_FENCE': 铁栏杆
+'THIN_GLASS': 玻璃板
+'MELON_BLOCK': 西瓜
+'PUMPKIN_STEM': 空气
+'MELON_STEM': 空气
+'VINE': 藤蔓
+'FENCE_GATE': 橡木栅栏门
+'BRICK_STAIRS': 砖楼梯
+'SMOOTH_STAIRS': 石砖楼梯
+'MYCEL': 菌丝
+'WATER_LILY': 睡莲
+'NETHER_BRICK': 地狱砖块
+'NETHER_FENCE': 地狱砖栅栏
+'NETHER_BRICK_STAIRS': 地狱砖楼梯
+'NETHER_WARTS': 空气
+'ENCHANTMENT_TABLE': 附魔台
+'BREWING_STAND': 空气
+'CAULDRON': 空气
+'ENDER_PORTAL': 空气
+'ENDER_PORTAL_FRAME': 末地传送门
+'ENDER_STONE': 末地石
+'DRAGON_EGG': 龙蛋
+'REDSTONE_LAMP_OFF': 红石灯
+'REDSTONE_LAMP_ON': 空气
+'WOOD_DOUBLE_STEP': 空气
+'WOOD_STEP': 橡木台阶
+'WOOD_STEP:1': 云杉台阶
+'WOOD_STEP:2': 桦木台阶
+'WOOD_STEP:3': 丛林台阶
+'WOOD_STEP:4': 金合欢木台阶
+'WOOD_STEP:5': 深色橡木台阶
+'COCOA': 空气
+'SANDSTONE_STAIRS': 砂岩楼梯
+'EMERALD_ORE': 绿宝石矿石
+'ENDER_CHEST': 末影箱
+'TRIPWIRE_HOOK': 绊线钩
+'TRIPWIRE': 空气
+'EMERALD_BLOCK': 绿宝石块
+'SPRUCE_WOOD_STAIRS': 云杉木楼梯
+'BIRCH_WOOD_STAIRS': 桦木楼梯
+'JUNGLE_WOOD_STAIRS': 丛林木楼梯
+'COMMAND': 命令方块
+'BEACON': 信标
+'COBBLE_WALL': 圆石墙
+'COBBLE_WALL:1': 苔石墙
+'FLOWER_POT': 空气
+'CARROT': 空气
+'POTATO': 空气
+'WOOD_BUTTON': 按钮
+'SKULL': 空气
+'ANVIL': 铁砧
+'ANVIL:1': 轻微损坏的铁砧
+'ANVIL:2': 严重损坏的铁砧
+'TRAPPED_CHEST': 陷阱箱
+'GOLD_PLATE': 测重压力板(轻质)
+'IRON_PLATE': 测重压力板(重质)
+'REDSTONE_COMPARATOR_OFF': 空气
+'REDSTONE_COMPARATOR_ON': 空气
+'DAYLIGHT_DETECTOR': 阳光传感器
+'REDSTONE_BLOCK': 红石块
+'QUARTZ_ORE': 下界石英矿石
+'HOPPER': 漏斗
+'QUARTZ_BLOCK': 石英块
+'QUARTZ_BLOCK:1': 錾制石英块
+'QUARTZ_BLOCK:2': 竖纹石英块
+'QUARTZ_STAIRS': 石英楼梯
+'ACTIVATOR_RAIL': 激活铁轨
+'DROPPER': 投掷器
+'STAINED_CLAY': 白色陶瓦
+'STAINED_CLAY:1': 橙色陶瓦
+'STAINED_CLAY:2': 品红色陶瓦
+'STAINED_CLAY:3': 淡蓝色陶瓦
+'STAINED_CLAY:4': 黄色陶瓦
+'STAINED_CLAY:5': 黄绿色陶瓦
+'STAINED_CLAY:6': 粉红色陶瓦
+'STAINED_CLAY:7': 灰色陶瓦
+'STAINED_CLAY:8': 淡灰色陶瓦
+'STAINED_CLAY:9': 青色陶瓦
+'STAINED_CLAY:10': 紫色陶瓦
+'STAINED_CLAY:11': 蓝色陶瓦
+'STAINED_CLAY:12': 棕色陶瓦
+'STAINED_CLAY:13': 绿色陶瓦
+'STAINED_CLAY:14': 红色陶瓦
+'STAINED_CLAY:15': 黑色陶瓦
+'STAINED_GLASS_PANE': 白色染色玻璃板
+'STAINED_GLASS_PANE:1': 橙色染色玻璃板
+'STAINED_GLASS_PANE:2': 品红色染色玻璃板
+'STAINED_GLASS_PANE:3': 淡蓝色染色玻璃板
+'STAINED_GLASS_PANE:4': 黄色染色玻璃板
+'STAINED_GLASS_PANE:5': 黄绿色染色玻璃板
+'STAINED_GLASS_PANE:6': 粉红色染色玻璃板
+'STAINED_GLASS_PANE:7': 灰色染色玻璃板
+'STAINED_GLASS_PANE:8': 淡灰色染色玻璃板
+'STAINED_GLASS_PANE:9': 青色染色玻璃板
+'STAINED_GLASS_PANE:10': 紫色染色玻璃板
+'STAINED_GLASS_PANE:11': 蓝色染色玻璃板
+'STAINED_GLASS_PANE:12': 棕色染色玻璃板
+'STAINED_GLASS_PANE:13': 绿色染色玻璃板
+'STAINED_GLASS_PANE:14': 红色染色玻璃板
+'STAINED_GLASS_PANE:15': 黑色染色玻璃板
+'LEAVES_2': 金合欢树叶
+'LEAVES_2:1': 深色橡树树叶
+'LEAVES_2:2': 橡树树叶
+'LEAVES_2:3': 橡树树叶
+'LOG_2': 金合欢木
+'LOG_2:1': 深色橡木
+'LOG_2:2': 橡木
+'LOG_2:3': 橡木
+'LOG_2:4': 橡木
+'LOG_2:5': 橡木
+'LOG_2:6': 橡木
+'LOG_2:7': 橡木
+'LOG_2:8': 橡木
+'LOG_2:9': 橡木
+'LOG_2:10': 橡木
+'LOG_2:11': 橡木
+'LOG_2:12': 橡木
+'LOG_2:13': 橡木
+'LOG_2:14': 橡木
+'LOG_2:15': 橡木
+'ACACIA_STAIRS': 金合欢木楼梯
+'DARK_OAK_STAIRS': 深色橡木楼梯
+'SLIME_BLOCK': 粘液块
+'BARRIER': 屏障
+'IRON_TRAPDOOR': 铁活板门
+'PRISMARINE': 海晶石
+'PRISMARINE:1': 海晶石砖
+'PRISMARINE:2': 暗海晶石
+'SEA_LANTERN': 海晶灯
+'HAY_BLOCK': 干草块
+'CARPET': 白色地毯
+'CARPET:1': 橙色地毯
+'CARPET:2': 品红色地毯
+'CARPET:3': 淡蓝色地毯
+'CARPET:4': 黄色地毯
+'CARPET:5': 黄绿色地毯
+'CARPET:6': 粉红色地毯
+'CARPET:7': 灰色地毯
+'CARPET:8': 淡灰色地毯
+'CARPET:9': 青色地毯
+'CARPET:10': 紫色地毯
+'CARPET:11': 蓝色地毯
+'CARPET:12': 棕色地毯
+'CARPET:13': 绿色地毯
+'CARPET:14': 红色地毯
+'CARPET:15': 黑色地毯
+'HARD_CLAY': 陶瓦
+'COAL_BLOCK': 煤炭块
+'PACKED_ICE': 浮冰
+'DOUBLE_PLANT': 向日葵
+'DOUBLE_PLANT:1': 丁香
+'DOUBLE_PLANT:2': 高草丛
+'DOUBLE_PLANT:3': 大型蕨
+'DOUBLE_PLANT:4': 玫瑰丛
+'DOUBLE_PLANT:5': 牡丹
+'STANDING_BANNER': 空气
+'WALL_BANNER': 空气
+'DAYLIGHT_DETECTOR_INVERTED': 空气
+'RED_SANDSTONE': 红砂岩
+'RED_SANDSTONE:1': 錾制红砂岩
+'RED_SANDSTONE:2': 平滑红砂岩
+'RED_SANDSTONE_STAIRS': 红砂岩楼梯
+'DOUBLE_STONE_SLAB2': 空气
+'STONE_SLAB2': 红砂岩台阶
+'SPRUCE_FENCE_GATE': 云杉木栅栏门
+'BIRCH_FENCE_GATE': 白桦木栅栏门
+'JUNGLE_FENCE_GATE': 丛林木栅栏门
+'DARK_OAK_FENCE_GATE': 深色橡木栅栏门
+'ACACIA_FENCE_GATE': 金合欢栅栏门
+'SPRUCE_FENCE': 云杉木栅栏
+'BIRCH_FENCE': 白桦木栅栏
+'JUNGLE_FENCE': 丛林木栅栏
+'DARK_OAK_FENCE': 深色橡木栅栏
+'ACACIA_FENCE': 金合欢栅栏
+'SPRUCE_DOOR': 空气
+'BIRCH_DOOR': 空气
+'JUNGLE_DOOR': 空气
+'ACACIA_DOOR': 空气
+'DARK_OAK_DOOR': 空气
+'END_ROD': 末地烛
+'CHORUS_PLANT': 紫颂植物
+'CHORUS_FLOWER': 紫颂花
+'PURPUR_BLOCK': 紫珀块
+'PURPUR_PILLAR': 竖纹紫珀块
+'PURPUR_STAIRS': 紫珀楼梯
+'PURPUR_DOUBLE_SLAB': 空气
+'PURPUR_SLAB': 紫珀台阶
+'END_BRICKS': 末地石砖
+'BEETROOT_BLOCK': 空气
+'GRASS_PATH': 草径
+'END_GATEWAY': 空气
+'COMMAND_REPEATING': 循环型命令方块
+'COMMAND_CHAIN': 连锁型命令方块
+'FROSTED_ICE': 空气
+'MAGMA': 岩浆块
+'NETHER_WART_BLOCK': 地狱疣块
+'RED_NETHER_BRICK': 红色地狱砖
+'BONE_BLOCK': 骨块
+'STRUCTURE_VOID': 结构空位
+'OBSERVER': 侦测器
+'WHITE_SHULKER_BOX': 白色潜影盒
+'ORANGE_SHULKER_BOX': 橙色潜影盒
+'MAGENTA_SHULKER_BOX': 品红色潜影盒
+'LIGHT_BLUE_SHULKER_BOX': 淡蓝色潜影盒
+'YELLOW_SHULKER_BOX': 黄色潜影盒
+'LIME_SHULKER_BOX': 黄绿色潜影盒
+'PINK_SHULKER_BOX': 粉色潜影盒
+'GRAY_SHULKER_BOX': 灰色潜影盒
+'SILVER_SHULKER_BOX': 淡灰色潜影盒
+'CYAN_SHULKER_BOX': 青色潜影盒
+'PURPLE_SHULKER_BOX': 紫色潜影盒
+'BLUE_SHULKER_BOX': 蓝色潜影盒
+'BROWN_SHULKER_BOX': 棕色潜影盒
+'GREEN_SHULKER_BOX': 绿色潜影盒
+'RED_SHULKER_BOX': 红色潜影盒
+'BLACK_SHULKER_BOX': 黑色潜影盒
+'WHITE_GLAZED_TERRACOTTA': 白色带釉陶瓦
+'ORANGE_GLAZED_TERRACOTTA': 橙色带釉陶瓦
+'MAGENTA_GLAZED_TERRACOTTA': 品红色带釉陶瓦
+'LIGHT_BLUE_GLAZED_TERRACOTTA': 淡蓝色带釉陶瓦
+'YELLOW_GLAZED_TERRACOTTA': 黄色带釉陶瓦
+'LIME_GLAZED_TERRACOTTA': 黄绿色带釉陶瓦
+'PINK_GLAZED_TERRACOTTA': 粉红色带釉陶瓦
+'GRAY_GLAZED_TERRACOTTA': 灰色带釉陶瓦
+'SILVER_GLAZED_TERRACOTTA': 淡灰色带釉陶瓦
+'CYAN_GLAZED_TERRACOTTA': 青色带釉陶瓦
+'PURPLE_GLAZED_TERRACOTTA': 紫色带釉陶瓦
+'BLUE_GLAZED_TERRACOTTA': 蓝色带釉陶瓦
+'BROWN_GLAZED_TERRACOTTA': 棕色带釉陶瓦
+'GREEN_GLAZED_TERRACOTTA': 绿色带釉陶瓦
+'RED_GLAZED_TERRACOTTA': 红色带釉陶瓦
+'BLACK_GLAZED_TERRACOTTA': 黑色带釉陶瓦
+'CONCRETE': 白色混凝土
+'CONCRETE:1': 橙色混凝土
+'CONCRETE:2': 品红色混凝土
+'CONCRETE:3': 淡蓝色混凝土
+'CONCRETE:4': 黄色混凝土
+'CONCRETE:5': 黄绿色混凝土
+'CONCRETE:6': 粉红色混凝土
+'CONCRETE:7': 灰色混凝土
+'CONCRETE:8': 淡灰色混凝土
+'CONCRETE:9': 青色混凝土
+'CONCRETE:10': 紫色混凝土
+'CONCRETE:11': 蓝色混凝土
+'CONCRETE:12': 棕色混凝土
+'CONCRETE:13': 绿色混凝土
+'CONCRETE:14': 红色混凝土
+'CONCRETE:15': 黑色混凝土
+'CONCRETE_POWDER': 白色混凝土粉末
+'CONCRETE_POWDER:1': 橙色混凝土粉末
+'CONCRETE_POWDER:2': 品红色混凝土粉末
+'CONCRETE_POWDER:3': 淡蓝色混凝土粉末
+'CONCRETE_POWDER:4': 黄色混凝土粉末
+'CONCRETE_POWDER:5': 黄绿色混凝土粉末
+'CONCRETE_POWDER:6': 粉红色混凝土粉末
+'CONCRETE_POWDER:7': 灰色混凝土粉末
+'CONCRETE_POWDER:8': 淡灰色混凝土粉末
+'CONCRETE_POWDER:9': 青色混凝土粉末
+'CONCRETE_POWDER:10': 紫色混凝土粉末
+'CONCRETE_POWDER:11': 蓝色混凝土粉末
+'CONCRETE_POWDER:12': 棕色混凝土粉末
+'CONCRETE_POWDER:13': 绿色混凝土粉末
+'CONCRETE_POWDER:14': 红色混凝土粉末
+'CONCRETE_POWDER:15': 黑色混凝土粉末
+'STRUCTURE_BLOCK': 结构方块
+'IRON_SPADE': 铁锹
+'IRON_PICKAXE': 铁镐
+'IRON_AXE': 铁斧
+'FLINT_AND_STEEL': 打火石
+'APPLE': 苹果
+'BOW': 弓
+'ARROW': 箭
+'COAL': 煤炭
+'COAL:1': 木炭
+'DIAMOND': 钻石
+'IRON_INGOT': 铁锭
+'GOLD_INGOT': 金锭
+'IRON_SWORD': 铁剑
+'WOOD_SWORD': 木剑
+'WOOD_SPADE': 木锹
+'WOOD_PICKAXE': 木镐
+'WOOD_AXE': 木斧
+'STONE_SWORD': 石剑
+'STONE_SPADE': 石锹
+'STONE_PICKAXE': 石镐
+'STONE_AXE': 石斧
+'DIAMOND_SWORD': 钻石剑
+'DIAMOND_SPADE': 钻石锹
+'DIAMOND_PICKAXE': 钻石镐
+'DIAMOND_AXE': 钻石斧
+'STICK': 木棍
+'BOWL': 碗
+'MUSHROOM_SOUP': 蘑菇煲
+'GOLD_SWORD': 金剑
+'GOLD_SPADE': 金锹
+'GOLD_PICKAXE': 金镐
+'GOLD_AXE': 金斧
+'STRING': 线
+'FEATHER': 羽毛
+'SULPHUR': 火药
+'WOOD_HOE': 木锄
+'STONE_HOE': 石锄
+'IRON_HOE': 铁锄
+'DIAMOND_HOE': 钻石锄
+'GOLD_HOE': 金锄
+'SEEDS': 小麦种子
+'WHEAT': 小麦
+'BREAD': 面包
+'LEATHER_HELMET': 皮革帽子
+'LEATHER_CHESTPLATE': 皮革外套
+'LEATHER_LEGGINGS': 皮革裤子
+'LEATHER_BOOTS': 皮革靴子
+'CHAINMAIL_HELMET': 锁链头盔
+'CHAINMAIL_CHESTPLATE': 锁链胸甲
+'CHAINMAIL_LEGGINGS': 锁链护腿
+'CHAINMAIL_BOOTS': 锁链靴子
+'IRON_HELMET': 铁头盔
+'IRON_CHESTPLATE': 铁胸甲
+'IRON_LEGGINGS': 铁护腿
+'IRON_BOOTS': 铁靴子
+'DIAMOND_HELMET': 钻石头盔
+'DIAMOND_CHESTPLATE': 钻石胸甲
+'DIAMOND_LEGGINGS': 钻石护腿
+'DIAMOND_BOOTS': 钻石靴子
+'GOLD_HELMET': 金头盔
+'GOLD_CHESTPLATE': 金胸甲
+'GOLD_LEGGINGS': 金护腿
+'GOLD_BOOTS': 金靴子
+'FLINT': 燧石
+'PORK': 生猪排
+'GRILLED_PORK': 熟猪排
+'PAINTING': 画
+'GOLDEN_APPLE': 金苹果
+'GOLDEN_APPLE:1': 附魔金苹果
+'WOOD_DOOR': 橡木门
+'BUCKET': 桶
+'WATER_BUCKET': 水桶
+'LAVA_BUCKET': 熔岩桶
+'MINECART': 矿车
+'SADDLE': 鞍
+'IRON_DOOR': 铁门
+'REDSTONE': 红石
+'SNOW_BALL': 雪球
+'BOAT': 橡木船
+'LEATHER': 皮革
+'MILK_BUCKET': 牛奶
+'CLAY_BRICK': 红砖
+'CLAY_BALL': 粘土
+'SUGAR_CANE': 甘蔗
+'PAPER': 纸
+'BOOK': 书
+'SLIME_BALL': 粘液球
+'STORAGE_MINECART': 运输矿车
+'POWERED_MINECART': 动力矿车
+'EGG': 鸡蛋
+'COMPASS': 指南针
+'FISHING_ROD': 钓鱼竿
+'WATCH': 钟
+'GLOWSTONE_DUST': 荧石粉
+'RAW_FISH': 生鱼
+'RAW_FISH:1': 生鲑鱼
+'RAW_FISH:2': 小丑鱼
+'RAW_FISH:3': 河豚
+'COOKED_FISH': 熟鱼
+'COOKED_FISH:1': 熟鲑鱼
+'INK_SACK': 墨囊
+'INK_SACK:1': 玫瑰红
+'INK_SACK:2': 仙人掌绿
+'INK_SACK:3': 可可豆
+'INK_SACK:4': 青金石
+'INK_SACK:5': 紫色染料
+'INK_SACK:6': 青色染料
+'INK_SACK:7': 淡灰色染料
+'INK_SACK:8': 灰色染料
+'INK_SACK:9': 粉红色染料
+'INK_SACK:10': 黄绿色染料
+'INK_SACK:11': 蒲公英黄
+'INK_SACK:12': 淡蓝色染料
+'INK_SACK:13': 品红色染料
+'INK_SACK:14': 橙色染料
+'INK_SACK:15': 骨粉
+'BONE': 骨头
+'SUGAR': 糖
+'CAKE': 蛋糕
+'BED': 白色床
+'DIODE': 红石中继器
+'COOKIE': 曲奇
+'MAP': 地图
+'SHEARS': 剪刀
+'MELON': 西瓜
+'PUMPKIN_SEEDS': 南瓜种子
+'MELON_SEEDS': 西瓜种子
+'RAW_BEEF': 生牛肉
+'COOKED_BEEF': 牛排
+'RAW_CHICKEN': 生鸡肉
+'COOKED_CHICKEN': 熟鸡肉
+'ROTTEN_FLESH': 腐肉
+'ENDER_PEARL': 末影珍珠
+'BLAZE_ROD': 烈焰棒
+'GHAST_TEAR': 恶魂之泪
+'GOLD_NUGGET': 金粒
+'NETHER_STALK': 地狱疣
+'POTION:WATER': 水瓶
+'POTION:MUNDANE': 平凡的药水
+'POTION:THICK': 浓稠的药水
+'POTION:AWKWARD': 粗制的药水
+'POTION:NIGHT_VISION': 夜视药水
+'POTION:INVISIBILITY': 隐身药水
+'POTION:JUMP': 跳跃药水
+'POTION:FIRE_RESISTANCE': 抗火药水
+'POTION:SPEED': 迅捷药水
+'POTION:SLOWNESS': 迟缓药水
+'POTION:WATER_BREATHING': 水肺药水
+'POTION:INSTANT_HEAL': 治疗药水
+'POTION:INSTANT_DAMAGE': 伤害药水
+'POTION:POISON': 剧毒药水
+'POTION:REGEN': 再生药水
+'POTION:STRENGTH': 力量药水
+'POTION:WEAKNESS': 虚弱药水
+'POTION:LUCK': 幸运药水
+'GLASS_BOTTLE': 玻璃瓶
+'SPIDER_EYE': 蜘蛛眼
+'FERMENTED_SPIDER_EYE': 发酵蛛眼
+'BLAZE_POWDER': 烈焰粉
+'MAGMA_CREAM': 岩浆膏
+'BREWING_STAND_ITEM': 酿造台
+'CAULDRON_ITEM': 炼药锅
+'EYE_OF_ENDER': 末影之眼
+'SPECKLED_MELON': 闪烁的西瓜
+'MONSTER_EGG': 怪物蛋
+'EXP_BOTTLE': 附魔之瓶
+'FIREBALL': 火焰弹
+'BOOK_AND_QUILL': 书与笔
+'WRITTEN_BOOK': 成书
+'EMERALD': 绿宝石
+'ITEM_FRAME': 物品展示框
+'FLOWER_POT_ITEM': 花盆
+'CARROT_ITEM': 胡萝卜
+'POTATO_ITEM': 马铃薯
+'BAKED_POTATO': 烤马铃薯
+'POISONOUS_POTATO': 毒马铃薯
+'EMPTY_MAP': 空地图
+'GOLDEN_CARROT': 金胡萝卜
+'SKULL_ITEM': 骷髅头颅
+'SKULL_ITEM:1': 凋零骷髅头颅
+'SKULL_ITEM:2': 僵尸的头
+'SKULL_ITEM:3': 头
+'SKULL_ITEM:4': 爬行者的头
+'SKULL_ITEM:5': 龙首
+'CARROT_STICK': 胡萝卜钓竿
+'NETHER_STAR': 下界之星
+'PUMPKIN_PIE': 南瓜派
+'FIREWORK': 烟花火箭
+'FIREWORK_CHARGE': 烟火之星
+'ENCHANTED_BOOK': 附魔书
+'REDSTONE_COMPARATOR': 红石比较器
+'NETHER_BRICK_ITEM': 地狱砖
+'QUARTZ': 下界石英
+'EXPLOSIVE_MINECART': TNT矿车
+'HOPPER_MINECART': 漏斗矿车
+'PRISMARINE_SHARD': 海晶碎片
+'PRISMARINE_CRYSTALS': 海晶砂粒
+'RABBIT': 生兔肉
+'COOKED_RABBIT': 熟兔肉
+'RABBIT_STEW': 兔肉煲
+'RABBIT_FOOT': 兔子脚
+'RABBIT_HIDE': 兔子皮
+'ARMOR_STAND': 盔甲架
+'IRON_BARDING': 铁马铠
+'GOLD_BARDING': 金马铠
+'DIAMOND_BARDING': 钻石马铠
+'LEASH': 拴绳
+'NAME_TAG': 命名牌
+'COMMAND_MINECART': 命令方块矿车
+'MUTTON': 生羊肉
+'COOKED_MUTTON': 熟羊肉
+'BANNER': 黑色旗帜
+'BANNER:1': 红色旗帜
+'BANNER:2': 绿色旗帜
+'BANNER:3': 棕色旗帜
+'BANNER:4': 蓝色旗帜
+'BANNER:5': 紫色旗帜
+'BANNER:6': 青色旗帜
+'BANNER:7': 淡灰色旗帜
+'BANNER:8': 灰色旗帜
+'BANNER:9': 粉红色旗帜
+'BANNER:10': 黄绿色旗帜
+'BANNER:11': 黄色旗帜
+'BANNER:12': 淡蓝色旗帜
+'BANNER:13': 品红色旗帜
+'BANNER:14': 橙色旗帜
+'BANNER:15': 白色旗帜
+'END_CRYSTAL': 末影水晶
+'SPRUCE_DOOR_ITEM': 云杉木门
+'BIRCH_DOOR_ITEM': 白桦木门
+'JUNGLE_DOOR_ITEM': 丛林木门
+'ACACIA_DOOR_ITEM': 金合欢木门
+'DARK_OAK_DOOR_ITEM': 深色橡木门
+'CHORUS_FRUIT': 紫颂果
+'CHORUS_FRUIT_POPPED': 爆裂紫颂果
+'BEETROOT': 甜菜根
+'BEETROOT_SEEDS': 甜菜种子
+'BEETROOT_SOUP': 甜菜汤
+'DRAGONS_BREATH': 龙息
+'SPLASH_POTION:WATER': 喷溅型水瓶
+'SPLASH_POTION:MUNDANE': 喷溅型平凡的药水
+'SPLASH_POTION:THICK': 喷溅型浓稠的药水
+'SPLASH_POTION:AWKWARD': 喷溅型粗制药水
+'SPLASH_POTION:NIGHT_VISION': 喷溅型夜视药水
+'SPLASH_POTION:INVISIBILITY': 喷溅型隐身药水
+'SPLASH_POTION:JUMP': 喷溅型跳跃药水
+'SPLASH_POTION:FIRE_RESISTANCE': 喷溅型抗火药水
+'SPLASH_POTION:SPEED': 喷溅型迅捷药水
+'SPLASH_POTION:SLOWNESS': 喷溅型迟缓药水
+'SPLASH_POTION:WATER_BREATHING': 喷溅型水肺药水
+'SPLASH_POTION:INSTANT_HEAL': 喷溅型治疗药水
+'SPLASH_POTION:INSTANT_DAMAGE': 喷溅型伤害药水
+'SPLASH_POTION:POISON': 喷溅型剧毒药水
+'SPLASH_POTION:REGEN': 喷溅型再生药水
+'SPLASH_POTION:STRENGTH': 喷溅型力量药水
+'SPLASH_POTION:WEAKNESS': 喷溅型虚弱药水
+'SPLASH_POTION:LUCK': 喷溅型幸运药水
+'SPECTRAL_ARROW': 光灵箭
+'TIPPED_ARROW:UNCRAFTABLE': 喷溅之箭
+'TIPPED_ARROW:WATER': 喷溅之箭
+'TIPPED_ARROW:MUNDANE': 药箭
+'TIPPED_ARROW:THICK': 药箭
+'TIPPED_ARROW:AWKWARD': 药箭
+'TIPPED_ARROW:NIGHT_VISION': 夜视之箭
+'TIPPED_ARROW:INVISIBILITY': 隐身之箭
+'TIPPED_ARROW:JUMP': 跳跃之箭
+'TIPPED_ARROW:FIRE_RESISTANCE': 抗火之箭
+'TIPPED_ARROW:SPEED': 迅捷之箭
+'TIPPED_ARROW:SLOWNESS': 迟缓之箭
+'TIPPED_ARROW:WATER_BREATHING': 水肺之箭
+'TIPPED_ARROW:INSTANT_HEAL': 治疗之箭
+'TIPPED_ARROW:INSTANT_DAMAGE': 伤害之箭
+'TIPPED_ARROW:REGEN': 再生之箭
+'TIPPED_ARROW:WEAKNESS': 虚弱之箭
+'TIPPED_ARROW:POISON': 剧毒之箭
+'TIPPED_ARROW:STRENGTH': 力量之箭
+'TIPPED_ARROW:LUCK': 幸运之箭
+'LINGERING_POTION:WATER': 滞留型水瓶
+'LINGERING_POTION:MUNDANE': 滞留型平凡的药水
+'LINGERING_POTION:THICK': 滞留型浓稠的药水
+'LINGERING_POTION:AWKWARD': 滞留型粗制药水
+'LINGERING_POTION:NIGHT_VISION': 滞留型夜视药水
+'LINGERING_POTION:INVISIBILITY': 滞留型隐身药水
+'LINGERING_POTION:JUMP': 滞留型跳跃药水
+'LINGERING_POTION:FIRE_RESISTANCE': 滞留型抗火药水
+'LINGERING_POTION:SPEED': 滞留型迅捷药水
+'LINGERING_POTION:SLOWNESS': 滞留型迟缓药水
+'LINGERING_POTION:WATER_BREATHING': 滞留型水肺药水
+'LINGERING_POTION:INSTANT_HEAL': 滞留型治疗药水
+'LINGERING_POTION:INSTANT_DAMAGE': 滞留型伤害药水
+'LINGERING_POTION:POISON': 滞留型剧毒药水
+'LINGERING_POTION:REGEN': 滞留型再生药水
+'LINGERING_POTION:STRENGTH': 滞留型力量药水
+'LINGERING_POTION:WEAKNESS': 滞留型虚弱药水
+'LINGERING_POTION:LUCK': 滞留型幸运药水
+'SHIELD': 盾牌
+'ELYTRA': 鞘翅
+'BOAT_SPRUCE': 云杉木船
+'BOAT_BIRCH': 桦木船
+'BOAT_JUNGLE': 丛林木船
+'BOAT_ACACIA': 金合欢木船
+'BOAT_DARK_OAK': 深色橡木船
+'TOTEM': 不死图腾
+'SHULKER_SHELL': 潜影壳
+'IRON_NUGGET': 铁粒
+'KNOWLEDGE_BOOK': 知识之书
+'GOLD_RECORD': 音乐唱片
+'GREEN_RECORD': 音乐唱片
+'RECORD_3': 音乐唱片
+'RECORD_4': 音乐唱片
+'RECORD_5': 音乐唱片
+'RECORD_6': 音乐唱片
+'RECORD_7': 音乐唱片
+'RECORD_8': 音乐唱片
+'RECORD_9': 音乐唱片
+'RECORD_10': 音乐唱片
+'RECORD_11': 音乐唱片
+'RECORD_12': 音乐唱片
+'SIGN': 木牌
diff --git a/src/main/resources/Log.yml b/src/main/resources/Log.yml
new file mode 100644
index 0000000..e69de29
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
new file mode 100644
index 0000000..e18acb0
--- /dev/null
+++ b/src/main/resources/config.yml
@@ -0,0 +1 @@
+BuyShop: {}
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
new file mode 100644
index 0000000..0b4e751
--- /dev/null
+++ b/src/main/resources/plugin.yml
@@ -0,0 +1,7 @@
+name: DemonSystemShop
+main: me.Demon.DemonSystemShop.Main
+version: 1.0.7
+depend:
+ - DemonMySql
+commands:
+ systemshop:
\ No newline at end of file