Skip to content

Commit

Permalink
Background color(premium only)
Browse files Browse the repository at this point in the history
  • Loading branch information
7sat committed Apr 22, 2023
1 parent c9e9808 commit 347163b
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/java/me/sat7/dynamicshop/commands/CMDManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/me/sat7/dynamicshop/commands/Help.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <shopname> <enable | addhand | add | edit | editall | setToRecAll | sellbuy | permission | maxpage | flag | currency | position | shophours | fluctuation | stockStabilizing | command | account | log | resetTradingVolume>");
+ ": /ds shop <shopname> <enable | addhand | add | edit | editall | setToRecAll | sellbuy | permission | maxpage | flag | currency | position | shophours | fluctuation | stockStabilizing | command | account | log | resetTradingVolume | background>");
}

if (player.hasPermission(P_ADMIN_SHOP_EDIT))
Expand Down Expand Up @@ -218,5 +218,9 @@ else if (helpcode.equals("resetTradingVolume"))
{
CMDManager.resetTradingVolume.SendHelpMessage(player);
}
else if (helpcode.equals("background"))
{
CMDManager.background.SendHelpMessage(player);
}
}
}
39 changes: 39 additions & 0 deletions src/main/java/me/sat7/dynamicshop/commands/shop/Background.java
Original file line number Diff line number Diff line change
@@ -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 <color | clear>");

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);
}
}
15 changes: 14 additions & 1 deletion src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,16 @@ 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우클릭: 로그 뷰어");
ccLang.get().addDefault("SHOP_SETTING.LOG_PRINT_CONSOLE", "§f로그를 콘솔에 출력");
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우클릭: 상점 편집");
Expand Down Expand Up @@ -546,13 +549,16 @@ 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");
ccLang.get().addDefault("SHOP_SETTING.LOG_PRINT_CONSOLE", "§fPrint log to console");
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");
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/me/sat7/dynamicshop/utilities/TabCompleteUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 347163b

Please sign in to comment.