Fixed Message Config and reloading

This commit is contained in:
Teriuihi 2022-09-02 03:31:42 +02:00 committed by Len
parent aa00c8d1f7
commit 4215d18ca5
2 changed files with 14 additions and 10 deletions

View File

@ -1,5 +1,8 @@
package com.alttd.playershops.commands;
import com.alttd.playershops.PlayerShops;
import com.alttd.playershops.config.Config;
import com.alttd.playershops.config.MessageConfig;
import com.alttd.playershops.gui.HomeGui;
import com.alttd.playershops.gui.ShopManagementGui;
import com.alttd.playershops.shop.PlayerShop;
@ -24,6 +27,7 @@ public class ShopCommand implements CommandExecutor, TabCompleter {
}
switch (args[0].toLowerCase()) {
case "reload":
PlayerShops.getInstance().reloadConfigs();
break;
case "open":
HomeGui gui = new HomeGui(player.getUniqueId());

View File

@ -17,7 +17,7 @@ public class MessageConfig extends AbstractConfiguration {
version = config.getInt("config-version", 1);
config.set("config-version", 1);
config.readConfig(Config.class, null);
config.readConfig(MessageConfig.class, null);
}
public static String SHOP_ALREADY_EXISTS = "<red>This block is already a Shop</red>";
@ -26,16 +26,16 @@ public class MessageConfig extends AbstractConfiguration {
public static String BREAK_SHOP_WHILE_CONVERSING = "<red>You can not break shop signs while editing them.</red>";
public static String NO_PERMISSION_FOR_SHOP_TYPE = "<red>You do not have permission to use <shop_type> shops.";
void loadErrorMessages() {
SHOP_ALREADY_EXISTS = getString("errors.shop-already-exists", SHOP_ALREADY_EXISTS);
NO_SHOP_CREATE_PERMISSION = getString("errors.no-shop-create-permission", NO_SHOP_CREATE_PERMISSION);
SHOP_LIMIT_REACHED = getString("errors.shop-limit-reached", SHOP_LIMIT_REACHED);
BREAK_SHOP_WHILE_CONVERSING = getString("errors.break-shop-while-conversing", BREAK_SHOP_WHILE_CONVERSING);
NO_PERMISSION_FOR_SHOP_TYPE = getString("permissions-messages.shop-type", NO_PERMISSION_FOR_SHOP_TYPE);
private static void loadErrorMessages() {
SHOP_ALREADY_EXISTS = config.getString("errors.shop-already-exists", SHOP_ALREADY_EXISTS);
NO_SHOP_CREATE_PERMISSION = config.getString("errors.no-shop-create-permission", NO_SHOP_CREATE_PERMISSION);
SHOP_LIMIT_REACHED = config.getString("errors.shop-limit-reached", SHOP_LIMIT_REACHED);
BREAK_SHOP_WHILE_CONVERSING = config.getString("errors.break-shop-while-conversing", BREAK_SHOP_WHILE_CONVERSING);
NO_PERMISSION_FOR_SHOP_TYPE = config.getString("permissions-messages.shop-type", NO_PERMISSION_FOR_SHOP_TYPE);
}
public static String SHOP_INFO = "This shop <action> <amount> <blue><item></blue> for <price>.";
void otherMessages() {
SHOP_INFO = getString("messages.shop-info", SHOP_INFO);
public static String SHOP_INFO = "This shop <action> <amount> <item> for <price>.";
private static void otherMessages() {
SHOP_INFO = config.getString("messages.shop-info", SHOP_INFO);
}
}