diff --git a/src/main/java/me/sat7/dynamicshop/commands/CMDManager.java b/src/main/java/me/sat7/dynamicshop/commands/CMDManager.java index 2e4b8d4..ece64aa 100644 --- a/src/main/java/me/sat7/dynamicshop/commands/CMDManager.java +++ b/src/main/java/me/sat7/dynamicshop/commands/CMDManager.java @@ -41,6 +41,7 @@ public class CMDManager public static Command command; public static ItemInfo itemInfo; public static ResetTradingVolume resetTradingVolume; + public static Background background; public static void Init() { @@ -93,6 +94,7 @@ public static void Init() stockStabilizing = new StockStabilizing(); command = new Command(); resetTradingVolume = new ResetTradingVolume(); + background = new Background(); CMDHashMap.put("account", account); CMDHashMap.put("add", add); @@ -113,6 +115,7 @@ public static void Init() CMDHashMap.put("stockstabilizing", stockStabilizing); CMDHashMap.put("command", command); CMDHashMap.put("resettradingvolume", resetTradingVolume); + CMDHashMap.put("background", background); } public static void RunCMD(String key, String[] args, CommandSender sender) diff --git a/src/main/java/me/sat7/dynamicshop/commands/Help.java b/src/main/java/me/sat7/dynamicshop/commands/Help.java index 896c772..876175e 100644 --- a/src/main/java/me/sat7/dynamicshop/commands/Help.java +++ b/src/main/java/me/sat7/dynamicshop/commands/Help.java @@ -55,7 +55,7 @@ public static void showHelp(String helpcode, Player player, String[] args) if (player.hasPermission(P_ADMIN_SHOP_EDIT) || player.hasPermission(P_ADMIN_EDIT_ALL)) { player.sendMessage(" - " + t(player, "HELP.USAGE") - + ": /ds shop "); + + ": /ds shop "); } if (player.hasPermission(P_ADMIN_SHOP_EDIT)) @@ -218,5 +218,9 @@ else if (helpcode.equals("resetTradingVolume")) { CMDManager.resetTradingVolume.SendHelpMessage(player); } + else if (helpcode.equals("background")) + { + CMDManager.background.SendHelpMessage(player); + } } } diff --git a/src/main/java/me/sat7/dynamicshop/commands/shop/Background.java b/src/main/java/me/sat7/dynamicshop/commands/shop/Background.java new file mode 100644 index 0000000..b79e9d1 --- /dev/null +++ b/src/main/java/me/sat7/dynamicshop/commands/shop/Background.java @@ -0,0 +1,39 @@ +package me.sat7.dynamicshop.commands.shop; + +import me.sat7.dynamicshop.DynamicShop; +import me.sat7.dynamicshop.commands.DSCMD; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import static me.sat7.dynamicshop.constants.Constants.P_ADMIN_SHOP_EDIT; +import static me.sat7.dynamicshop.utilities.LangUtil.t; + +public class Background extends DSCMD +{ + public Background() + { + inGameUseOnly = false; + permission = P_ADMIN_SHOP_EDIT; + validArgCount.add(4); + } + + @Override + public void SendHelpMessage(Player player) + { + player.sendMessage(DynamicShop.dsPrefix(player) + t(player, "HELP.TITLE").replace("{command}", "background")); + player.sendMessage(" - " + t(player, "HELP.USAGE") + ": ... background "); + + player.sendMessage(""); + } + + @Override + public void RunCMD(String[] args, CommandSender sender) + { + if(!CheckValid(args, sender)) + return; + + Player player = (Player) sender; + if (player != null) + DynamicShop.PaidOnlyMsg(player); + } +} diff --git a/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java b/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java index 7ed1aa6..9a635b1 100644 --- a/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java +++ b/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java @@ -40,7 +40,8 @@ public ShopSettings() private final int ENABLE_TOGGLE = 0; private final int PERMISSION = 1; private final int MAX_PAGE = 2; - private final int ROTATION_EDITOR = 3; + private final int BACKGROUND = 3; + private final int ROTATION_EDITOR = 4; private final int SHOP_HOUR = 6; private final int SHOP_HOUR_OPEN = 7; private final int SHOP_HOUR_CLOSE = 8; @@ -129,6 +130,13 @@ public Inventory getGui(Player player, String shopName) //최대 페이지 버튼 CreateButton(MAX_PAGE, InGameUI.GetPageButtonIconMat(), t(player, "SHOP_SETTING.MAX_PAGE"), new ArrayList<>(Arrays.asList(t(player, "SHOP_SETTING.MAX_PAGE_LORE"), t(player, "SHOP_SETTING.L_R_SHIFT"))), data.get().getInt("Options.page")); + // 배경 색상 + String color = confSec_Options.getString("background",""); + Material mat = Material.getMaterial( color.toUpperCase() + "_CONCRETE"); + if (mat == null) + mat = Material.LIGHT_GRAY_CONCRETE; + CreateButton(BACKGROUND, mat, t(player, "SHOP_SETTING.BACKGROUND"), "§7" + ChatColor.stripColor(t(player, "SHOP_SETTING.BACKGROUND_LORE"))); + // 로테이션 에디터 int currentRotation = confSec_Options.getInt("Rotation.Current", -1); String rotationString = currentRotation == -1 ? t(player, "ROTATION_EDITOR.DISABLED") : String.valueOf(currentRotation + 1); @@ -418,6 +426,11 @@ else if (e.getSlot() == MAX_PAGE) } DynaShopAPI.openShopSettingGui(player, shopName); } + // 배경 색상 변경 + else if (e.getSlot() == BACKGROUND) + { + DynamicShop.PaidOnlyMsg(player); + } // 로테이션 편집기 else if (e.getSlot() == ROTATION_EDITOR) { diff --git a/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java b/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java index a862f59..c809e61 100644 --- a/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java +++ b/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java @@ -102,6 +102,7 @@ public static void setupLangFile(String lang) ccLang.get().addDefault("SHOP.TRADE_LIMIT_BUY", "§a구매량 제한 : {num} 남음"); ccLang.get().addDefault("SHOP.TRADE_LIMIT_SELL", "§a판매량 제한 : {num} 남음"); ccLang.get().addDefault("SHOP.TRADE_LIMIT_TIMER", "§a다음 리셋: {time}"); + ccLang.get().addDefault("SHOP.CLICK_TO_ADD", "§e클릭: 추가"); ccLang.get().addDefault("SHOP_SETTING_TITLE", "§3상점 설정"); ccLang.get().addDefault("SHOP_SETTING.LOG_TOGGLE_LORE", "§e우클릭: 로그 뷰어"); @@ -109,6 +110,8 @@ public static void setupLangFile(String lang) ccLang.get().addDefault("SHOP_SETTING.LOG_PRINT_ADMIN", "§f로그를 어드민에게 출력"); ccLang.get().addDefault("SHOP_SETTING.MAX_PAGE", "§f최대 페이지"); ccLang.get().addDefault("SHOP_SETTING.MAX_PAGE_LORE", "§f상점의 최대 페이지를 설정합니다"); + ccLang.get().addDefault("SHOP_SETTING.BACKGROUND", "§f배경 색상"); + ccLang.get().addDefault("SHOP_SETTING.BACKGROUND_LORE", "§e클릭: 변경"); ccLang.get().addDefault("SHOP_SETTING.L_R_SHIFT", "§e좌: -1 우: +1 Shift: x5"); ccLang.get().addDefault("SHOP_SETTING.FLAG", "§f플래그"); ccLang.get().addDefault("SHOP_SETTING.SHOP_SETTINGS_LORE", "§e우클릭: 상점 편집"); @@ -546,6 +549,7 @@ public static void setupLangFile(String lang) ccLang.get().addDefault("SHOP.TRADE_LIMIT_BUY", "§aPurchase limit: {num}left"); ccLang.get().addDefault("SHOP.TRADE_LIMIT_SELL", "§aSales limit: {num}left"); ccLang.get().addDefault("SHOP.TRADE_LIMIT_TIMER", "§aNext reset: {time}"); + ccLang.get().addDefault("SHOP.CLICK_TO_ADD", "§eClick: Add"); ccLang.get().addDefault("SHOP_SETTING_TITLE", "§3Shop Settings"); ccLang.get().addDefault("SHOP_SETTING.LOG_TOGGLE_LORE", "§eRMB: Log Viewer"); @@ -553,6 +557,8 @@ public static void setupLangFile(String lang) ccLang.get().addDefault("SHOP_SETTING.LOG_PRINT_ADMIN", "§fPrint log to admin"); ccLang.get().addDefault("SHOP_SETTING.MAX_PAGE", "§fMax page"); ccLang.get().addDefault("SHOP_SETTING.MAX_PAGE_LORE", "§fSets the maximum page for the shop."); + ccLang.get().addDefault("SHOP_SETTING.BACKGROUND", "§fBackground color"); + ccLang.get().addDefault("SHOP_SETTING.BACKGROUND_LORE", "§eClick: Change color"); ccLang.get().addDefault("SHOP_SETTING.L_R_SHIFT", "§eLMB: -1 RMB: +1 Shift: x5"); ccLang.get().addDefault("SHOP_SETTING.FLAG", "§fFlag"); ccLang.get().addDefault("SHOP_SETTING.SHOP_SETTINGS_LORE", "§eRMB: Shop Settings"); diff --git a/src/main/java/me/sat7/dynamicshop/utilities/TabCompleteUtil.java b/src/main/java/me/sat7/dynamicshop/utilities/TabCompleteUtil.java index 87cb2a1..ee05100 100644 --- a/src/main/java/me/sat7/dynamicshop/utilities/TabCompleteUtil.java +++ b/src/main/java/me/sat7/dynamicshop/utilities/TabCompleteUtil.java @@ -154,6 +154,7 @@ else if (cmd.getName().equalsIgnoreCase("shop") && args.length == 1) temp.add("sellbuy"); temp.add("log"); temp.add("resetTradingVolume"); + temp.add("background"); } AddToAutoCompleteIfValid(args[2]); @@ -458,6 +459,31 @@ else if (args.length == 5) Help.showHelp("resetTradingVolume", (Player) sender, args); } + } else if (args[2].equalsIgnoreCase("background") && sender.hasPermission(P_ADMIN_SHOP_EDIT)) + { + if (args.length == 4) + { + temp.add("clear"); + temp.add("black"); + temp.add("gray"); + temp.add("light_gray"); + temp.add("white"); + temp.add("cyan"); + temp.add("light_blue"); + temp.add("blue"); + temp.add("brown"); + temp.add("green"); + temp.add("lime"); + temp.add("yellow"); + temp.add("orange"); + temp.add("pink"); + temp.add("magenta"); + temp.add("purple"); + temp.add("red"); + AddToAutoCompleteIfValid(args[3]); + } + + Help.showHelp("background", (Player) sender, args); } } } else if (args[0].equalsIgnoreCase("createshop") && sender.hasPermission(P_ADMIN_CREATE_SHOP))