mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-12-22 17:11:46 +00:00
Renamed config variables
This commit is contained in:
parent
47b23f126e
commit
5bfb0a1a22
2
pom.xml
2
pom.xml
@ -20,7 +20,7 @@
|
||||
<project.build.outputEncoding>${projectEncoding}</project.build.outputEncoding>
|
||||
|
||||
<!-- JDK Version -->
|
||||
<jdkVersion>1.7</jdkVersion>
|
||||
<jdkVersion>1.8</jdkVersion>
|
||||
<maven.compiler.source>${jdkVersion}</maven.compiler.source>
|
||||
<maven.compiler.target>${jdkVersion}</maven.compiler.target>
|
||||
|
||||
|
@ -11,7 +11,8 @@ import de.epiceric.shopchest.event.ShopInitializedEvent;
|
||||
import de.epiceric.shopchest.external.PlotSquaredShopFlag;
|
||||
import de.epiceric.shopchest.external.WorldGuardShopFlag;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.language.Message;
|
||||
import de.epiceric.shopchest.language.Replacement;
|
||||
import de.epiceric.shopchest.listeners.AreaShopListener;
|
||||
import de.epiceric.shopchest.listeners.BlockExplodeListener;
|
||||
import de.epiceric.shopchest.listeners.ChestProtectListener;
|
||||
@ -39,7 +40,6 @@ import me.wiefferink.areashop.AreaShop;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bstats.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@ -106,7 +106,7 @@ public class ShopChest extends JavaPlugin {
|
||||
|
||||
config = new Config(this);
|
||||
|
||||
if (config.enable_debug_log) {
|
||||
if (Config.enableDebugLog) {
|
||||
File debugLogFile = new File(getDataFolder(), "debug.txt");
|
||||
|
||||
try {
|
||||
@ -128,7 +128,7 @@ public class ShopChest extends JavaPlugin {
|
||||
Plugin worldGuardPlugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if (worldGuardPlugin instanceof WorldGuardPlugin) {
|
||||
worldGuard = (WorldGuardPlugin) worldGuardPlugin;
|
||||
WorldGuardShopFlag.register(this, true);
|
||||
WorldGuardShopFlag.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ public class ShopChest extends JavaPlugin {
|
||||
database.disconnect();
|
||||
}
|
||||
|
||||
if (fw != null && config.enable_debug_log) {
|
||||
if (fw != null && Config.enableDebugLog) {
|
||||
try {
|
||||
fw.close();
|
||||
} catch (IOException e) {
|
||||
@ -227,21 +227,6 @@ public class ShopChest extends JavaPlugin {
|
||||
}
|
||||
|
||||
private void loadExternalPlugins() {
|
||||
if (worldGuard != null && !WorldGuardShopFlag.isLoaded()) {
|
||||
WorldGuardShopFlag.register(this, false);
|
||||
|
||||
try {
|
||||
// Reload WorldGuard regions, so that custom flags are applied
|
||||
for (World world : getServer().getWorlds()) {
|
||||
worldGuard.getRegionManager(world).load();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
getLogger().severe("Failed to reload WorldGuard region manager. WorldGuard support will probably not work!");
|
||||
debug("Failed to load WorldGuard region manager");
|
||||
debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
Plugin townyPlugin = Bukkit.getServer().getPluginManager().getPlugin("Towny");
|
||||
if (townyPlugin instanceof Towny) {
|
||||
towny = (Towny) townyPlugin;
|
||||
@ -307,11 +292,11 @@ public class ShopChest extends JavaPlugin {
|
||||
metrics.addCustomChart(new Metrics.SimplePie("database_type") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
return config.database_type.toString();
|
||||
return Config.databaseType.toString();
|
||||
}
|
||||
});
|
||||
|
||||
if (config.database_type == Database.DatabaseType.SQLite) {
|
||||
if (Config.databaseType == Database.DatabaseType.SQLite) {
|
||||
debug("Using database type: SQLite");
|
||||
getLogger().info("Using SQLite");
|
||||
database = new SQLite(this);
|
||||
@ -319,7 +304,7 @@ public class ShopChest extends JavaPlugin {
|
||||
debug("Using database type: MySQL");
|
||||
getLogger().info("Using MySQL");
|
||||
database = new MySQL(this);
|
||||
if (config.database_mysql_ping_interval > 0) {
|
||||
if (Config.databaseMySqlPingInterval > 0) {
|
||||
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -327,7 +312,7 @@ public class ShopChest extends JavaPlugin {
|
||||
((MySQL) database).ping();
|
||||
}
|
||||
}
|
||||
}, config.database_mysql_ping_interval * 20L, config.database_mysql_ping_interval * 20L);
|
||||
}, Config.databaseMySqlPingInterval * 20L, Config.databaseMySqlPingInterval * 20L);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -339,16 +324,16 @@ public class ShopChest extends JavaPlugin {
|
||||
UpdateChecker uc = new UpdateChecker(ShopChest.this);
|
||||
UpdateCheckerResult result = uc.check();
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CHECKING));
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(Message.UPDATE_CHECKING));
|
||||
if (result == UpdateCheckerResult.TRUE) {
|
||||
latestVersion = uc.getVersion();
|
||||
downloadLink = uc.getLink();
|
||||
isUpdateNeeded = true;
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedPlaceholder(Placeholder.VERSION, latestVersion)));
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(Message.UPDATE_AVAILABLE, new Replacement(Placeholder.VERSION, latestVersion)));
|
||||
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
if (p.hasPermission(Permissions.UPDATE_NOTIFICATION)) {
|
||||
JsonBuilder jb = new JsonBuilder(ShopChest.this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedPlaceholder(Placeholder.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
JsonBuilder jb = new JsonBuilder(ShopChest.this, LanguageUtils.getMessage(Message.UPDATE_AVAILABLE, new Replacement(Placeholder.VERSION, latestVersion)), LanguageUtils.getMessage(Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
jb.sendJson(p);
|
||||
}
|
||||
}
|
||||
@ -357,12 +342,12 @@ public class ShopChest extends JavaPlugin {
|
||||
latestVersion = "";
|
||||
downloadLink = "";
|
||||
isUpdateNeeded = false;
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_NO_UPDATE));
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(Message.UPDATE_NO_UPDATE));
|
||||
} else {
|
||||
latestVersion = "";
|
||||
downloadLink = "";
|
||||
isUpdateNeeded = false;
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_ERROR));
|
||||
Bukkit.getConsoleSender().sendMessage("[ShopChest] " + LanguageUtils.getMessage(Message.UPDATE_ERROR));
|
||||
}
|
||||
}
|
||||
}.runTaskAsynchronously(this);
|
||||
@ -409,7 +394,7 @@ public class ShopChest extends JavaPlugin {
|
||||
* @param message Message to print
|
||||
*/
|
||||
public void debug(String message) {
|
||||
if (config.enable_debug_log && fw != null) {
|
||||
if (Config.enableDebugLog && fw != null) {
|
||||
try {
|
||||
Calendar c = Calendar.getInstance();
|
||||
String timestamp = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(c.getTime());
|
||||
@ -427,7 +412,7 @@ public class ShopChest extends JavaPlugin {
|
||||
* @param throwable {@link Throwable} whose stacktrace will be printed
|
||||
*/
|
||||
public void debug(Throwable throwable) {
|
||||
if (config.enable_debug_log && fw != null) {
|
||||
if (Config.enableDebugLog && fw != null) {
|
||||
PrintWriter pw = new PrintWriter(fw);
|
||||
throwable.printStackTrace(pw);
|
||||
pw.flush();
|
||||
|
@ -1,18 +1,15 @@
|
||||
package de.epiceric.shopchest.command;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import de.epiceric.shopchest.config.Placeholder;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.language.Message;
|
||||
import de.epiceric.shopchest.language.Replacement;
|
||||
import de.epiceric.shopchest.utils.Permissions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -41,14 +38,13 @@ public class ShopCommand {
|
||||
}
|
||||
|
||||
this.plugin = plugin;
|
||||
this.name = plugin.getShopChestConfig().main_command_name;
|
||||
this.name = Config.mainCommandName;
|
||||
this.pluginCommand = createPluginCommand();
|
||||
|
||||
ShopCommandExecutor executor = new ShopCommandExecutor(plugin);
|
||||
ShopTabCompleter tabCompleter = new ShopTabCompleter(plugin);
|
||||
|
||||
final LocalizedMessage.ReplacedPlaceholder cmdPlaceholder = new LocalizedMessage.ReplacedPlaceholder(
|
||||
Placeholder.COMMAND, plugin.getShopChestConfig().main_command_name);
|
||||
final Replacement cmdReplacement = new Replacement(Placeholder.COMMAND, name);
|
||||
|
||||
addSubCommand(new ShopSubCommand("create", true, executor, tabCompleter) {
|
||||
@Override
|
||||
@ -65,9 +61,9 @@ public class ShopCommand {
|
||||
}
|
||||
|
||||
if (sender.hasPermission(Permissions.CREATE_ADMIN)) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE_ADMIN, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_CREATE_ADMIN, cmdReplacement);
|
||||
} else if (receiveCreateMessage) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_CREATE, cmdReplacement);
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -77,28 +73,28 @@ public class ShopCommand {
|
||||
addSubCommand(new ShopSubCommand("remove", true, executor, tabCompleter) {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_REMOVE, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_REMOVE, cmdReplacement);
|
||||
}
|
||||
});
|
||||
|
||||
addSubCommand(new ShopSubCommand("info", true, executor, tabCompleter) {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_INFO, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_INFO, cmdReplacement);
|
||||
}
|
||||
});
|
||||
|
||||
addSubCommand(new ShopSubCommand("limits", true, executor, tabCompleter) {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_LIMITS, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_LIMITS, cmdReplacement);
|
||||
}
|
||||
});
|
||||
|
||||
addSubCommand(new ShopSubCommand("open", true, executor, tabCompleter) {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_OPEN, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_OPEN, cmdReplacement);
|
||||
}
|
||||
});
|
||||
|
||||
@ -106,7 +102,7 @@ public class ShopCommand {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
if (sender.hasPermission(Permissions.REMOVE_OTHER)) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_REMOVEALL, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_REMOVEALL, cmdReplacement);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@ -117,7 +113,7 @@ public class ShopCommand {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
if (sender.hasPermission(Permissions.RELOAD)) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_RELOAD, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_RELOAD, cmdReplacement);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@ -128,7 +124,7 @@ public class ShopCommand {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
if (sender.hasPermission(Permissions.UPDATE)) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_UPDATE, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_UPDATE, cmdReplacement);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@ -139,7 +135,7 @@ public class ShopCommand {
|
||||
@Override
|
||||
public String getHelpMessage(CommandSender sender) {
|
||||
if (sender.hasPermission(Permissions.CONFIG)) {
|
||||
return LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CONFIG, cmdPlaceholder);
|
||||
return LanguageUtils.getMessage(Message.COMMAND_DESC_CONFIG, cmdReplacement);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@ -208,14 +204,15 @@ public class ShopCommand {
|
||||
|
||||
/**
|
||||
* Sends the basic help message
|
||||
*
|
||||
* @param sender {@link CommandSender} who will receive the message
|
||||
*/
|
||||
private void sendBasicHelpMessage(CommandSender sender) {
|
||||
plugin.debug("Sending basic help message to " + sender.getName());
|
||||
|
||||
sender.sendMessage(" ");
|
||||
String header = LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_HEADER,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.COMMAND, plugin.getShopChestConfig().main_command_name));
|
||||
String header = LanguageUtils.getMessage(Message.COMMAND_DESC_HEADER,
|
||||
new Replacement(Placeholder.COMMAND, Config.mainCommandName));
|
||||
|
||||
if (!header.trim().isEmpty()) sender.sendMessage(header);
|
||||
|
||||
@ -228,8 +225,8 @@ public class ShopCommand {
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
|
||||
String footer = LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_FOOTER,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.COMMAND, plugin.getShopChestConfig().main_command_name));
|
||||
String footer = LanguageUtils.getMessage(Message.COMMAND_DESC_FOOTER,
|
||||
new Replacement(Placeholder.COMMAND,Config.mainCommandName));
|
||||
|
||||
if (!footer.trim().isEmpty()) sender.sendMessage(footer);
|
||||
sender.sendMessage(" ");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.epiceric.shopchest.command;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import de.epiceric.shopchest.config.Placeholder;
|
||||
import de.epiceric.shopchest.event.ShopPreCreateEvent;
|
||||
import de.epiceric.shopchest.event.ShopPreInfoEvent;
|
||||
@ -9,7 +10,8 @@ import de.epiceric.shopchest.event.ShopPreRemoveEvent;
|
||||
import de.epiceric.shopchest.event.ShopReloadEvent;
|
||||
import de.epiceric.shopchest.event.ShopRemoveAllEvent;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.language.Message;
|
||||
import de.epiceric.shopchest.language.Replacement;
|
||||
import de.epiceric.shopchest.nms.JsonBuilder;
|
||||
import de.epiceric.shopchest.shop.Shop;
|
||||
import de.epiceric.shopchest.utils.Callback;
|
||||
@ -65,19 +67,19 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
if (sender.hasPermission(Permissions.RELOAD)) {
|
||||
reload(sender);
|
||||
} else {
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_RELOAD));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_RELOAD));
|
||||
}
|
||||
} else if (subCommand.getName().equalsIgnoreCase("update")) {
|
||||
if (sender.hasPermission(Permissions.UPDATE)) {
|
||||
checkUpdates(sender);
|
||||
} else {
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_UPDATE));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_UPDATE));
|
||||
}
|
||||
} else if (subCommand.getName().equalsIgnoreCase("config")) {
|
||||
if (sender.hasPermission(Permissions.CONFIG)) {
|
||||
return args.length >= 4 && changeConfig(sender, args);
|
||||
} else {
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CONFIG));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_CONFIG));
|
||||
}
|
||||
} else if (subCommand.getName().equalsIgnoreCase("removeall")) {
|
||||
if (sender.hasPermission(Permissions.REMOVE_OTHER)) {
|
||||
@ -87,7 +89,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_REMOVE_OTHERS));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_REMOVE_OTHERS));
|
||||
}
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
@ -103,7 +105,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
if (p.hasPermission(Permissions.CREATE_ADMIN)) {
|
||||
create(args, Shop.ShopType.ADMIN, p);
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE_ADMIN));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_CREATE_ADMIN));
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
@ -118,9 +120,9 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
} else if (subCommand.getName().equalsIgnoreCase("limits")) {
|
||||
plugin.debug(p.getName() + " is viewing his shop limits: " + shopUtils.getShopAmount(p) + "/" + shopUtils.getShopLimit(p));
|
||||
int limit = shopUtils.getShopLimit(p);
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.OCCUPIED_SHOP_SLOTS,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.LIMIT, (limit < 0 ? "∞" : String.valueOf(limit))),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(shopUtils.getShopAmount(p)))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.OCCUPIED_SHOP_SLOTS,
|
||||
new Replacement(Placeholder.LIMIT, (limit < 0 ? "∞" : String.valueOf(limit))),
|
||||
new Replacement(Placeholder.AMOUNT, String.valueOf(shopUtils.getShopAmount(p)))));
|
||||
} else if (subCommand.getName().equalsIgnoreCase("open")) {
|
||||
open(p);
|
||||
} else {
|
||||
@ -142,7 +144,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
private void checkUpdates(CommandSender sender) {
|
||||
plugin.debug(sender.getName() + " is checking for updates");
|
||||
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CHECKING));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.UPDATE_CHECKING));
|
||||
|
||||
UpdateChecker uc = new UpdateChecker(ShopChest.getInstance());
|
||||
UpdateChecker.UpdateCheckerResult result = uc.check();
|
||||
@ -153,22 +155,22 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
plugin.setUpdateNeeded(true);
|
||||
|
||||
if (sender instanceof Player) {
|
||||
JsonBuilder jb = new JsonBuilder(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedPlaceholder(Placeholder.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
JsonBuilder jb = new JsonBuilder(plugin, LanguageUtils.getMessage(Message.UPDATE_AVAILABLE, new Replacement(Placeholder.VERSION, uc.getVersion())), LanguageUtils.getMessage(Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
jb.sendJson((Player) sender);
|
||||
} else {
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedPlaceholder(Placeholder.VERSION, uc.getVersion())));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.UPDATE_AVAILABLE, new Replacement(Placeholder.VERSION, uc.getVersion())));
|
||||
}
|
||||
|
||||
} else if (result == UpdateChecker.UpdateCheckerResult.FALSE) {
|
||||
plugin.setLatestVersion("");
|
||||
plugin.setDownloadLink("");
|
||||
plugin.setUpdateNeeded(false);
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_NO_UPDATE));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.UPDATE_NO_UPDATE));
|
||||
} else {
|
||||
plugin.setLatestVersion("");
|
||||
plugin.setDownloadLink("");
|
||||
plugin.setUpdateNeeded(false);
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_ERROR));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.UPDATE_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,8 +191,8 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
shopUtils.reloadShops(true, true, new Callback<Integer>(plugin) {
|
||||
@Override
|
||||
public void onResult(Integer result) {
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.RELOADED_SHOPS,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(result))));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.RELOADED_SHOPS,
|
||||
new Replacement(Placeholder.AMOUNT, String.valueOf(result))));
|
||||
plugin.debug(sender.getName() + " has reloaded " + result + " shops");
|
||||
}
|
||||
});
|
||||
@ -214,13 +216,13 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
buyPrice = Double.parseDouble(args[2]);
|
||||
sellPrice = Double.parseDouble(args[3]);
|
||||
} catch (NumberFormatException e) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.AMOUNT_PRICE_NOT_NUMBER));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.AMOUNT_PRICE_NOT_NUMBER));
|
||||
plugin.debug(p.getName() + " has entered an invalid amount and/or prices");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Utils.hasPermissionToCreateShop(p, Utils.getPreferredItemInHand(p), buyPrice > 0, sellPrice > 0)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_CREATE));
|
||||
plugin.debug(p.getName() + " is not permitted to create the shop");
|
||||
return;
|
||||
}
|
||||
@ -229,8 +231,8 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
int limit = shopUtils.getShopLimit(p);
|
||||
if (limit != -1) {
|
||||
if (shopUtils.getShopAmount(p) >= limit) {
|
||||
if (shopType != Shop.ShopType.ADMIN || !plugin.getShopChestConfig().exclude_admin_shops) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_LIMIT_REACHED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.LIMIT, String.valueOf(limit))));
|
||||
if (shopType != Shop.ShopType.ADMIN || !Config.excludeAdminShops) {
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.SHOP_LIMIT_REACHED, new Replacement(Placeholder.LIMIT, String.valueOf(limit))));
|
||||
plugin.debug(p.getName() + " has reached the limit");
|
||||
return;
|
||||
}
|
||||
@ -238,13 +240,13 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (amount <= 0) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.AMOUNT_IS_ZERO));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.AMOUNT_IS_ZERO));
|
||||
plugin.debug(p.getName() + " has entered an invalid amount");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin.getShopChestConfig().allow_decimals_in_price && (buyPrice != (int) buyPrice || sellPrice != (int) sellPrice)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.PRICES_CONTAIN_DECIMALS));
|
||||
if (!Config.allowDecimalsInPrice && (buyPrice != (int) buyPrice || sellPrice != (int) sellPrice)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.PRICES_CONTAIN_DECIMALS));
|
||||
plugin.debug(p.getName() + " has entered an invalid price");
|
||||
return;
|
||||
}
|
||||
@ -253,7 +255,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
boolean sellEnabled = sellPrice > 0;
|
||||
|
||||
if (!buyEnabled && !sellEnabled) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUY_SELL_DISABLED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.BUY_SELL_DISABLED));
|
||||
plugin.debug(p.getName() + " has disabled buying and selling");
|
||||
return;
|
||||
}
|
||||
@ -262,13 +264,13 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
|
||||
// Check if item in hand
|
||||
if (inHand == null) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_ITEM_IN_HAND));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_ITEM_IN_HAND));
|
||||
plugin.debug(p.getName() + " does not have an item in his hand");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if item on blacklist
|
||||
for (String item : plugin.getShopChestConfig().blacklist) {
|
||||
for (String item :Config.blacklist) {
|
||||
ItemStack itemStack = ItemUtils.getItemStack(item);
|
||||
|
||||
if (itemStack == null) {
|
||||
@ -278,14 +280,14 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (itemStack.getType().equals(inHand.getType()) && itemStack.getDurability() == inHand.getDurability()) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CANNOT_SELL_ITEM));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CANNOT_SELL_ITEM));
|
||||
plugin.debug(p.getName() + "'s item is on the blacklist");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if prices lower than minimum price
|
||||
for (String key : plugin.getShopChestConfig().minimum_prices) {
|
||||
for (String key :Config.minimumPrices) {
|
||||
ItemStack itemStack = ItemUtils.getItemStack(key);
|
||||
double minPrice = plugin.getConfig().getDouble("minimum-prices." + key);
|
||||
|
||||
@ -298,7 +300,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
if (itemStack.getType().equals(inHand.getType()) && itemStack.getDurability() == inHand.getDurability()) {
|
||||
if (buyEnabled) {
|
||||
if ((buyPrice < amount * minPrice) && (buyPrice > 0)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUY_PRICE_TOO_LOW, new LocalizedMessage.ReplacedPlaceholder(Placeholder.MIN_PRICE, String.valueOf(amount * minPrice))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.BUY_PRICE_TOO_LOW, new Replacement(Placeholder.MIN_PRICE, String.valueOf(amount * minPrice))));
|
||||
plugin.debug(p.getName() + "'s buy price is lower than the minimum");
|
||||
return;
|
||||
}
|
||||
@ -306,7 +308,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
|
||||
if (sellEnabled) {
|
||||
if ((sellPrice < amount * minPrice) && (sellPrice > 0)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SELL_PRICE_TOO_LOW, new LocalizedMessage.ReplacedPlaceholder(Placeholder.MIN_PRICE, String.valueOf(amount * minPrice))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.SELL_PRICE_TOO_LOW, new Replacement(Placeholder.MIN_PRICE, String.valueOf(amount * minPrice))));
|
||||
plugin.debug(p.getName() + "'s sell price is lower than the minimum");
|
||||
return;
|
||||
}
|
||||
@ -315,7 +317,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
}
|
||||
|
||||
// Check if prices higher than maximum price
|
||||
for (String key : plugin.getShopChestConfig().maximum_prices) {
|
||||
for (String key :Config.maximumPrices) {
|
||||
ItemStack itemStack = ItemUtils.getItemStack(key);
|
||||
double maxPrice = plugin.getConfig().getDouble("maximum-prices." + key);
|
||||
|
||||
@ -328,7 +330,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
if (itemStack.getType().equals(inHand.getType()) && itemStack.getDurability() == inHand.getDurability()) {
|
||||
if (buyEnabled) {
|
||||
if ((buyPrice > amount * maxPrice) && (buyPrice > 0)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUY_PRICE_TOO_HIGH, new LocalizedMessage.ReplacedPlaceholder(Placeholder.MAX_PRICE, String.valueOf(amount * maxPrice))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.BUY_PRICE_TOO_HIGH, new Replacement(Placeholder.MAX_PRICE, String.valueOf(amount * maxPrice))));
|
||||
plugin.debug(p.getName() + "'s buy price is higher than the maximum");
|
||||
return;
|
||||
}
|
||||
@ -336,7 +338,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
|
||||
if (sellEnabled) {
|
||||
if ((sellPrice > amount * maxPrice) && (sellPrice > 0)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SELL_PRICE_TOO_HIGH, new LocalizedMessage.ReplacedPlaceholder(Placeholder.MAX_PRICE, String.valueOf(amount * maxPrice))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.SELL_PRICE_TOO_HIGH, new Replacement(Placeholder.MAX_PRICE, String.valueOf(amount * maxPrice))));
|
||||
plugin.debug(p.getName() + "'s sell price is higher than the maximum");
|
||||
return;
|
||||
}
|
||||
@ -346,9 +348,9 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
|
||||
|
||||
if (sellEnabled && buyEnabled) {
|
||||
if (plugin.getShopChestConfig().buy_greater_or_equal_sell) {
|
||||
if (Config.buyGreaterOrEqualSell) {
|
||||
if (buyPrice < sellPrice) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUY_PRICE_TOO_LOW, new LocalizedMessage.ReplacedPlaceholder(Placeholder.MIN_PRICE, String.valueOf(sellPrice))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.BUY_PRICE_TOO_LOW, new Replacement(Placeholder.MIN_PRICE, String.valueOf(sellPrice))));
|
||||
plugin.debug(p.getName() + "'s buy price is lower than the sell price");
|
||||
return;
|
||||
}
|
||||
@ -359,17 +361,17 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
product.setItemMeta(inHand.getItemMeta());
|
||||
|
||||
if (Enchantment.DURABILITY.canEnchantItem(product)) {
|
||||
if (product.getDurability() > 0 && !plugin.getShopChestConfig().allow_broken_items) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CANNOT_SELL_BROKEN_ITEM));
|
||||
if (product.getDurability() > 0 && !Config.allowBrokenItems) {
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CANNOT_SELL_BROKEN_ITEM));
|
||||
plugin.debug(p.getName() + "'s item is broken");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
double creationPrice = (shopType == Shop.ShopType.NORMAL) ? plugin.getShopChestConfig().shop_creation_price_normal : plugin.getShopChestConfig().shop_creation_price_admin;
|
||||
double creationPrice = (shopType == Shop.ShopType.NORMAL) ?Config.shopCreationPriceNormal :Config.shopCreationPriceAdmin;
|
||||
if (creationPrice > 0) {
|
||||
if (plugin.getEconomy().getBalance(p, p.getWorld().getName()) < creationPrice) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_CREATE_NOT_ENOUGH_MONEY, new LocalizedMessage.ReplacedPlaceholder(Placeholder.CREATION_PRICE, String.valueOf(creationPrice))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.SHOP_CREATE_NOT_ENOUGH_MONEY, new Replacement(Placeholder.CREATION_PRICE, String.valueOf(creationPrice))));
|
||||
plugin.debug(p.getName() + " can not pay the creation price");
|
||||
return;
|
||||
}
|
||||
@ -381,7 +383,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
if (!event.isCancelled()) {
|
||||
ClickType.setPlayerClickType(p, new ClickType(ClickType.EnumClickType.CREATE, product, buyPrice, sellPrice, shopType));
|
||||
plugin.debug(p.getName() + " can now click a chest");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_CHEST_CREATE));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_CHEST_CREATE));
|
||||
|
||||
// Remove ClickType after 15 seconds if player has not clicked a chest
|
||||
new BukkitRunnable() {
|
||||
@ -410,7 +412,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
}
|
||||
|
||||
plugin.debug(p.getName() + " can now click a chest");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_CHEST_REMOVE));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_CHEST_REMOVE));
|
||||
ClickType.setPlayerClickType(p, new ClickType(ClickType.EnumClickType.REMOVE));
|
||||
|
||||
// Remove ClickType after 15 seconds if player has not clicked a chest
|
||||
@ -437,7 +439,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
}
|
||||
|
||||
plugin.debug(p.getName() + " can now click a chest");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_CHEST_INFO));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_CHEST_INFO));
|
||||
ClickType.setPlayerClickType(p, new ClickType(ClickType.EnumClickType.INFO));
|
||||
|
||||
// Remove ClickType after 15 seconds if player has not clicked a chest
|
||||
@ -464,7 +466,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
}
|
||||
|
||||
plugin.debug(p.getName() + " can now click a chest");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_CHEST_OPEN));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_CHEST_OPEN));
|
||||
ClickType.setPlayerClickType(p, new ClickType(ClickType.EnumClickType.OPEN));
|
||||
|
||||
// Remove ClickType after 15 seconds if player has not clicked a chest
|
||||
@ -484,13 +486,13 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
|
||||
if (args[1].equalsIgnoreCase("set")) {
|
||||
plugin.getShopChestConfig().set(property, value);
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHANGED_CONFIG_SET, new LocalizedMessage.ReplacedPlaceholder(Placeholder.PROPERTY, property), new LocalizedMessage.ReplacedPlaceholder(Placeholder.VALUE, value)));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.CHANGED_CONFIG_SET, new Replacement(Placeholder.PROPERTY, property), new Replacement(Placeholder.VALUE, value)));
|
||||
} else if (args[1].equalsIgnoreCase("add")) {
|
||||
plugin.getShopChestConfig().add(property, value);
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHANGED_CONFIG_ADDED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.PROPERTY, property), new LocalizedMessage.ReplacedPlaceholder(Placeholder.VALUE, value)));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.CHANGED_CONFIG_ADDED, new Replacement(Placeholder.PROPERTY, property), new Replacement(Placeholder.VALUE, value)));
|
||||
} else if (args[1].equalsIgnoreCase("remove")) {
|
||||
plugin.getShopChestConfig().remove(property, value);
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHANGED_CONFIG_REMOVED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.PROPERTY, property), new LocalizedMessage.ReplacedPlaceholder(Placeholder.VALUE, value)));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.CHANGED_CONFIG_REMOVED, new Replacement(Placeholder.PROPERTY, property), new Replacement(Placeholder.VALUE, value)));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -522,8 +524,8 @@ class ShopCommandExecutor implements CommandExecutor {
|
||||
shopUtils.removeShop(shop, true);
|
||||
}
|
||||
|
||||
sender.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ALL_SHOPS_REMOVED,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(shops.size())),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.VENDOR, vendor.getName())));
|
||||
sender.sendMessage(LanguageUtils.getMessage(Message.ALL_SHOPS_REMOVED,
|
||||
new Replacement(Placeholder.AMOUNT, String.valueOf(shops.size())),
|
||||
new Replacement(Placeholder.VENDOR, vendor.getName())));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.epiceric.shopchest.command;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
@ -20,7 +21,7 @@ class ShopTabCompleter implements TabCompleter {
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase(plugin.getShopChestConfig().main_command_name)) {
|
||||
if (command.getName().equalsIgnoreCase(Config.mainCommandName)) {
|
||||
|
||||
List<String> createSubCommands = Arrays.asList("admin", "normal");
|
||||
List<String> configSubCommands = Arrays.asList("add", "remove", "set");
|
||||
|
@ -20,198 +20,301 @@ import java.util.Set;
|
||||
|
||||
public class Config {
|
||||
|
||||
private ShopChest plugin;
|
||||
/**
|
||||
* The quality of hologram and item updating (performance saving, or better quality)
|
||||
**/
|
||||
public static ShopUpdater.UpdateQuality updateQuality;
|
||||
|
||||
private LanguageConfiguration langConfig;
|
||||
/**
|
||||
* The item with which a player can click a shop to retrieve information
|
||||
**/
|
||||
public static ItemStack shopInfoItem;
|
||||
|
||||
/** The quality of hologram and item updating (performance saving, or better quality) **/
|
||||
public ShopUpdater.UpdateQuality update_quality;
|
||||
/**
|
||||
* The default value for the custom WorldGuard flag 'create-shop'
|
||||
**/
|
||||
public static boolean wgAllowCreateShopDefault;
|
||||
|
||||
/** The item with which a player can click a shop to retrieve information **/
|
||||
public ItemStack shop_info_item;
|
||||
/**
|
||||
* The default value for the custom WorldGuard flag 'use-admin-shop'
|
||||
**/
|
||||
public static boolean wgAllowUseAdminShopDefault;
|
||||
|
||||
/** The default value for the custom WorldGuard flag 'create-shop' **/
|
||||
public boolean wg_allow_create_shop_default;
|
||||
/**
|
||||
* The default value for the custom WorldGuard flag 'use-shop'
|
||||
**/
|
||||
public static boolean wgAllowUseShopDefault;
|
||||
|
||||
/** The default value for the custom WorldGuard flag 'use-admin-shop' **/
|
||||
public boolean wg_allow_use_admin_shop_default;
|
||||
/**
|
||||
* The types of town plots residents are allowed to create shops in
|
||||
**/
|
||||
public static List<String> townyShopPlotsResidents;
|
||||
|
||||
/** The default value for the custom WorldGuard flag 'use-shop' **/
|
||||
public boolean wg_allow_use_shop_default;
|
||||
/**
|
||||
* The types of town plots the mayor is allowed to create shops in
|
||||
**/
|
||||
public static List<String> townyShopPlotsMayor;
|
||||
|
||||
/** The types of town plots residents are allowed to create shops in **/
|
||||
public List<String> towny_shop_plots_residents;
|
||||
/**
|
||||
* The types of town plots the king is allowed to create shops in
|
||||
**/
|
||||
public static List<String> townyShopPlotsKing;
|
||||
|
||||
/** The types of town plots the mayor is allowed to create shops in **/
|
||||
public List<String> towny_shop_plots_mayor;
|
||||
/**
|
||||
* The events of AreaShop when shops in that region should be removed
|
||||
**/
|
||||
public static List<String> areashopRemoveShopEvents;
|
||||
|
||||
/** The types of town plots the king is allowed to create shops in **/
|
||||
public List<String> towny_shop_plots_king;
|
||||
/**
|
||||
* The hostname used in ShopChest's MySQL database
|
||||
**/
|
||||
public static String databaseMySqlHost;
|
||||
|
||||
/** The events of AreaShop when shops in that region should be removed **/
|
||||
public List<String> areashop_remove_shop_events;
|
||||
/**
|
||||
* The port used for ShopChest's MySQL database
|
||||
**/
|
||||
public static int databaseMySqlPort;
|
||||
|
||||
/** The hostname used in ShopChest's MySQL database **/
|
||||
public String database_mysql_host;
|
||||
/**
|
||||
* The database used for ShopChest's MySQL database
|
||||
**/
|
||||
public static String databaseMySqlDatabase;
|
||||
|
||||
/** The port used for ShopChest's MySQL database **/
|
||||
public int database_mysql_port;
|
||||
/**
|
||||
* The username used in ShopChest's MySQL database
|
||||
**/
|
||||
public static String databaseMySqlUsername;
|
||||
|
||||
/** The database used for ShopChest's MySQL database **/
|
||||
public String database_mysql_database;
|
||||
/**
|
||||
* The password used in ShopChest's MySQL database
|
||||
**/
|
||||
public static String databaseMySqlPassword;
|
||||
|
||||
/** The username used in ShopChest's MySQL database **/
|
||||
public String database_mysql_username;
|
||||
/**
|
||||
* The database type used for ShopChest.
|
||||
**/
|
||||
public static Database.DatabaseType databaseType;
|
||||
|
||||
/** The password used in ShopChest's MySQL database **/
|
||||
public String database_mysql_password;
|
||||
|
||||
/** The database type used for ShopChest. **/
|
||||
public Database.DatabaseType database_type;
|
||||
|
||||
/** The interval in seconds, a ping is sent to the MySQL server **/
|
||||
public int database_mysql_ping_interval;
|
||||
/**
|
||||
* The interval in seconds, a ping is sent to the MySQL server
|
||||
**/
|
||||
public static int databaseMySqlPingInterval;
|
||||
|
||||
/**
|
||||
* <p>The minimum prices for certain items</p>
|
||||
* This returns a key set, which contains e.g "STONE", "STONE:1", of the <i>minimum-prices</i> section in ShopChest's config.
|
||||
* To actually retrieve the minimum price for an item, you have to get the double {@code minimum-prices.<key>}.
|
||||
**/
|
||||
public Set<String> minimum_prices;
|
||||
public static Set<String> minimumPrices;
|
||||
|
||||
/**
|
||||
* <p>The maximum prices for certain items</p>
|
||||
* This returns a key set, which contains e.g "STONE", "STONE:1", of the {@code maximum-prices} section in ShopChest's config.
|
||||
* To actually retrieve the maximum price for an item, you have to get the double {@code maximum-prices.<key>}.
|
||||
**/
|
||||
public Set<String> maximum_prices;
|
||||
public static Set<String> maximumPrices;
|
||||
|
||||
/**
|
||||
* <p>List containing items, of which players can't create a shop</p>
|
||||
* If this list contains an item (e.g "STONE", "STONE:1"), it's in the blacklist.
|
||||
**/
|
||||
public List<String> blacklist;
|
||||
public static List<String> blacklist;
|
||||
|
||||
/** Whether prices may contain decimals **/
|
||||
public boolean allow_decimals_in_price;
|
||||
/**
|
||||
* Whether prices may contain decimals
|
||||
**/
|
||||
public static boolean allowDecimalsInPrice;
|
||||
|
||||
/** Whether the buy price of a shop must be greater than or equal the sell price **/
|
||||
public boolean buy_greater_or_equal_sell;
|
||||
/**
|
||||
* Whether the buy price of a shop must be greater than or equal the sell price
|
||||
**/
|
||||
public static boolean buyGreaterOrEqualSell;
|
||||
|
||||
/** Whether shops should be protected by hoppers **/
|
||||
public boolean hopper_protection;
|
||||
/**
|
||||
* Whether shops should be protected by hoppers
|
||||
**/
|
||||
public static boolean hopperProtection;
|
||||
|
||||
/** Whether shops should be protected by explosions **/
|
||||
public boolean explosion_protection;
|
||||
/**
|
||||
* Whether shops should be protected by explosions
|
||||
**/
|
||||
public static boolean explosionProtection;
|
||||
|
||||
/** Whether buys and sells must be confirmed **/
|
||||
public boolean confirm_shopping;
|
||||
/**
|
||||
* Whether buys and sells must be confirmed
|
||||
**/
|
||||
public static boolean confirmShopping;
|
||||
|
||||
/** Whether quality mode should be enabled **/
|
||||
public boolean enable_quality_mode;
|
||||
/**
|
||||
* Whether quality mode should be enabled
|
||||
**/
|
||||
public static boolean enableQualityMode;
|
||||
|
||||
/** Whether hologram interaction should be enabled **/
|
||||
public boolean enable_hologram_interaction;
|
||||
/**
|
||||
* Whether hologram interaction should be enabled
|
||||
**/
|
||||
public static boolean enableHologramInteraction;
|
||||
|
||||
/** Whether the debug log file should be created **/
|
||||
public boolean enable_debug_log;
|
||||
/**
|
||||
* Whether the debug log file should be created
|
||||
**/
|
||||
public static boolean enableDebugLog;
|
||||
|
||||
/** Whether buys and sells should be logged in the database **/
|
||||
public boolean enable_ecomomy_log;
|
||||
/**
|
||||
* Whether buys and sells should be logged in the database
|
||||
**/
|
||||
public static boolean enableEcomomyLog;
|
||||
|
||||
/** Whether WorldGuard integration should be enabled **/
|
||||
public boolean enable_worldguard_integration;
|
||||
/**
|
||||
* Whether WorldGuard integration should be enabled
|
||||
**/
|
||||
public static boolean enableWorldGuardIntegration;
|
||||
|
||||
/** Whether Towny integration should be enabled **/
|
||||
public boolean enable_towny_integration;
|
||||
/**
|
||||
* Whether Towny integration should be enabled
|
||||
**/
|
||||
public static boolean enableTownyIntegration;
|
||||
|
||||
/** Whether AuthMe integration should be enabled **/
|
||||
public boolean enable_authme_integration;
|
||||
/**
|
||||
* Whether AuthMe integration should be enabled
|
||||
**/
|
||||
public static boolean enableAuthMeIntegration;
|
||||
|
||||
/** Whether PlotSquared integration should be enabled **/
|
||||
public boolean enable_plotsquared_integration;
|
||||
/**
|
||||
* Whether PlotSquared integration should be enabled
|
||||
**/
|
||||
public static boolean enablePlotsquaredIntegration;
|
||||
|
||||
/** Whether uSkyBlock integration should be enabled **/
|
||||
public boolean enable_uskyblock_integration;
|
||||
/**
|
||||
* Whether uSkyBlock integration should be enabled
|
||||
**/
|
||||
public static boolean enableUSkyblockIntegration;
|
||||
|
||||
/** Whether ASkyBlock integration should be enabled **/
|
||||
public boolean enable_askyblock_integration;
|
||||
/**
|
||||
* Whether ASkyBlock integration should be enabled
|
||||
**/
|
||||
public static boolean enableASkyblockIntegration;
|
||||
|
||||
/** Whether IslandWorld integration should be enabled **/
|
||||
public boolean enable_islandworld_integration;
|
||||
/**
|
||||
* Whether IslandWorld integration should be enabled
|
||||
**/
|
||||
public static boolean enableIslandWorldIntegration;
|
||||
|
||||
/** Whether GriefPrevention integration should be enabled **/
|
||||
public boolean enable_griefprevention_integration;
|
||||
/**
|
||||
* Whether GriefPrevention integration should be enabled
|
||||
**/
|
||||
public static boolean enableGriefPreventionIntegration;
|
||||
|
||||
/** Whether AreaShop integration should be enabled **/
|
||||
public boolean enable_areashop_integration;
|
||||
/**
|
||||
* Whether AreaShop integration should be enabled
|
||||
**/
|
||||
public static boolean enableAreaShopIntegration;
|
||||
|
||||
/** Whether the vendor of the shop should get messages about buys and sells **/
|
||||
public boolean enable_vendor_messages;
|
||||
/**
|
||||
* Whether the vendor of the shop should get messages about buys and sells
|
||||
**/
|
||||
public static boolean enableVendorMessages;
|
||||
|
||||
/** Whether admin shops should be excluded of the shop limits **/
|
||||
public boolean exclude_admin_shops;
|
||||
/**
|
||||
* Whether admin shops should be excluded of the shop limits
|
||||
**/
|
||||
public static boolean excludeAdminShops;
|
||||
|
||||
/** Whether the extension of a potion or tipped arrow (if available) should be appended to the item name. **/
|
||||
public boolean append_potion_level_to_item_name;
|
||||
/**
|
||||
* Whether the extension of a potion or tipped arrow (if available) should be appended to the item name.
|
||||
**/
|
||||
public static boolean appendPotionLevelToItemName;
|
||||
|
||||
/** Whether the shop items should be shown **/
|
||||
public boolean show_shop_items;
|
||||
/**
|
||||
* Whether the shop items should be shown
|
||||
**/
|
||||
public static boolean showShopItems;
|
||||
|
||||
/** Whether players are allowed to sell/buy broken items **/
|
||||
public boolean allow_broken_items;
|
||||
/**
|
||||
* Whether players are allowed to sell/buy broken items
|
||||
**/
|
||||
public static boolean allowBrokenItems;
|
||||
|
||||
/** Whether only the shops a player has in sight should be shown to him **/
|
||||
public boolean only_show_shops_in_sight;
|
||||
/**
|
||||
* Whether only the shops a player has in sight should be shown to him
|
||||
**/
|
||||
public static boolean onlyShowShopsInSight;
|
||||
|
||||
/** Whether only the shop a player is looking at should be shown to him **/
|
||||
public boolean only_show_first_shop_in_sight;
|
||||
/**
|
||||
* Whether only the shop a player is looking at should be shown to him
|
||||
**/
|
||||
public static boolean onlyShowFirstShopInSight;
|
||||
|
||||
/**
|
||||
* <p>Whether shops should automatically be removed from the database if an error occurred while loading</p>
|
||||
* (e.g. when no chest is found at a shop's location)
|
||||
*/
|
||||
public boolean remove_shop_on_error;
|
||||
public static boolean removeShopOnError;
|
||||
|
||||
/** Whether the item amount should be calculated to fit the available money or inventory space **/
|
||||
public boolean auto_calculate_item_amount;
|
||||
/**
|
||||
* Whether the item amount should be calculated to fit the available money or inventory space
|
||||
**/
|
||||
public static boolean autoCalculateItemAmount;
|
||||
|
||||
/**
|
||||
* <p>Whether the mouse buttons are inverted</p>
|
||||
*
|
||||
* <b>Default:</b><br>
|
||||
* Right-Click: Buy<br>
|
||||
* Left-Click: Sell
|
||||
**/
|
||||
public boolean invert_mouse_buttons;
|
||||
public static boolean invertMouseButtons;
|
||||
|
||||
/** Whether the hologram's location should be fixed at the bottom **/
|
||||
public boolean hologram_fixed_bottom;
|
||||
/**
|
||||
* Whether the hologram's location should be fixed at the bottom
|
||||
**/
|
||||
public static boolean hologramFixedBottom;
|
||||
|
||||
/** Amount every hologram should be lifted **/
|
||||
public double hologram_lift;
|
||||
/**
|
||||
* Amount every hologram should be lifted
|
||||
**/
|
||||
public static double hologramLift;
|
||||
|
||||
/** The maximum distance between a player and a shop to see the hologram **/
|
||||
public double maximal_distance;
|
||||
/**
|
||||
* The maximum distance between a player and a shop to see the hologram
|
||||
**/
|
||||
public static double maximalDistance;
|
||||
|
||||
/** The maximum distance between a player and a shop to see the shop item **/
|
||||
public double maximal_item_distance;
|
||||
/**
|
||||
* The maximum distance between a player and a shop to see the shop item
|
||||
**/
|
||||
public static double maximalItemDistance;
|
||||
|
||||
/** The price a player has to pay in order to create a normal shop **/
|
||||
public double shop_creation_price_normal;
|
||||
/**
|
||||
* The price a player has to pay in order to create a normal shop
|
||||
**/
|
||||
public static double shopCreationPriceNormal;
|
||||
|
||||
/** The price a player has to pay in order to create an admin shop **/
|
||||
public double shop_creation_price_admin;
|
||||
/**
|
||||
* The price a player has to pay in order to create an admin shop
|
||||
**/
|
||||
public static double shopCreationPriceAdmin;
|
||||
|
||||
/** The default shop limit for players whose limit is not set via a permission **/
|
||||
public int default_limit;
|
||||
/**
|
||||
* The default shop limit for players whose limit is not set via a permission
|
||||
**/
|
||||
public static int defaultLimit;
|
||||
|
||||
/** The main command of ShopChest <i>(default: shop)</i> **/
|
||||
public String main_command_name;
|
||||
/**
|
||||
* The main command of ShopChest <i>(default: shop)</i>
|
||||
**/
|
||||
public static String mainCommandName;
|
||||
|
||||
/** The language file to use (e.g <i>en_US</i>, <i>de_DE</i>) **/
|
||||
public String language_file;
|
||||
/**
|
||||
* The language file to use (e.g <i>en_US</i>, <i>de_DE</i>)
|
||||
**/
|
||||
public static String languageFile;
|
||||
|
||||
/**
|
||||
* The language configuration of the currently selected language file
|
||||
*/
|
||||
public static LanguageConfiguration langConfig;
|
||||
|
||||
private ShopChest plugin;
|
||||
|
||||
public Config(ShopChest plugin) {
|
||||
this.plugin = plugin;
|
||||
@ -226,7 +329,7 @@ public class Config {
|
||||
* <i>Config is automatically reloaded</i>
|
||||
*
|
||||
* @param property Property to change
|
||||
* @param value Value to set
|
||||
* @param value Value to set
|
||||
*/
|
||||
public void set(String property, String value) {
|
||||
boolean langChange = (property.equalsIgnoreCase("language-file"));
|
||||
@ -265,8 +368,9 @@ public class Config {
|
||||
/**
|
||||
* Add a value to a list in the config.yml.
|
||||
* If the list does not exist, a new list with the given value will be created
|
||||
*
|
||||
* @param property Location of the list
|
||||
* @param value Value to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void add(String property, String value) {
|
||||
List list = (plugin.getConfig().getList(property) == null) ? new ArrayList<>() : plugin.getConfig().getList(property);
|
||||
@ -344,62 +448,62 @@ public class Config {
|
||||
public void reload(boolean firstLoad, boolean langReload, boolean showMessages) {
|
||||
plugin.reloadConfig();
|
||||
|
||||
update_quality = ShopUpdater.UpdateQuality.valueOf(plugin.getConfig().getString("update-quality"));
|
||||
shop_info_item = ItemUtils.getItemStack(plugin.getConfig().getString("shop-info-item"));
|
||||
wg_allow_create_shop_default = plugin.getConfig().getBoolean("worldguard-default-flag-values.create-shop");
|
||||
wg_allow_use_admin_shop_default = plugin.getConfig().getBoolean("worldguard-default-flag-values.use-admin-shop");
|
||||
wg_allow_use_shop_default = plugin.getConfig().getBoolean("worldguard-default-flag-values.use-shop");
|
||||
towny_shop_plots_residents = plugin.getConfig().getStringList("towny-shop-plots.residents");
|
||||
towny_shop_plots_mayor = plugin.getConfig().getStringList("towny-shop-plots.mayor");
|
||||
towny_shop_plots_king = plugin.getConfig().getStringList("towny-shop-plots.king");
|
||||
areashop_remove_shop_events = plugin.getConfig().getStringList("areashop-remove-shops");
|
||||
database_mysql_ping_interval = plugin.getConfig().getInt("database.mysql.ping-interval");
|
||||
database_mysql_host = plugin.getConfig().getString("database.mysql.hostname");
|
||||
database_mysql_port = plugin.getConfig().getInt("database.mysql.port");
|
||||
database_mysql_database = plugin.getConfig().getString("database.mysql.database");
|
||||
database_mysql_username = plugin.getConfig().getString("database.mysql.username");
|
||||
database_mysql_password = plugin.getConfig().getString("database.mysql.password");
|
||||
database_type = Database.DatabaseType.valueOf(plugin.getConfig().getString("database.type"));
|
||||
minimum_prices = (plugin.getConfig().getConfigurationSection("minimum-prices") == null) ? new HashSet<String>() : plugin.getConfig().getConfigurationSection("minimum-prices").getKeys(true);
|
||||
maximum_prices = (plugin.getConfig().getConfigurationSection("maximum-prices") == null) ? new HashSet<String>() : plugin.getConfig().getConfigurationSection("maximum-prices").getKeys(true);
|
||||
allow_decimals_in_price = plugin.getConfig().getBoolean("allow-decimals-in-price");
|
||||
allow_broken_items = plugin.getConfig().getBoolean("allow-broken-items");
|
||||
auto_calculate_item_amount = (allow_decimals_in_price && plugin.getConfig().getBoolean("auto-calculate-item-amount"));
|
||||
updateQuality = ShopUpdater.UpdateQuality.valueOf(plugin.getConfig().getString("update-quality"));
|
||||
shopInfoItem = ItemUtils.getItemStack(plugin.getConfig().getString("shop-info-item"));
|
||||
wgAllowCreateShopDefault = plugin.getConfig().getBoolean("worldguard-default-flag-values.create-shop");
|
||||
wgAllowUseAdminShopDefault = plugin.getConfig().getBoolean("worldguard-default-flag-values.use-admin-shop");
|
||||
wgAllowUseShopDefault = plugin.getConfig().getBoolean("worldguard-default-flag-values.use-shop");
|
||||
townyShopPlotsResidents = plugin.getConfig().getStringList("towny-shop-plots.residents");
|
||||
townyShopPlotsMayor = plugin.getConfig().getStringList("towny-shop-plots.mayor");
|
||||
townyShopPlotsKing = plugin.getConfig().getStringList("towny-shop-plots.king");
|
||||
areashopRemoveShopEvents = plugin.getConfig().getStringList("areashop-remove-shops");
|
||||
databaseMySqlPingInterval = plugin.getConfig().getInt("database.mysql.ping-interval");
|
||||
databaseMySqlHost = plugin.getConfig().getString("database.mysql.hostname");
|
||||
databaseMySqlPort = plugin.getConfig().getInt("database.mysql.port");
|
||||
databaseMySqlDatabase = plugin.getConfig().getString("database.mysql.database");
|
||||
databaseMySqlUsername = plugin.getConfig().getString("database.mysql.username");
|
||||
databaseMySqlPassword = plugin.getConfig().getString("database.mysql.password");
|
||||
databaseType = Database.DatabaseType.valueOf(plugin.getConfig().getString("database.type"));
|
||||
minimumPrices = (plugin.getConfig().getConfigurationSection("minimum-prices") == null) ? new HashSet<String>() : plugin.getConfig().getConfigurationSection("minimum-prices").getKeys(true);
|
||||
maximumPrices = (plugin.getConfig().getConfigurationSection("maximum-prices") == null) ? new HashSet<String>() : plugin.getConfig().getConfigurationSection("maximum-prices").getKeys(true);
|
||||
allowDecimalsInPrice = plugin.getConfig().getBoolean("allow-decimals-in-price");
|
||||
allowBrokenItems = plugin.getConfig().getBoolean("allow-broken-items");
|
||||
autoCalculateItemAmount = (allowDecimalsInPrice && plugin.getConfig().getBoolean("auto-calculate-item-amount"));
|
||||
blacklist = (plugin.getConfig().getStringList("blacklist") == null) ? new ArrayList<String>() : plugin.getConfig().getStringList("blacklist");
|
||||
buy_greater_or_equal_sell = plugin.getConfig().getBoolean("buy-greater-or-equal-sell");
|
||||
hopper_protection = plugin.getConfig().getBoolean("hopper-protection");
|
||||
explosion_protection = plugin.getConfig().getBoolean("explosion-protection");
|
||||
confirm_shopping = plugin.getConfig().getBoolean("confirm-shopping");
|
||||
enable_quality_mode = plugin.getConfig().getBoolean("enable-quality-mode");
|
||||
enable_hologram_interaction = plugin.getConfig().getBoolean("enable-hologram-interaction");
|
||||
enable_debug_log = plugin.getConfig().getBoolean("enable-debug-log");
|
||||
enable_ecomomy_log = plugin.getConfig().getBoolean("enable-economy-log");
|
||||
enable_worldguard_integration = plugin.getConfig().getBoolean("enable-worldguard-integration");
|
||||
enable_towny_integration = plugin.getConfig().getBoolean("enable-towny-integration");
|
||||
enable_authme_integration = plugin.getConfig().getBoolean("enable-authme-integration");
|
||||
enable_plotsquared_integration = plugin.getConfig().getBoolean("enable-plotsquared-integration");
|
||||
enable_uskyblock_integration = plugin.getConfig().getBoolean("enable-uskyblock-integration");
|
||||
enable_askyblock_integration = plugin.getConfig().getBoolean("enable-askyblock-integration");
|
||||
enable_islandworld_integration = plugin.getConfig().getBoolean("enable-islandworld-integration");
|
||||
enable_griefprevention_integration = plugin.getConfig().getBoolean("enable-griefprevention-integration");
|
||||
enable_areashop_integration = plugin.getConfig().getBoolean("enable-areashop-integration");
|
||||
enable_vendor_messages = plugin.getConfig().getBoolean("enable-vendor-messages");
|
||||
only_show_shops_in_sight = plugin.getConfig().getBoolean("only-show-shops-in-sight");
|
||||
only_show_first_shop_in_sight = plugin.getConfig().getBoolean("only-show-first-shop-in-sight");
|
||||
exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops");
|
||||
append_potion_level_to_item_name = plugin.getConfig().getBoolean("append-potion-level-to-item-name");
|
||||
show_shop_items = plugin.getConfig().getBoolean("show-shop-items");
|
||||
remove_shop_on_error = plugin.getConfig().getBoolean("remove-shop-on-error");
|
||||
invert_mouse_buttons = plugin.getConfig().getBoolean("invert-mouse-buttons");
|
||||
hologram_fixed_bottom = plugin.getConfig().getBoolean("hologram-fixed-bottom");
|
||||
hologram_lift = plugin.getConfig().getDouble("hologram-lift");
|
||||
maximal_distance = plugin.getConfig().getDouble("maximal-distance");
|
||||
maximal_item_distance = plugin.getConfig().getDouble("maximal-item-distance");
|
||||
shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal");
|
||||
shop_creation_price_admin = plugin.getConfig().getDouble("shop-creation-price.admin");
|
||||
default_limit = plugin.getConfig().getInt("shop-limits.default");
|
||||
main_command_name = plugin.getConfig().getString("main-command-name");
|
||||
language_file = plugin.getConfig().getString("language-file");
|
||||
buyGreaterOrEqualSell = plugin.getConfig().getBoolean("buy-greater-or-equal-sell");
|
||||
hopperProtection = plugin.getConfig().getBoolean("hopper-protection");
|
||||
explosionProtection = plugin.getConfig().getBoolean("explosion-protection");
|
||||
confirmShopping = plugin.getConfig().getBoolean("confirm-shopping");
|
||||
enableQualityMode = plugin.getConfig().getBoolean("enable-quality-mode");
|
||||
enableHologramInteraction = plugin.getConfig().getBoolean("enable-hologram-interaction");
|
||||
enableDebugLog = plugin.getConfig().getBoolean("enable-debug-log");
|
||||
enableEcomomyLog = plugin.getConfig().getBoolean("enable-economy-log");
|
||||
enableWorldGuardIntegration = plugin.getConfig().getBoolean("enable-worldguard-integration");
|
||||
enableTownyIntegration = plugin.getConfig().getBoolean("enable-towny-integration");
|
||||
enableAuthMeIntegration = plugin.getConfig().getBoolean("enable-authme-integration");
|
||||
enablePlotsquaredIntegration = plugin.getConfig().getBoolean("enable-plotsquared-integration");
|
||||
enableUSkyblockIntegration = plugin.getConfig().getBoolean("enable-uskyblock-integration");
|
||||
enableASkyblockIntegration = plugin.getConfig().getBoolean("enable-askyblock-integration");
|
||||
enableIslandWorldIntegration = plugin.getConfig().getBoolean("enable-islandworld-integration");
|
||||
enableGriefPreventionIntegration = plugin.getConfig().getBoolean("enable-griefprevention-integration");
|
||||
enableAreaShopIntegration = plugin.getConfig().getBoolean("enable-areashop-integration");
|
||||
enableVendorMessages = plugin.getConfig().getBoolean("enable-vendor-messages");
|
||||
onlyShowShopsInSight = plugin.getConfig().getBoolean("only-show-shops-in-sight");
|
||||
onlyShowFirstShopInSight = plugin.getConfig().getBoolean("only-show-first-shop-in-sight");
|
||||
excludeAdminShops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops");
|
||||
appendPotionLevelToItemName = plugin.getConfig().getBoolean("append-potion-level-to-item-name");
|
||||
showShopItems = plugin.getConfig().getBoolean("show-shop-items");
|
||||
removeShopOnError = plugin.getConfig().getBoolean("remove-shop-on-error");
|
||||
invertMouseButtons = plugin.getConfig().getBoolean("invert-mouse-buttons");
|
||||
hologramFixedBottom = plugin.getConfig().getBoolean("hologram-fixed-bottom");
|
||||
hologramLift = plugin.getConfig().getDouble("hologram-lift");
|
||||
maximalDistance = plugin.getConfig().getDouble("maximal-distance");
|
||||
maximalItemDistance = plugin.getConfig().getDouble("maximal-item-distance");
|
||||
shopCreationPriceNormal = plugin.getConfig().getDouble("shop-creation-price.normal");
|
||||
shopCreationPriceAdmin = plugin.getConfig().getDouble("shop-creation-price.admin");
|
||||
defaultLimit = plugin.getConfig().getInt("shop-limits.default");
|
||||
mainCommandName = plugin.getConfig().getString("main-command-name");
|
||||
languageFile = plugin.getConfig().getString("language-file");
|
||||
|
||||
if (firstLoad || langReload) loadLanguageConfig(showMessages);
|
||||
if (!firstLoad && langReload) LanguageUtils.load();
|
||||
@ -434,7 +538,7 @@ public class Config {
|
||||
if (!(new File(langFolder, "de_DE.lang")).exists())
|
||||
plugin.saveResource("lang/de_DE.lang", false);
|
||||
|
||||
File langConfigFile = new File(langFolder, language_file + ".lang");
|
||||
File langConfigFile = new File(langFolder, languageFile + ".lang");
|
||||
File langDefaultFile = new File(langFolder, "en_US.lang");
|
||||
|
||||
if (!langConfigFile.exists()) {
|
||||
@ -446,7 +550,8 @@ public class Config {
|
||||
r = getTextResource("lang/en_US.lang", showMessages);
|
||||
if (showMessages) plugin.getLogger().info("Using locale \"en_US\" (Streamed from jar file)");
|
||||
} else {
|
||||
if (showMessages) plugin.getLogger().info("Using locale \"" + langConfigFile.getName().substring(0, langConfigFile.getName().length() - 5) + "\" (Streamed from jar file)");
|
||||
if (showMessages)
|
||||
plugin.getLogger().info("Using locale \"" + langConfigFile.getName().substring(0, langConfigFile.getName().length() - 5) + "\" (Streamed from jar file)");
|
||||
}
|
||||
|
||||
if (r == null) {
|
||||
@ -489,7 +594,8 @@ public class Config {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (showMessages) plugin.getLogger().info("Using locale \"" + langConfigFile.getName().substring(0, langConfigFile.getName().length() - 5) + "\"");
|
||||
if (showMessages)
|
||||
plugin.getLogger().info("Using locale \"" + langConfigFile.getName().substring(0, langConfigFile.getName().length() - 5) + "\"");
|
||||
langConfig.load(langConfigFile);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
if (showMessages) {
|
||||
|
@ -8,7 +8,6 @@ import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public class LanguageConfiguration extends FileConfiguration {
|
||||
|
||||
|
@ -1,99 +1,29 @@
|
||||
package de.epiceric.shopchest.external;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||
import com.sk89q.worldguard.protection.flags.Flag;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
|
||||
public class WorldGuardShopFlag {
|
||||
|
||||
private static Flag<?>[] customFlagList;
|
||||
private static boolean loaded = false;
|
||||
|
||||
public static final StateFlag CREATE_SHOP;
|
||||
public static final StateFlag USE_SHOP;
|
||||
public static final StateFlag USE_ADMIN_SHOP;
|
||||
|
||||
static {
|
||||
CREATE_SHOP = new StateFlag("create-shop", ShopChest.getInstance().getShopChestConfig().wg_allow_create_shop_default);
|
||||
USE_SHOP = new StateFlag("use-shop", ShopChest.getInstance().getShopChestConfig().wg_allow_use_shop_default);
|
||||
USE_ADMIN_SHOP = new StateFlag("use-admin-shop", ShopChest.getInstance().getShopChestConfig().wg_allow_use_admin_shop_default);
|
||||
CREATE_SHOP = new StateFlag("create-shop", Config.wgAllowCreateShopDefault);
|
||||
USE_SHOP = new StateFlag("use-shop", Config.wgAllowUseShopDefault);
|
||||
USE_ADMIN_SHOP = new StateFlag("use-admin-shop", Config.wgAllowUseAdminShopDefault);
|
||||
|
||||
customFlagList = new Flag[] {CREATE_SHOP, USE_SHOP, USE_ADMIN_SHOP};
|
||||
}
|
||||
|
||||
public static boolean isLoaded() {
|
||||
return loaded;
|
||||
}
|
||||
|
||||
public static void register(final ShopChest plugin, boolean onLoad) {
|
||||
String worldGuardVersion = plugin.getWorldGuard().getDescription().getVersion();
|
||||
|
||||
int majorVersion = 0;
|
||||
int minorVersion = 0;
|
||||
int fixVersion = 0;
|
||||
|
||||
try {
|
||||
String[] spl = worldGuardVersion.split("\\.");
|
||||
if (spl.length > 0) {
|
||||
majorVersion = Integer.parseInt(spl[0]);
|
||||
|
||||
if (spl.length > 1) {
|
||||
minorVersion = Integer.parseInt(spl[1]);
|
||||
|
||||
if (spl.length > 2) {
|
||||
int length = 0;
|
||||
for (int i = 0; i < spl[2].toCharArray().length; i++) {
|
||||
char c = spl[2].toCharArray()[i];
|
||||
if (c >= '0' && c <= '9') {
|
||||
length++;
|
||||
} else break;
|
||||
}
|
||||
|
||||
fixVersion = Integer.parseInt(spl[2].substring(0, length));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.getLogger().severe("Failed to initialize custom WorldGuard flags.");
|
||||
plugin.debug("Failed to initialize WorldGuard flags: Unknown/Invalid version: " + worldGuardVersion);
|
||||
return;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
plugin.debug("Failed to initialize WorldGuard flags");
|
||||
plugin.debug(e);
|
||||
plugin.getLogger().severe("Failed to initialize custom WorldGuard flags.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (((majorVersion == 6 && minorVersion == 1 && fixVersion >= 3) || (majorVersion == 6 && minorVersion > 1) || majorVersion > 6)) {
|
||||
if (onLoad) {
|
||||
plugin.getWorldGuard().getFlagRegistry().registerAll(Lists.newArrayList(customFlagList));
|
||||
loaded = true;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Field flagListField = DefaultFlag.class.getField("flagsList");
|
||||
|
||||
Flag<?>[] flags = new Flag[DefaultFlag.flagsList.length + customFlagList.length];
|
||||
System.arraycopy(DefaultFlag.flagsList, 0, flags, 0, DefaultFlag.flagsList.length);
|
||||
System.arraycopy(customFlagList, 0, flags, DefaultFlag.flagsList.length, customFlagList.length);
|
||||
|
||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(flagListField, flagListField.getModifiers() & ~Modifier.FINAL);
|
||||
|
||||
flagListField.set(null, flags);
|
||||
loaded = true;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
plugin.debug("Failed to initialize WorldGuard flags");
|
||||
plugin.debug(e);
|
||||
plugin.getLogger().severe("Failed to initialize custom WorldGuard flags.");
|
||||
}
|
||||
}
|
||||
public static void register(final ShopChest plugin) {
|
||||
plugin.getWorldGuard().getFlagRegistry().registerAll(Lists.newArrayList(customFlagList));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.epiceric.shopchest.language;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import de.epiceric.shopchest.config.LanguageConfiguration;
|
||||
import de.epiceric.shopchest.config.Placeholder;
|
||||
import de.epiceric.shopchest.nms.CustomBookMeta;
|
||||
@ -38,7 +39,7 @@ public class LanguageUtils {
|
||||
|
||||
|
||||
public static void load() {
|
||||
langConfig = plugin.getShopChestConfig().getLanguageConfig();
|
||||
langConfig = Config.langConfig;
|
||||
|
||||
itemNames.clear();
|
||||
enchantmentNames.clear();
|
||||
@ -997,102 +998,102 @@ public class LanguageUtils {
|
||||
generationNames.add(new BookGenerationName(CustomBookMeta.Generation.TATTERED, langConfig.getString("book.generation.3", "Tattered")));
|
||||
|
||||
// Add ShopChest Messages
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_CREATED, langConfig.getString("message.shop-created", "&6You were withdrawn &c%CREATION-PRICE% &6to create this shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.ADMIN_SHOP_CREATED, langConfig.getString("message.admin-shop-created", "&6You were withdrawn &c%CREATION-PRICE% &6to create this admin shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_ALREADY_SHOP, langConfig.getString("message.chest-already-shop", "&cChest already shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_BLOCKED, langConfig.getString("message.chest-blocked", "&cThere must not be a block above the chest.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.DOUBLE_CHEST_BLOCKED, langConfig.getString("message.double-chest-blocked", "&cThere must not be a block above the chest.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_REMOVED, langConfig.getString("message.shop-removed", "&6Shop removed.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.ALL_SHOPS_REMOVED, langConfig.getString("message.all-shops-removed", "&6Removed all (&c%AMOUNT%&6) shop/s of &c%VENDOR%&6.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_NO_SHOP, langConfig.getString("message.chest-no-shop", "&cChest is not a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_CREATE_NOT_ENOUGH_MONEY, langConfig.getString("message.shop-create-not-enough-money", "&cNot enough money. You need &6%CREATION-PRICE% &cto create a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_VENDOR, langConfig.getString("message.shopInfo.vendor", "&6Vendor: &e%VENDOR%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_PRODUCT, langConfig.getString("message.shopInfo.product", "&6Product: &e%AMOUNT% x %ITEMNAME%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_STOCK, langConfig.getString("message.shopInfo.stock", "&6In Stock: &e%STOCK%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_ENCHANTMENTS, langConfig.getString("message.shopInfo.enchantments", "&6Enchantments: &e%ENCHANTMENT%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_POTION_EFFECT, langConfig.getString("message.shopInfo.potion-effect", "&6Potion Effect: &e%POTION-EFFECT% %EXTENDED%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_MUSIC_TITLE, langConfig.getString("message.shopInfo.music-disc-title", "&6Music Disc Title: &e%MUSIC-TITLE%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_BOOK_GENERATION, langConfig.getString("message.shopInfo.book-generation", "&6Generation: &e%GENERATION%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_NONE, langConfig.getString("message.shopInfo.none", "&7None")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_PRICE, langConfig.getString("message.shopInfo.price", "&6Price: Buy: &e%BUY-PRICE%&6 Sell: &e%SELL-PRICE%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_DISABLED, langConfig.getString("message.shopInfo.disabled", "&7Disabled")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_NORMAL, langConfig.getString("message.shopInfo.is-normal", "&6Type: &eNormal")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_ADMIN, langConfig.getString("message.shopInfo.is-admin", "&6Type: &eAdmin")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_INFO_EXTENDED, langConfig.getString("message.shopInfo.extended", "(Extended)")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.BUY_SELL_DISABLED, langConfig.getString("message.buy-and-sell-disabled", "&cYou can't create a shop with buying and selling disabled.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.BUY_SUCCESS, langConfig.getString("message.buy-success", "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a from &6%VENDOR%&a.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.BUY_SUCCESS_ADMIN, langConfig.getString("message.buy-success-admin", "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SELL_SUCCESS, langConfig.getString("message.sell-success", "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a to &6%VENDOR%&a.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SELL_SUCCESS_ADMIN, langConfig.getString("message.sell-success-admin", "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SOMEONE_BOUGHT, langConfig.getString("message.someone-bought", "&6%PLAYER% &abought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a from your shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SOMEONE_SOLD, langConfig.getString("message.someone-sold", "&6%PLAYER% &asold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a to your shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.REVENUE_WHILE_OFFLINE, langConfig.getString("message.revenue-while-offline", "&6While you were offline, your shops have made a revenue of &c%REVENUE%&6.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NOT_ENOUGH_INVENTORY_SPACE, langConfig.getString("message.not-enough-inventory-space", "&cNot enough space in inventory.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE, langConfig.getString("message.chest-not-enough-inventory-space", "&cShop is full.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NOT_ENOUGH_MONEY, langConfig.getString("message.not-enough-money", "&cNot enough money.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NOT_ENOUGH_ITEMS, langConfig.getString("message.not-enough-items", "&cNot enough items.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.VENDOR_NOT_ENOUGH_MONEY, langConfig.getString("message.vendor-not-enough-money", "&cVendor has not enough money.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.OUT_OF_STOCK, langConfig.getString("message.out-of-stock", "&cShop out of stock.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.VENDOR_OUT_OF_STOCK, langConfig.getString("message.vendor-out-of-stock", "&cYour shop that sells &6%AMOUNT% x %ITEMNAME% &cis out of stock.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.ERROR_OCCURRED, langConfig.getString("message.error-occurred", "&cAn error occurred: %ERROR%")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.AMOUNT_PRICE_NOT_NUMBER, langConfig.getString("message.amount-and-price-not-number", "&cAmount and price must be a number.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.AMOUNT_IS_ZERO, langConfig.getString("message.amount-is-zero", "&cAmount must be greater than 0.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.PRICES_CONTAIN_DECIMALS, langConfig.getString("message.prices-contain-decimals", "&cPrices must not contain decimals.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_ITEM_IN_HAND, langConfig.getString("message.no-item-in-hand", "&cNo item in hand")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CLICK_CHEST_CREATE, langConfig.getString("message.click-chest-to-create-shop", "&aClick a chest within 15 seconds to create a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CLICK_CHEST_REMOVE, langConfig.getString("message.click-chest-to-remove-shop", "&aClick a shop within 15 seconds to remove it.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CLICK_CHEST_INFO, langConfig.getString("message.click-chest-for-info", "&aClick a shop within 15 seconds to retrieve information.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CLICK_CHEST_OPEN, langConfig.getString("message.click-chest-to-open-shop", "&aClick a shop within 15 seconds to open it.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CLICK_TO_CONFIRM, langConfig.getString("message.click-to-confirm", "&aClick again to confirm.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.OPENED_SHOP, langConfig.getString("message.opened-shop", "&aYou opened %VENDOR%'s shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CANNOT_BREAK_SHOP, langConfig.getString("message.cannot-break-shop", "&cYou can't break a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CANNOT_SELL_BROKEN_ITEM, langConfig.getString("message.cannot-sell-broken-item", "&cYou can't sell a broken item.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.BUY_PRICE_TOO_LOW, langConfig.getString("message.buy-price-too-low", "&cThe buy price must be higher than %MIN-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SELL_PRICE_TOO_LOW, langConfig.getString("message.sell-price-too-low", "&cThe sell price must be higher than %MIN-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.BUY_PRICE_TOO_HIGH, langConfig.getString("message.buy-price-too-high", "&cThe buy price must be lower than %MAX-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SELL_PRICE_TOO_HIGH, langConfig.getString("message.sell-price-too-high", "&cThe sell price must be lower than %MAX-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.BUYING_DISABLED, langConfig.getString("message.buying-disabled", "&cBuying is disabled at this shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SELLING_DISABLED, langConfig.getString("message.selling-disabled", "&cSelling is disabled at this shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.RELOADED_SHOPS, langConfig.getString("message.reloaded-shops", "&aSuccessfully reloaded %AMOUNT% shop/s.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_LIMIT_REACHED, langConfig.getString("message.shop-limit-reached", "&cYou reached your limit of &6%LIMIT% &cshop/s.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.OCCUPIED_SHOP_SLOTS, langConfig.getString("message.occupied-shop-slots", "&6You have &c%AMOUNT%/%LIMIT% &6shop slot/s occupied.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CANNOT_SELL_ITEM, langConfig.getString("message.cannot-sell-item", "&cYou cannot create a shop with this item.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.USE_IN_CREATIVE, langConfig.getString("message.use-in-creative", "&cYou cannot use a shop in creative mode.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, langConfig.getString("message.update.update-available", "&6&lVersion &c%VERSION% &6of &cShopChest &6is available &chere.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD, langConfig.getString("message.update.click-to-download", "Click to download")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_NO_UPDATE, langConfig.getString("message.update.no-update", "&6&lNo new update available.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_CHECKING, langConfig.getString("message.update.checking", "&6&lChecking for updates...")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_ERROR, langConfig.getString("message.update.error", "&c&lError while checking for updates.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE, langConfig.getString("message.noPermission.create", "&cYou don't have permission to create a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE_ADMIN, langConfig.getString("message.noPermission.create-admin", "&cYou don't have permission to create an admin shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE_PROTECTED, langConfig.getString("message.noPermission.create-protected", "&cYou don't have permission to create a shop on a protected chest.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_OPEN_OTHERS, langConfig.getString("message.noPermission.open-others", "&cYou don't have permission to open this chest.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_BUY, langConfig.getString("message.noPermission.buy", "&cYou don't have permission to buy something.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_SELL, langConfig.getString("message.noPermission.sell", "&cYou don't have permission to sell something.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_BUY_HERE, langConfig.getString("message.noPermission.buy-here", "&cYou don't have permission to buy something here.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_SELL_HERE, langConfig.getString("message.noPermission.sell-here", "&cYou don't have permission to sell something here.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_REMOVE_OTHERS, langConfig.getString("message.noPermission.remove-others", "&cYou don't have permission to remove this shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_REMOVE_ADMIN, langConfig.getString("message.noPermission.remove-admin", "&cYou don't have permission to remove an admin shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_RELOAD, langConfig.getString("message.noPermission.reload", "&cYou don't have permission to reload the shops.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_UPDATE, langConfig.getString("message.noPermission.update", "&cYou don't have permission to check for updates.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_CONFIG, langConfig.getString("message.noPermission.config", "&cYou don't have permission to change configuration values.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_EXTEND_OTHERS, langConfig.getString("message.noPermission.extend-others", "&cYou don't have permission to extend this chest.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_PERMISSION_EXTEND_PROTECTED, langConfig.getString("message.noPermission.extend-protected", "&cYou don't have permission to extend this chest to here.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_HEADER, langConfig.getString("message.commandDescription.header", "&6==== &c/%COMMAND% &6Help")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_FOOTER, langConfig.getString("message.commandDescription.footer", "&6==== End")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE, langConfig.getString("message.commandDescription.create", "&a/%COMMAND% create <amount> <buy-price> <sell-price> - Create a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE_ADMIN, langConfig.getString("message.commandDescription.create-admin", "&a/%COMMAND% create <amount> <buy-price> <sell-price> [normal|admin] - Create a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_REMOVE, langConfig.getString("message.commandDescription.remove", "&a/%COMMAND% remove - Remove a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_INFO, langConfig.getString("message.commandDescription.info", "&a/%COMMAND% info - Retrieve shop information.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_REMOVEALL, langConfig.getString("message.commandDescription.removeall", "&a/%COMMAND% removeall - Remove all shops of a player.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_RELOAD, langConfig.getString("message.commandDescription.reload", "&a/%COMMAND% reload - Reload shops.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_UPDATE, langConfig.getString("message.commandDescription.update", "&a/%COMMAND% update - Check for Updates.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_LIMITS, langConfig.getString("message.commandDescription.limits", "&a/%COMMAND% limits - View shop limits.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_OPEN, langConfig.getString("message.commandDescription.open", "&a/%COMMAND% open - Open a shop.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.COMMAND_DESC_CONFIG, langConfig.getString("message.commandDescription.config", "&a/%COMMAND% config <set|get|remove> <property> <value> - Change configuration values.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHANGED_CONFIG_SET, langConfig.getString("message.config.set", "&6Changed &a%PROPERTY% &6to &a%VALUE%&6.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHANGED_CONFIG_REMOVED, langConfig.getString("message.config.removed", "&6Removed &a%VALUE% &6from &a%PROPERTY%&6.")));
|
||||
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHANGED_CONFIG_ADDED, langConfig.getString("message.config.added", "&6Added &a%VALUE% &6to &a%PROPERTY%&6.")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_CREATED, langConfig.getString("message.shop-created", "&6You were withdrawn &c%CREATION-PRICE% &6to create this shop.")));
|
||||
messages.add(new LocalizedMessage(Message.ADMIN_SHOP_CREATED, langConfig.getString("message.admin-shop-created", "&6You were withdrawn &c%CREATION-PRICE% &6to create this admin shop.")));
|
||||
messages.add(new LocalizedMessage(Message.CHEST_ALREADY_SHOP, langConfig.getString("message.chest-already-shop", "&cChest already shop.")));
|
||||
messages.add(new LocalizedMessage(Message.CHEST_BLOCKED, langConfig.getString("message.chest-blocked", "&cThere must not be a block above the chest.")));
|
||||
messages.add(new LocalizedMessage(Message.DOUBLE_CHEST_BLOCKED, langConfig.getString("message.double-chest-blocked", "&cThere must not be a block above the chest.")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_REMOVED, langConfig.getString("message.shop-removed", "&6Shop removed.")));
|
||||
messages.add(new LocalizedMessage(Message.ALL_SHOPS_REMOVED, langConfig.getString("message.all-shops-removed", "&6Removed all (&c%AMOUNT%&6) shop/s of &c%VENDOR%&6.")));
|
||||
messages.add(new LocalizedMessage(Message.CHEST_NO_SHOP, langConfig.getString("message.chest-no-shop", "&cChest is not a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_CREATE_NOT_ENOUGH_MONEY, langConfig.getString("message.shop-create-not-enough-money", "&cNot enough money. You need &6%CREATION-PRICE% &cto create a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_VENDOR, langConfig.getString("message.shopInfo.vendor", "&6Vendor: &e%VENDOR%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_PRODUCT, langConfig.getString("message.shopInfo.product", "&6Product: &e%AMOUNT% x %ITEMNAME%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_STOCK, langConfig.getString("message.shopInfo.stock", "&6In Stock: &e%STOCK%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_ENCHANTMENTS, langConfig.getString("message.shopInfo.enchantments", "&6Enchantments: &e%ENCHANTMENT%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_POTION_EFFECT, langConfig.getString("message.shopInfo.potion-effect", "&6Potion Effect: &e%POTION-EFFECT% %EXTENDED%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_MUSIC_TITLE, langConfig.getString("message.shopInfo.music-disc-title", "&6Music Disc Title: &e%MUSIC-TITLE%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_BOOK_GENERATION, langConfig.getString("message.shopInfo.book-generation", "&6Generation: &e%GENERATION%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_NONE, langConfig.getString("message.shopInfo.none", "&7None")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_PRICE, langConfig.getString("message.shopInfo.price", "&6Price: Buy: &e%BUY-PRICE%&6 Sell: &e%SELL-PRICE%")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_DISABLED, langConfig.getString("message.shopInfo.disabled", "&7Disabled")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_NORMAL, langConfig.getString("message.shopInfo.is-normal", "&6Type: &eNormal")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_ADMIN, langConfig.getString("message.shopInfo.is-admin", "&6Type: &eAdmin")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_INFO_EXTENDED, langConfig.getString("message.shopInfo.extended", "(Extended)")));
|
||||
messages.add(new LocalizedMessage(Message.BUY_SELL_DISABLED, langConfig.getString("message.buy-and-sell-disabled", "&cYou can't create a shop with buying and selling disabled.")));
|
||||
messages.add(new LocalizedMessage(Message.BUY_SUCCESS, langConfig.getString("message.buy-success", "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a from &6%VENDOR%&a.")));
|
||||
messages.add(new LocalizedMessage(Message.BUY_SUCCESS_ADMIN, langConfig.getString("message.buy-success-admin", "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a.")));
|
||||
messages.add(new LocalizedMessage(Message.SELL_SUCCESS, langConfig.getString("message.sell-success", "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a to &6%VENDOR%&a.")));
|
||||
messages.add(new LocalizedMessage(Message.SELL_SUCCESS_ADMIN, langConfig.getString("message.sell-success-admin", "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a.")));
|
||||
messages.add(new LocalizedMessage(Message.SOMEONE_BOUGHT, langConfig.getString("message.someone-bought", "&6%PLAYER% &abought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a from your shop.")));
|
||||
messages.add(new LocalizedMessage(Message.SOMEONE_SOLD, langConfig.getString("message.someone-sold", "&6%PLAYER% &asold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a to your shop.")));
|
||||
messages.add(new LocalizedMessage(Message.REVENUE_WHILE_OFFLINE, langConfig.getString("message.revenue-while-offline", "&6While you were offline, your shops have made a revenue of &c%REVENUE%&6.")));
|
||||
messages.add(new LocalizedMessage(Message.NOT_ENOUGH_INVENTORY_SPACE, langConfig.getString("message.not-enough-inventory-space", "&cNot enough space in inventory.")));
|
||||
messages.add(new LocalizedMessage(Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE, langConfig.getString("message.chest-not-enough-inventory-space", "&cShop is full.")));
|
||||
messages.add(new LocalizedMessage(Message.NOT_ENOUGH_MONEY, langConfig.getString("message.not-enough-money", "&cNot enough money.")));
|
||||
messages.add(new LocalizedMessage(Message.NOT_ENOUGH_ITEMS, langConfig.getString("message.not-enough-items", "&cNot enough items.")));
|
||||
messages.add(new LocalizedMessage(Message.VENDOR_NOT_ENOUGH_MONEY, langConfig.getString("message.vendor-not-enough-money", "&cVendor has not enough money.")));
|
||||
messages.add(new LocalizedMessage(Message.OUT_OF_STOCK, langConfig.getString("message.out-of-stock", "&cShop out of stock.")));
|
||||
messages.add(new LocalizedMessage(Message.VENDOR_OUT_OF_STOCK, langConfig.getString("message.vendor-out-of-stock", "&cYour shop that sells &6%AMOUNT% x %ITEMNAME% &cis out of stock.")));
|
||||
messages.add(new LocalizedMessage(Message.ERROR_OCCURRED, langConfig.getString("message.error-occurred", "&cAn error occurred: %ERROR%")));
|
||||
messages.add(new LocalizedMessage(Message.AMOUNT_PRICE_NOT_NUMBER, langConfig.getString("message.amount-and-price-not-number", "&cAmount and price must be a number.")));
|
||||
messages.add(new LocalizedMessage(Message.AMOUNT_IS_ZERO, langConfig.getString("message.amount-is-zero", "&cAmount must be greater than 0.")));
|
||||
messages.add(new LocalizedMessage(Message.PRICES_CONTAIN_DECIMALS, langConfig.getString("message.prices-contain-decimals", "&cPrices must not contain decimals.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_ITEM_IN_HAND, langConfig.getString("message.no-item-in-hand", "&cNo item in hand")));
|
||||
messages.add(new LocalizedMessage(Message.CLICK_CHEST_CREATE, langConfig.getString("message.click-chest-to-create-shop", "&aClick a chest within 15 seconds to create a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.CLICK_CHEST_REMOVE, langConfig.getString("message.click-chest-to-remove-shop", "&aClick a shop within 15 seconds to remove it.")));
|
||||
messages.add(new LocalizedMessage(Message.CLICK_CHEST_INFO, langConfig.getString("message.click-chest-for-info", "&aClick a shop within 15 seconds to retrieve information.")));
|
||||
messages.add(new LocalizedMessage(Message.CLICK_CHEST_OPEN, langConfig.getString("message.click-chest-to-open-shop", "&aClick a shop within 15 seconds to open it.")));
|
||||
messages.add(new LocalizedMessage(Message.CLICK_TO_CONFIRM, langConfig.getString("message.click-to-confirm", "&aClick again to confirm.")));
|
||||
messages.add(new LocalizedMessage(Message.OPENED_SHOP, langConfig.getString("message.opened-shop", "&aYou opened %VENDOR%'s shop.")));
|
||||
messages.add(new LocalizedMessage(Message.CANNOT_BREAK_SHOP, langConfig.getString("message.cannot-break-shop", "&cYou can't break a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.CANNOT_SELL_BROKEN_ITEM, langConfig.getString("message.cannot-sell-broken-item", "&cYou can't sell a broken item.")));
|
||||
messages.add(new LocalizedMessage(Message.BUY_PRICE_TOO_LOW, langConfig.getString("message.buy-price-too-low", "&cThe buy price must be higher than %MIN-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(Message.SELL_PRICE_TOO_LOW, langConfig.getString("message.sell-price-too-low", "&cThe sell price must be higher than %MIN-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(Message.BUY_PRICE_TOO_HIGH, langConfig.getString("message.buy-price-too-high", "&cThe buy price must be lower than %MAX-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(Message.SELL_PRICE_TOO_HIGH, langConfig.getString("message.sell-price-too-high", "&cThe sell price must be lower than %MAX-PRICE%.")));
|
||||
messages.add(new LocalizedMessage(Message.BUYING_DISABLED, langConfig.getString("message.buying-disabled", "&cBuying is disabled at this shop.")));
|
||||
messages.add(new LocalizedMessage(Message.SELLING_DISABLED, langConfig.getString("message.selling-disabled", "&cSelling is disabled at this shop.")));
|
||||
messages.add(new LocalizedMessage(Message.RELOADED_SHOPS, langConfig.getString("message.reloaded-shops", "&aSuccessfully reloaded %AMOUNT% shop/s.")));
|
||||
messages.add(new LocalizedMessage(Message.SHOP_LIMIT_REACHED, langConfig.getString("message.shop-limit-reached", "&cYou reached your limit of &6%LIMIT% &cshop/s.")));
|
||||
messages.add(new LocalizedMessage(Message.OCCUPIED_SHOP_SLOTS, langConfig.getString("message.occupied-shop-slots", "&6You have &c%AMOUNT%/%LIMIT% &6shop slot/s occupied.")));
|
||||
messages.add(new LocalizedMessage(Message.CANNOT_SELL_ITEM, langConfig.getString("message.cannot-sell-item", "&cYou cannot create a shop with this item.")));
|
||||
messages.add(new LocalizedMessage(Message.USE_IN_CREATIVE, langConfig.getString("message.use-in-creative", "&cYou cannot use a shop in creative mode.")));
|
||||
messages.add(new LocalizedMessage(Message.UPDATE_AVAILABLE, langConfig.getString("message.update.update-available", "&6&lVersion &c%VERSION% &6of &cShopChest &6is available &chere.")));
|
||||
messages.add(new LocalizedMessage(Message.UPDATE_CLICK_TO_DOWNLOAD, langConfig.getString("message.update.click-to-download", "Click to download")));
|
||||
messages.add(new LocalizedMessage(Message.UPDATE_NO_UPDATE, langConfig.getString("message.update.no-update", "&6&lNo new update available.")));
|
||||
messages.add(new LocalizedMessage(Message.UPDATE_CHECKING, langConfig.getString("message.update.checking", "&6&lChecking for updates...")));
|
||||
messages.add(new LocalizedMessage(Message.UPDATE_ERROR, langConfig.getString("message.update.error", "&c&lError while checking for updates.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_CREATE, langConfig.getString("message.noPermission.create", "&cYou don't have permission to create a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_CREATE_ADMIN, langConfig.getString("message.noPermission.create-admin", "&cYou don't have permission to create an admin shop.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_CREATE_PROTECTED, langConfig.getString("message.noPermission.create-protected", "&cYou don't have permission to create a shop on a protected chest.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_OPEN_OTHERS, langConfig.getString("message.noPermission.open-others", "&cYou don't have permission to open this chest.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_BUY, langConfig.getString("message.noPermission.buy", "&cYou don't have permission to buy something.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_SELL, langConfig.getString("message.noPermission.sell", "&cYou don't have permission to sell something.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_BUY_HERE, langConfig.getString("message.noPermission.buy-here", "&cYou don't have permission to buy something here.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_SELL_HERE, langConfig.getString("message.noPermission.sell-here", "&cYou don't have permission to sell something here.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_REMOVE_OTHERS, langConfig.getString("message.noPermission.remove-others", "&cYou don't have permission to remove this shop.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_REMOVE_ADMIN, langConfig.getString("message.noPermission.remove-admin", "&cYou don't have permission to remove an admin shop.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_RELOAD, langConfig.getString("message.noPermission.reload", "&cYou don't have permission to reload the shops.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_UPDATE, langConfig.getString("message.noPermission.update", "&cYou don't have permission to check for updates.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_CONFIG, langConfig.getString("message.noPermission.config", "&cYou don't have permission to change configuration values.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_EXTEND_OTHERS, langConfig.getString("message.noPermission.extend-others", "&cYou don't have permission to extend this chest.")));
|
||||
messages.add(new LocalizedMessage(Message.NO_PERMISSION_EXTEND_PROTECTED, langConfig.getString("message.noPermission.extend-protected", "&cYou don't have permission to extend this chest to here.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_HEADER, langConfig.getString("message.commandDescription.header", "&6==== &c/%COMMAND% &6Help")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_FOOTER, langConfig.getString("message.commandDescription.footer", "&6==== End")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_CREATE, langConfig.getString("message.commandDescription.create", "&a/%COMMAND% create <amount> <buy-price> <sell-price> - Create a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_CREATE_ADMIN, langConfig.getString("message.commandDescription.create-admin", "&a/%COMMAND% create <amount> <buy-price> <sell-price> [normal|admin] - Create a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_REMOVE, langConfig.getString("message.commandDescription.remove", "&a/%COMMAND% remove - Remove a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_INFO, langConfig.getString("message.commandDescription.info", "&a/%COMMAND% info - Retrieve shop information.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_REMOVEALL, langConfig.getString("message.commandDescription.removeall", "&a/%COMMAND% removeall - Remove all shops of a player.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_RELOAD, langConfig.getString("message.commandDescription.reload", "&a/%COMMAND% reload - Reload shops.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_UPDATE, langConfig.getString("message.commandDescription.update", "&a/%COMMAND% update - Check for Updates.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_LIMITS, langConfig.getString("message.commandDescription.limits", "&a/%COMMAND% limits - View shop limits.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_OPEN, langConfig.getString("message.commandDescription.open", "&a/%COMMAND% open - Open a shop.")));
|
||||
messages.add(new LocalizedMessage(Message.COMMAND_DESC_CONFIG, langConfig.getString("message.commandDescription.config", "&a/%COMMAND% config <set|get|remove> <property> <value> - Change configuration values.")));
|
||||
messages.add(new LocalizedMessage(Message.CHANGED_CONFIG_SET, langConfig.getString("message.config.set", "&6Changed &a%PROPERTY% &6to &a%VALUE%&6.")));
|
||||
messages.add(new LocalizedMessage(Message.CHANGED_CONFIG_REMOVED, langConfig.getString("message.config.removed", "&6Removed &a%VALUE% &6from &a%PROPERTY%&6.")));
|
||||
messages.add(new LocalizedMessage(Message.CHANGED_CONFIG_ADDED, langConfig.getString("message.config.added", "&6Added &a%VALUE% &6to &a%PROPERTY%&6.")));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1124,10 +1125,10 @@ public class LanguageUtils {
|
||||
|
||||
if (Utils.getMajorVersion() < 9) {
|
||||
potionType = Potion.fromItemStack(stack).getType();
|
||||
upgradeString = (Potion.fromItemStack(stack).getLevel() == 2 && plugin.getShopChestConfig().append_potion_level_to_item_name ? " II" : "");
|
||||
upgradeString = (Potion.fromItemStack(stack).getLevel() == 2 && Config.appendPotionLevelToItemName ? " II" : "");
|
||||
} else {
|
||||
potionType = meta.getBasePotionData().getType();
|
||||
upgradeString = (meta.getBasePotionData().isUpgraded() && plugin.getShopChestConfig().append_potion_level_to_item_name ? " II" : "");
|
||||
upgradeString = (meta.getBasePotionData().isUpgraded() && Config.appendPotionLevelToItemName ? " II" : "");
|
||||
}
|
||||
|
||||
for (PotionName potionName : potionNames) {
|
||||
@ -1302,22 +1303,22 @@ public class LanguageUtils {
|
||||
|
||||
/**
|
||||
* @param message Message which should be translated
|
||||
* @param replacedPlaceholders Placeholders which might be required to be replaced in the message
|
||||
* @param replacements Replacements of placeholders which might be required to be replaced in the message
|
||||
* @return Localized Message
|
||||
*/
|
||||
public static String getMessage(LocalizedMessage.Message message, LocalizedMessage.ReplacedPlaceholder... replacedPlaceholders) {
|
||||
public static String getMessage(Message message, Replacement... replacements) {
|
||||
String finalMessage = ChatColor.RED + "An error occurred: Message not found: " + message.toString();
|
||||
|
||||
for (LocalizedMessage localizedMessage : messages) {
|
||||
if (localizedMessage.getMessage() == message) {
|
||||
finalMessage = localizedMessage.getLocalizedString();
|
||||
|
||||
for (LocalizedMessage.ReplacedPlaceholder replacedPlaceholder : replacedPlaceholders) {
|
||||
Placeholder placeholder = replacedPlaceholder.getPlaceholder();
|
||||
String toReplace = replacedPlaceholder.getReplace();
|
||||
for (Replacement replacement : replacements) {
|
||||
Placeholder placeholder = replacement.getPlaceholder();
|
||||
String toReplace = replacement.getReplacement();
|
||||
|
||||
if (placeholder == Placeholder.BUY_PRICE || placeholder == Placeholder.SELL_PRICE || placeholder == Placeholder.MIN_PRICE || placeholder == Placeholder.CREATION_PRICE || placeholder == Placeholder.REVENUE) {
|
||||
if (!toReplace.equals(getMessage(LocalizedMessage.Message.SHOP_INFO_DISABLED))) {
|
||||
if (!toReplace.equals(getMessage(Message.SHOP_INFO_DISABLED))) {
|
||||
double price = Double.parseDouble(toReplace);
|
||||
toReplace = plugin.getEconomy().format(price);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package de.epiceric.shopchest.language;
|
||||
|
||||
import de.epiceric.shopchest.config.Placeholder;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class LocalizedMessage {
|
||||
@ -27,129 +26,4 @@ public class LocalizedMessage {
|
||||
return localizedString;
|
||||
}
|
||||
|
||||
public enum Message {
|
||||
SHOP_CREATED,
|
||||
ADMIN_SHOP_CREATED,
|
||||
CHEST_ALREADY_SHOP,
|
||||
CHEST_BLOCKED,
|
||||
DOUBLE_CHEST_BLOCKED,
|
||||
SHOP_REMOVED,
|
||||
ALL_SHOPS_REMOVED,
|
||||
CHEST_NO_SHOP,
|
||||
SHOP_CREATE_NOT_ENOUGH_MONEY,
|
||||
SHOP_INFO_VENDOR,
|
||||
SHOP_INFO_PRODUCT,
|
||||
SHOP_INFO_STOCK,
|
||||
SHOP_INFO_ENCHANTMENTS,
|
||||
SHOP_INFO_POTION_EFFECT,
|
||||
SHOP_INFO_MUSIC_TITLE,
|
||||
SHOP_INFO_BOOK_GENERATION,
|
||||
SHOP_INFO_NONE,
|
||||
SHOP_INFO_PRICE,
|
||||
SHOP_INFO_DISABLED,
|
||||
SHOP_INFO_NORMAL,
|
||||
SHOP_INFO_ADMIN,
|
||||
SHOP_INFO_EXTENDED,
|
||||
BUY_SELL_DISABLED,
|
||||
BUY_SUCCESS,
|
||||
BUY_SUCCESS_ADMIN,
|
||||
SELL_SUCCESS,
|
||||
SELL_SUCCESS_ADMIN,
|
||||
SOMEONE_BOUGHT,
|
||||
SOMEONE_SOLD,
|
||||
REVENUE_WHILE_OFFLINE,
|
||||
NOT_ENOUGH_INVENTORY_SPACE,
|
||||
CHEST_NOT_ENOUGH_INVENTORY_SPACE,
|
||||
NOT_ENOUGH_MONEY,
|
||||
NOT_ENOUGH_ITEMS,
|
||||
VENDOR_NOT_ENOUGH_MONEY,
|
||||
OUT_OF_STOCK,
|
||||
VENDOR_OUT_OF_STOCK,
|
||||
ERROR_OCCURRED,
|
||||
AMOUNT_PRICE_NOT_NUMBER,
|
||||
AMOUNT_IS_ZERO,
|
||||
PRICES_CONTAIN_DECIMALS,
|
||||
NO_ITEM_IN_HAND,
|
||||
CLICK_CHEST_CREATE,
|
||||
CLICK_CHEST_REMOVE,
|
||||
CLICK_CHEST_INFO,
|
||||
CLICK_CHEST_OPEN,
|
||||
CLICK_TO_CONFIRM,
|
||||
OPENED_SHOP,
|
||||
CANNOT_BREAK_SHOP,
|
||||
CANNOT_SELL_BROKEN_ITEM,
|
||||
BUY_PRICE_TOO_LOW,
|
||||
SELL_PRICE_TOO_LOW,
|
||||
BUY_PRICE_TOO_HIGH,
|
||||
SELL_PRICE_TOO_HIGH,
|
||||
BUYING_DISABLED,
|
||||
SELLING_DISABLED,
|
||||
RELOADED_SHOPS,
|
||||
SHOP_LIMIT_REACHED,
|
||||
OCCUPIED_SHOP_SLOTS,
|
||||
CANNOT_SELL_ITEM,
|
||||
USE_IN_CREATIVE,
|
||||
UPDATE_AVAILABLE,
|
||||
UPDATE_CLICK_TO_DOWNLOAD,
|
||||
UPDATE_NO_UPDATE,
|
||||
UPDATE_CHECKING,
|
||||
UPDATE_ERROR,
|
||||
NO_PERMISSION_CREATE,
|
||||
NO_PERMISSION_CREATE_ADMIN,
|
||||
NO_PERMISSION_CREATE_PROTECTED,
|
||||
NO_PERMISSION_OPEN_OTHERS,
|
||||
NO_PERMISSION_BUY,
|
||||
NO_PERMISSION_SELL,
|
||||
NO_PERMISSION_BUY_HERE,
|
||||
NO_PERMISSION_SELL_HERE,
|
||||
NO_PERMISSION_REMOVE_OTHERS,
|
||||
NO_PERMISSION_REMOVE_ADMIN,
|
||||
NO_PERMISSION_RELOAD,
|
||||
NO_PERMISSION_UPDATE,
|
||||
NO_PERMISSION_CONFIG,
|
||||
NO_PERMISSION_EXTEND_OTHERS,
|
||||
NO_PERMISSION_EXTEND_PROTECTED,
|
||||
COMMAND_DESC_HEADER,
|
||||
COMMAND_DESC_FOOTER,
|
||||
COMMAND_DESC_CREATE,
|
||||
COMMAND_DESC_CREATE_ADMIN,
|
||||
COMMAND_DESC_REMOVE,
|
||||
COMMAND_DESC_INFO,
|
||||
COMMAND_DESC_REMOVEALL,
|
||||
COMMAND_DESC_RELOAD,
|
||||
COMMAND_DESC_UPDATE,
|
||||
COMMAND_DESC_LIMITS,
|
||||
COMMAND_DESC_OPEN,
|
||||
COMMAND_DESC_CONFIG,
|
||||
CHANGED_CONFIG_SET,
|
||||
CHANGED_CONFIG_REMOVED,
|
||||
CHANGED_CONFIG_ADDED
|
||||
}
|
||||
|
||||
public static class ReplacedPlaceholder {
|
||||
|
||||
private Placeholder placeholder;
|
||||
private String replace;
|
||||
|
||||
public ReplacedPlaceholder(Placeholder placeholder, String replace) {
|
||||
this.placeholder = placeholder;
|
||||
this.replace = replace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String which will replace the placeholder
|
||||
*/
|
||||
public String getReplace() {
|
||||
return replace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Placeholder that will be replaced
|
||||
*/
|
||||
public Placeholder getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
100
src/main/java/de/epiceric/shopchest/language/Message.java
Normal file
100
src/main/java/de/epiceric/shopchest/language/Message.java
Normal file
@ -0,0 +1,100 @@
|
||||
package de.epiceric.shopchest.language;
|
||||
|
||||
public enum Message {
|
||||
SHOP_CREATED,
|
||||
ADMIN_SHOP_CREATED,
|
||||
CHEST_ALREADY_SHOP,
|
||||
CHEST_BLOCKED,
|
||||
DOUBLE_CHEST_BLOCKED,
|
||||
SHOP_REMOVED,
|
||||
ALL_SHOPS_REMOVED,
|
||||
CHEST_NO_SHOP,
|
||||
SHOP_CREATE_NOT_ENOUGH_MONEY,
|
||||
SHOP_INFO_VENDOR,
|
||||
SHOP_INFO_PRODUCT,
|
||||
SHOP_INFO_STOCK,
|
||||
SHOP_INFO_ENCHANTMENTS,
|
||||
SHOP_INFO_POTION_EFFECT,
|
||||
SHOP_INFO_MUSIC_TITLE,
|
||||
SHOP_INFO_BOOK_GENERATION,
|
||||
SHOP_INFO_NONE,
|
||||
SHOP_INFO_PRICE,
|
||||
SHOP_INFO_DISABLED,
|
||||
SHOP_INFO_NORMAL,
|
||||
SHOP_INFO_ADMIN,
|
||||
SHOP_INFO_EXTENDED,
|
||||
BUY_SELL_DISABLED,
|
||||
BUY_SUCCESS,
|
||||
BUY_SUCCESS_ADMIN,
|
||||
SELL_SUCCESS,
|
||||
SELL_SUCCESS_ADMIN,
|
||||
SOMEONE_BOUGHT,
|
||||
SOMEONE_SOLD,
|
||||
REVENUE_WHILE_OFFLINE,
|
||||
NOT_ENOUGH_INVENTORY_SPACE,
|
||||
CHEST_NOT_ENOUGH_INVENTORY_SPACE,
|
||||
NOT_ENOUGH_MONEY,
|
||||
NOT_ENOUGH_ITEMS,
|
||||
VENDOR_NOT_ENOUGH_MONEY,
|
||||
OUT_OF_STOCK,
|
||||
VENDOR_OUT_OF_STOCK,
|
||||
ERROR_OCCURRED,
|
||||
AMOUNT_PRICE_NOT_NUMBER,
|
||||
AMOUNT_IS_ZERO,
|
||||
PRICES_CONTAIN_DECIMALS,
|
||||
NO_ITEM_IN_HAND,
|
||||
CLICK_CHEST_CREATE,
|
||||
CLICK_CHEST_REMOVE,
|
||||
CLICK_CHEST_INFO,
|
||||
CLICK_CHEST_OPEN,
|
||||
CLICK_TO_CONFIRM,
|
||||
OPENED_SHOP,
|
||||
CANNOT_BREAK_SHOP,
|
||||
CANNOT_SELL_BROKEN_ITEM,
|
||||
BUY_PRICE_TOO_LOW,
|
||||
SELL_PRICE_TOO_LOW,
|
||||
BUY_PRICE_TOO_HIGH,
|
||||
SELL_PRICE_TOO_HIGH,
|
||||
BUYING_DISABLED,
|
||||
SELLING_DISABLED,
|
||||
RELOADED_SHOPS,
|
||||
SHOP_LIMIT_REACHED,
|
||||
OCCUPIED_SHOP_SLOTS,
|
||||
CANNOT_SELL_ITEM,
|
||||
USE_IN_CREATIVE,
|
||||
UPDATE_AVAILABLE,
|
||||
UPDATE_CLICK_TO_DOWNLOAD,
|
||||
UPDATE_NO_UPDATE,
|
||||
UPDATE_CHECKING,
|
||||
UPDATE_ERROR,
|
||||
NO_PERMISSION_CREATE,
|
||||
NO_PERMISSION_CREATE_ADMIN,
|
||||
NO_PERMISSION_CREATE_PROTECTED,
|
||||
NO_PERMISSION_OPEN_OTHERS,
|
||||
NO_PERMISSION_BUY,
|
||||
NO_PERMISSION_SELL,
|
||||
NO_PERMISSION_BUY_HERE,
|
||||
NO_PERMISSION_SELL_HERE,
|
||||
NO_PERMISSION_REMOVE_OTHERS,
|
||||
NO_PERMISSION_REMOVE_ADMIN,
|
||||
NO_PERMISSION_RELOAD,
|
||||
NO_PERMISSION_UPDATE,
|
||||
NO_PERMISSION_CONFIG,
|
||||
NO_PERMISSION_EXTEND_OTHERS,
|
||||
NO_PERMISSION_EXTEND_PROTECTED,
|
||||
COMMAND_DESC_HEADER,
|
||||
COMMAND_DESC_FOOTER,
|
||||
COMMAND_DESC_CREATE,
|
||||
COMMAND_DESC_CREATE_ADMIN,
|
||||
COMMAND_DESC_REMOVE,
|
||||
COMMAND_DESC_INFO,
|
||||
COMMAND_DESC_REMOVEALL,
|
||||
COMMAND_DESC_RELOAD,
|
||||
COMMAND_DESC_UPDATE,
|
||||
COMMAND_DESC_LIMITS,
|
||||
COMMAND_DESC_OPEN,
|
||||
COMMAND_DESC_CONFIG,
|
||||
CHANGED_CONFIG_SET,
|
||||
CHANGED_CONFIG_REMOVED,
|
||||
CHANGED_CONFIG_ADDED
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package de.epiceric.shopchest.language;
|
||||
|
||||
import de.epiceric.shopchest.config.Placeholder;
|
||||
|
||||
public class Replacement {
|
||||
|
||||
private Placeholder placeholder;
|
||||
private String replacement;
|
||||
|
||||
public Replacement(Placeholder placeholder, String replacement) {
|
||||
this.placeholder = placeholder;
|
||||
this.replacement = replacement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String which will replace the placeholder
|
||||
*/
|
||||
public String getReplacement() {
|
||||
return replacement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Placeholder that will be replaced
|
||||
*/
|
||||
public Placeholder getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
}
|
@ -16,37 +16,35 @@ import org.bukkit.event.Listener;
|
||||
public class AreaShopListener implements Listener {
|
||||
|
||||
private ShopChest plugin;
|
||||
private Config config;
|
||||
|
||||
public AreaShopListener(ShopChest plugin) {
|
||||
this.plugin = plugin;
|
||||
this.config = plugin.getShopChestConfig();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRegionDeleted(DeletedRegionEvent e) {
|
||||
if (config.enable_areashop_integration && config.areashop_remove_shop_events.contains("DELETE")) {
|
||||
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("DELETE")) {
|
||||
removeShopsInRegion(e.getRegion());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRegionUnrented(UnrentedRegionEvent e) {
|
||||
if (config.enable_areashop_integration && config.areashop_remove_shop_events.contains("UNRENT")) {
|
||||
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("UNRENT")) {
|
||||
removeShopsInRegion(e.getRegion());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRegionResold(ResoldRegionEvent e) {
|
||||
if (config.enable_areashop_integration && config.areashop_remove_shop_events.contains("RESELL")) {
|
||||
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("RESELL")) {
|
||||
removeShopsInRegion(e.getRegion());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRegionSold(SoldRegionEvent e) {
|
||||
if (config.enable_areashop_integration && config.areashop_remove_shop_events.contains("SELL")) {
|
||||
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("SELL")) {
|
||||
removeShopsInRegion(e.getRegion());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.epiceric.shopchest.listeners;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -19,7 +20,7 @@ public class BlockExplodeListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockExplode(BlockExplodeEvent e) {
|
||||
if (plugin.getShopChestConfig().explosion_protection) {
|
||||
if (Config.explosionProtection) {
|
||||
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
||||
for (Block b : bl) {
|
||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
|
@ -14,7 +14,7 @@ import de.epiceric.shopchest.config.Config;
|
||||
import de.epiceric.shopchest.external.PlotSquaredShopFlag;
|
||||
import de.epiceric.shopchest.external.WorldGuardShopFlag;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.language.Message;
|
||||
import de.epiceric.shopchest.nms.Hologram;
|
||||
import de.epiceric.shopchest.shop.Shop;
|
||||
import de.epiceric.shopchest.utils.Callback;
|
||||
@ -49,13 +49,11 @@ public class ChestProtectListener implements Listener {
|
||||
|
||||
private ShopChest plugin;
|
||||
private ShopUtils shopUtils;
|
||||
private Config config;
|
||||
private WorldGuardPlugin worldGuard;
|
||||
|
||||
public ChestProtectListener(ShopChest plugin, WorldGuardPlugin worldGuard) {
|
||||
this.plugin = plugin;
|
||||
this.shopUtils = plugin.getShopUtils();
|
||||
this.config = plugin.getShopChestConfig();
|
||||
this.worldGuard = worldGuard;
|
||||
}
|
||||
|
||||
@ -78,7 +76,7 @@ public class ChestProtectListener implements Listener {
|
||||
} else {
|
||||
shopUtils.removeShop(shop, true);
|
||||
plugin.debug(String.format("%s broke %s's shop (#%d)", p.getName(), shop.getVendor().getName(), shop.getID()));
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_REMOVED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.SHOP_REMOVED));
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,13 +109,13 @@ public class ChestProtectListener implements Listener {
|
||||
}
|
||||
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CANNOT_BREAK_SHOP));
|
||||
e.getPlayer().sendMessage(LanguageUtils.getMessage(Message.CANNOT_BREAK_SHOP));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityExplode(EntityExplodeEvent e) {
|
||||
if (config.explosion_protection) {
|
||||
if (Config.explosionProtection) {
|
||||
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
||||
for (Block b : bl) {
|
||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
@ -156,13 +154,13 @@ public class ChestProtectListener implements Listener {
|
||||
|
||||
boolean externalPluginsAllowed = true;
|
||||
|
||||
if (plugin.hasWorldGuard() && config.enable_worldguard_integration) {
|
||||
if (plugin.hasWorldGuard() && Config.enableWorldGuardIntegration) {
|
||||
RegionContainer container = worldGuard.getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
externalPluginsAllowed = query.testState(b.getLocation(), p, WorldGuardShopFlag.CREATE_SHOP);
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasTowny() && config.enable_towny_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasTowny() && Config.enableTownyIntegration) {
|
||||
TownBlock townBlock = TownyUniverse.getTownBlock(b.getLocation());
|
||||
if (townBlock != null) {
|
||||
try {
|
||||
@ -170,11 +168,11 @@ public class ChestProtectListener implements Listener {
|
||||
for (Resident resident : town.getResidents()) {
|
||||
if (resident.getName().equals(p.getName())) {
|
||||
if (resident.isMayor()) {
|
||||
externalPluginsAllowed = (config.towny_shop_plots_mayor.contains(townBlock.getType().name()));
|
||||
externalPluginsAllowed = (Config.townyShopPlotsMayor.contains(townBlock.getType().name()));
|
||||
} else if (resident.isKing()) {
|
||||
externalPluginsAllowed = (config.towny_shop_plots_king.contains(townBlock.getType().name()));
|
||||
externalPluginsAllowed = (Config.townyShopPlotsKing.contains(townBlock.getType().name()));
|
||||
} else {
|
||||
externalPluginsAllowed = (config.towny_shop_plots_residents.contains(townBlock.getType().name()));
|
||||
externalPluginsAllowed = (Config.townyShopPlotsResidents.contains(townBlock.getType().name()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -185,21 +183,21 @@ public class ChestProtectListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasPlotSquared() && config.enable_plotsquared_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasPlotSquared() && Config.enablePlotsquaredIntegration) {
|
||||
com.intellectualcrafters.plot.object.Location loc =
|
||||
new com.intellectualcrafters.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
|
||||
|
||||
externalPluginsAllowed = Utils.isFlagAllowedOnPlot(loc.getOwnedPlot(), PlotSquaredShopFlag.CREATE_SHOP, p);
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasUSkyBlock() && config.enable_uskyblock_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasUSkyBlock() && Config.enableUSkyblockIntegration) {
|
||||
IslandInfo islandInfo = plugin.getUSkyBlock().getIslandInfo(b.getLocation());
|
||||
if (islandInfo != null) {
|
||||
externalPluginsAllowed = islandInfo.getMembers().contains(p.getName()) || islandInfo.getLeader().equals(p.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasASkyBlock() && config.enable_askyblock_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasASkyBlock() && Config.enableASkyblockIntegration) {
|
||||
Island island = ASkyBlockAPI.getInstance().getIslandAt(b.getLocation());
|
||||
if (island != null) {
|
||||
if (island.getOwner() == null) {
|
||||
@ -210,13 +208,13 @@ public class ChestProtectListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasIslandWorld() && config.enable_islandworld_integration && IslandWorldApi.isInitialized()) {
|
||||
if (externalPluginsAllowed && plugin.hasIslandWorld() && Config.enableIslandWorldIntegration && IslandWorldApi.isInitialized()) {
|
||||
if (b.getWorld().getName().equals(IslandWorldApi.getIslandWorld().getName())) {
|
||||
externalPluginsAllowed = IslandWorldApi.canBuildOnLocation(p, b.getLocation(), true);
|
||||
}
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasGriefPrevention() && config.enable_griefprevention_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasGriefPrevention() && Config.enableGriefPreventionIntegration) {
|
||||
Claim claim = plugin.getGriefPrevention().dataStore.getClaimAt(b.getLocation(), false, null);
|
||||
if (claim != null) {
|
||||
externalPluginsAllowed = claim.allowContainers(p) == null;
|
||||
@ -238,15 +236,15 @@ public class ChestProtectListener implements Listener {
|
||||
});
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_BLOCKED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CHEST_BLOCKED));
|
||||
}
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_EXTEND_OTHERS));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_EXTEND_OTHERS));
|
||||
}
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_EXTEND_PROTECTED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_EXTEND_PROTECTED));
|
||||
}
|
||||
|
||||
}
|
||||
@ -267,7 +265,7 @@ public class ChestProtectListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryMoveItemEvent e) {
|
||||
if (config.hopper_protection) {
|
||||
if (Config.hopperProtection) {
|
||||
if ((e.getSource().getType().equals(InventoryType.CHEST)) && (!e.getInitiator().getType().equals(InventoryType.PLAYER))) {
|
||||
|
||||
if (e.getSource().getHolder() instanceof DoubleChest) {
|
||||
|
@ -1,18 +1,20 @@
|
||||
package de.epiceric.shopchest.listeners;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Placeholder;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.nms.JsonBuilder;
|
||||
import de.epiceric.shopchest.utils.Callback;
|
||||
import de.epiceric.shopchest.utils.Permissions;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Placeholder;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.Message;
|
||||
import de.epiceric.shopchest.language.Replacement;
|
||||
import de.epiceric.shopchest.nms.JsonBuilder;
|
||||
import de.epiceric.shopchest.utils.Callback;
|
||||
import de.epiceric.shopchest.utils.Permissions;
|
||||
|
||||
public class NotifyPlayerOnJoinListener implements Listener {
|
||||
|
||||
private ShopChest plugin;
|
||||
@ -27,7 +29,7 @@ public class NotifyPlayerOnJoinListener implements Listener {
|
||||
|
||||
if (plugin.isUpdateNeeded()) {
|
||||
if (p.hasPermission(Permissions.UPDATE_NOTIFICATION)) {
|
||||
JsonBuilder jb = new JsonBuilder(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedPlaceholder(Placeholder.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
JsonBuilder jb = new JsonBuilder(plugin, LanguageUtils.getMessage(Message.UPDATE_AVAILABLE, new Replacement(Placeholder.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
jb.sendJson(p);
|
||||
}
|
||||
}
|
||||
@ -36,8 +38,8 @@ public class NotifyPlayerOnJoinListener implements Listener {
|
||||
@Override
|
||||
public void onResult(Long result) {
|
||||
if (result < 0) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, "Could not get last time you logged out")));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED,
|
||||
new Replacement(Placeholder.ERROR, "Could not get last time you logged out")));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -45,8 +47,8 @@ public class NotifyPlayerOnJoinListener implements Listener {
|
||||
@Override
|
||||
public void onResult(Double result) {
|
||||
if (result != 0) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.REVENUE_WHILE_OFFLINE,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.REVENUE, String.valueOf(result))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.REVENUE_WHILE_OFFLINE,
|
||||
new Replacement(Placeholder.REVENUE, String.valueOf(result))));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -23,7 +23,8 @@ import de.epiceric.shopchest.event.ShopRemoveEvent;
|
||||
import de.epiceric.shopchest.external.PlotSquaredShopFlag;
|
||||
import de.epiceric.shopchest.external.WorldGuardShopFlag;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.language.Message;
|
||||
import de.epiceric.shopchest.language.Replacement;
|
||||
import de.epiceric.shopchest.nms.CustomBookMeta;
|
||||
import de.epiceric.shopchest.nms.Hologram;
|
||||
import de.epiceric.shopchest.shop.Shop;
|
||||
@ -81,7 +82,6 @@ public class ShopInteractListener implements Listener {
|
||||
private Economy econ;
|
||||
private Database database;
|
||||
private ShopUtils shopUtils;
|
||||
private Config config;
|
||||
private WorldGuardPlugin worldGuard;
|
||||
|
||||
public ShopInteractListener(ShopChest plugin) {
|
||||
@ -89,7 +89,6 @@ public class ShopInteractListener implements Listener {
|
||||
this.econ = plugin.getEconomy();
|
||||
this.database = plugin.getShopDatabase();
|
||||
this.shopUtils = plugin.getShopUtils();
|
||||
this.config = plugin.getShopChestConfig();
|
||||
this.worldGuard = plugin.getWorldGuard();
|
||||
}
|
||||
|
||||
@ -136,7 +135,7 @@ public class ShopInteractListener implements Listener {
|
||||
Player p = e.getPlayer();
|
||||
Block b = e.getClickedBlock();
|
||||
|
||||
if (config.enable_authme_integration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
|
||||
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
|
||||
|
||||
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
@ -158,7 +157,7 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
String denyReason = "Event Cancelled";
|
||||
|
||||
if (plugin.hasWorldGuard() && config.enable_worldguard_integration) {
|
||||
if (plugin.hasWorldGuard() && Config.enableWorldGuardIntegration) {
|
||||
plugin.debug("Checking if WorldGuard allows shop creation...");
|
||||
RegionContainer container = worldGuard.getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
@ -172,7 +171,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (!externalPluginsAllowed) denyReason = "WorldGuard";
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasTowny() && config.enable_towny_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasTowny() && Config.enableTownyIntegration) {
|
||||
plugin.debug("Checking if Towny allows shop creation...");
|
||||
for (Location loc : chestLocations) {
|
||||
if (loc != null) {
|
||||
@ -187,13 +186,13 @@ public class ShopInteractListener implements Listener {
|
||||
residentFound = true;
|
||||
if (resident.isMayor()) {
|
||||
plugin.debug(p.getName() + " is mayor of town");
|
||||
externalPluginsAllowed &= (config.towny_shop_plots_mayor.contains(townBlock.getType().name()));
|
||||
externalPluginsAllowed &= (Config.townyShopPlotsMayor.contains(townBlock.getType().name()));
|
||||
} else if (resident.isKing()) {
|
||||
plugin.debug(p.getName() + " is king of town");
|
||||
externalPluginsAllowed &= (config.towny_shop_plots_king.contains(townBlock.getType().name()));
|
||||
externalPluginsAllowed &= (Config.townyShopPlotsKing.contains(townBlock.getType().name()));
|
||||
} else {
|
||||
plugin.debug(p.getName() + " is resident in town");
|
||||
externalPluginsAllowed &= (config.towny_shop_plots_residents.contains(townBlock.getType().name()));
|
||||
externalPluginsAllowed &= (Config.townyShopPlotsResidents.contains(townBlock.getType().name()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -212,7 +211,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (!externalPluginsAllowed) denyReason = "Towny";
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasPlotSquared() && config.enable_plotsquared_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasPlotSquared() && Config.enablePlotsquaredIntegration) {
|
||||
plugin.debug("Checking if PlotSquared allows shop creation...");
|
||||
for (Location loc : chestLocations) {
|
||||
if (loc != null) {
|
||||
@ -227,7 +226,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (!externalPluginsAllowed) denyReason = "PlotSquared";
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasUSkyBlock() && config.enable_uskyblock_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasUSkyBlock() && Config.enableUSkyblockIntegration) {
|
||||
plugin.debug("Checking if uSkyBlock allows shop creation...");
|
||||
for (Location loc : chestLocations) {
|
||||
if (loc != null) {
|
||||
@ -242,7 +241,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (!externalPluginsAllowed) denyReason = "uSkyBlock";
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasASkyBlock() && config.enable_askyblock_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasASkyBlock() && Config.enableASkyblockIntegration) {
|
||||
plugin.debug("Checking if ASkyBlock allows shop creation...");
|
||||
for (Location loc : chestLocations) {
|
||||
if (loc != null) {
|
||||
@ -262,7 +261,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (!externalPluginsAllowed) denyReason = "ASkyBlock";
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasIslandWorld() && config.enable_islandworld_integration && IslandWorldApi.isInitialized()) {
|
||||
if (externalPluginsAllowed && plugin.hasIslandWorld() && Config.enableIslandWorldIntegration && IslandWorldApi.isInitialized()) {
|
||||
plugin.debug("Checking if IslandWorld allows shop creation...");
|
||||
for (Location loc : chestLocations) {
|
||||
if (loc != null) {
|
||||
@ -276,7 +275,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (!externalPluginsAllowed) denyReason = "IslandWorld";
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasGriefPrevention() && config.enable_griefprevention_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasGriefPrevention() && Config.enableGriefPreventionIntegration) {
|
||||
plugin.debug("Checking if GriefPrevention allows shop creation...");
|
||||
String gpDenyReason = null;
|
||||
for (Location loc : chestLocations) {
|
||||
@ -294,7 +293,7 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
|
||||
if ((e.isCancelled() || !externalPluginsAllowed) && !p.hasPermission(Permissions.CREATE_PROTECTED)) {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE_PROTECTED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_CREATE_PROTECTED));
|
||||
ClickType.removePlayerClickType(p);
|
||||
plugin.debug(p.getName() + " is not allowed to create a shop on the selected chest because " + denyReason);
|
||||
e.setCancelled(true);
|
||||
@ -312,12 +311,12 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
create(p, b.getLocation(), product, buyPrice, sellPrice, shopType);
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_BLOCKED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CHEST_BLOCKED));
|
||||
plugin.debug("Chest is blocked");
|
||||
}
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_ALREADY_SHOP));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CHEST_ALREADY_SHOP));
|
||||
plugin.debug("Chest is already a shop");
|
||||
}
|
||||
|
||||
@ -334,7 +333,7 @@ public class ShopInteractListener implements Listener {
|
||||
private void handleInteractEvent(PlayerInteractEvent e) {
|
||||
Block b = e.getClickedBlock();
|
||||
Player p = e.getPlayer();
|
||||
boolean inverted = config.invert_mouse_buttons;
|
||||
boolean inverted = Config.invertMouseButtons;
|
||||
|
||||
if (Utils.getMajorVersion() >= 9) {
|
||||
if (e.getHand() == EquipmentSlot.OFF_HAND) return;
|
||||
@ -362,14 +361,14 @@ public class ShopInteractListener implements Listener {
|
||||
if (p.hasPermission(Permissions.REMOVE_ADMIN)) {
|
||||
remove(p, shop);
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_REMOVE_ADMIN));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_REMOVE_ADMIN));
|
||||
plugin.debug(p.getName() + " is not permitted to remove an admin shop");
|
||||
}
|
||||
} else {
|
||||
if (shop.getVendor().getUniqueId().equals(p.getUniqueId()) || p.hasPermission(Permissions.REMOVE_OTHER)) {
|
||||
remove(p, shop);
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_REMOVE_OTHERS));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_REMOVE_OTHERS));
|
||||
plugin.debug(p.getName() + " is not permitted to remove another player's shop");
|
||||
}
|
||||
}
|
||||
@ -383,7 +382,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (p.getUniqueId().equals(shop.getVendor().getUniqueId()) || p.hasPermission(Permissions.OPEN_OTHER)) {
|
||||
open(p, shop, true);
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_OPEN_OTHERS));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_OPEN_OTHERS));
|
||||
plugin.debug(p.getName() + " is not permitted to open another player's shop");
|
||||
}
|
||||
|
||||
@ -391,7 +390,7 @@ public class ShopInteractListener implements Listener {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_NO_SHOP));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CHEST_NO_SHOP));
|
||||
plugin.debug("Chest is not a shop");
|
||||
}
|
||||
}
|
||||
@ -405,7 +404,7 @@ public class ShopInteractListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack infoItem = config.shop_info_item;
|
||||
ItemStack infoItem = Config.shopInfoItem;
|
||||
if (infoItem != null) {
|
||||
if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
ItemStack item = Utils.getItemInMainHand(p);
|
||||
@ -432,7 +431,7 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.USE_IN_CREATIVE));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.USE_IN_CREATIVE));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -446,7 +445,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (p.hasPermission(Permissions.BUY)) {
|
||||
boolean externalPluginsAllowed = true;
|
||||
|
||||
if (plugin.hasPlotSquared() && config.enable_plotsquared_integration) {
|
||||
if (plugin.hasPlotSquared() && Config.enablePlotsquaredIntegration) {
|
||||
com.intellectualcrafters.plot.object.Location plotLocation =
|
||||
new com.intellectualcrafters.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
|
||||
|
||||
@ -456,7 +455,7 @@ public class ShopInteractListener implements Listener {
|
||||
externalPluginsAllowed = Utils.isFlagAllowedOnPlot(plot, flag, p);
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasWorldGuard() && config.enable_worldguard_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasWorldGuard() && Config.enableWorldGuardIntegration) {
|
||||
StateFlag flag = (shop.getShopType() == ShopType.ADMIN ? WorldGuardShopFlag.USE_ADMIN_SHOP : WorldGuardShopFlag.USE_SHOP);
|
||||
RegionContainer container = worldGuard.getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
@ -465,9 +464,9 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
if (shop.getShopType() == ShopType.ADMIN) {
|
||||
if (externalPluginsAllowed || p.hasPermission(Permissions.BYPASS_EXTERNAL_PLUGIN)) {
|
||||
if (confirmed || !config.confirm_shopping) {
|
||||
if (confirmed || !Config.confirmShopping) {
|
||||
buy(p, shop, p.isSneaking());
|
||||
if (config.confirm_shopping) {
|
||||
if (Config.confirmShopping) {
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.remove(shop.getID());
|
||||
if (ids.isEmpty()) needsConfirmation.remove(p.getUniqueId());
|
||||
@ -475,14 +474,14 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Needs confirmation");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_TO_CONFIRM));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_TO_CONFIRM));
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.add(shop.getID());
|
||||
needsConfirmation.put(p.getUniqueId(), ids);
|
||||
}
|
||||
} else {
|
||||
plugin.debug(p.getName() + " doesn't have external plugin's permission");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_BUY_HERE));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_BUY_HERE));
|
||||
}
|
||||
} else {
|
||||
if (externalPluginsAllowed || p.hasPermission(Permissions.BYPASS_EXTERNAL_PLUGIN)) {
|
||||
@ -490,9 +489,9 @@ public class ShopInteractListener implements Listener {
|
||||
int amount = (p.isSneaking() ? shop.getProduct().getMaxStackSize() : shop.getProduct().getAmount());
|
||||
|
||||
if (Utils.getAmount(c.getInventory(), shop.getProduct()) >= amount) {
|
||||
if (confirmed || !config.confirm_shopping) {
|
||||
if (confirmed || !Config.confirmShopping) {
|
||||
buy(p, shop, p.isSneaking());
|
||||
if (config.confirm_shopping) {
|
||||
if (Config.confirmShopping) {
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.remove(shop.getID());
|
||||
if (ids.isEmpty()) needsConfirmation.remove(p.getUniqueId());
|
||||
@ -500,16 +499,16 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Needs confirmation");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_TO_CONFIRM));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_TO_CONFIRM));
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.add(shop.getID());
|
||||
needsConfirmation.put(p.getUniqueId(), ids);
|
||||
}
|
||||
} else {
|
||||
if (config.auto_calculate_item_amount && Utils.getAmount(c.getInventory(), shop.getProduct()) > 0) {
|
||||
if (confirmed || !config.confirm_shopping) {
|
||||
if (Config.autoCalculateItemAmount && Utils.getAmount(c.getInventory(), shop.getProduct()) > 0) {
|
||||
if (confirmed || !Config.confirmShopping) {
|
||||
buy(p, shop, p.isSneaking());
|
||||
if (config.confirm_shopping) {
|
||||
if (Config.confirmShopping) {
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.remove(shop.getID());
|
||||
if (ids.isEmpty()) needsConfirmation.remove(p.getUniqueId());
|
||||
@ -517,32 +516,32 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Needs confirmation");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_TO_CONFIRM));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_TO_CONFIRM));
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.add(shop.getID());
|
||||
needsConfirmation.put(p.getUniqueId(), ids);
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.OUT_OF_STOCK));
|
||||
if (shop.getVendor().isOnline() && config.enable_vendor_messages) {
|
||||
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.VENDOR_OUT_OF_STOCK,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(shop.getProduct().getAmount())),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(shop.getProduct()))));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.OUT_OF_STOCK));
|
||||
if (shop.getVendor().isOnline() && Config.enableVendorMessages) {
|
||||
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(Message.VENDOR_OUT_OF_STOCK,
|
||||
new Replacement(Placeholder.AMOUNT, String.valueOf(shop.getProduct().getAmount())),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(shop.getProduct()))));
|
||||
}
|
||||
plugin.debug("Shop is out of stock");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.debug(p.getName() + " doesn't have external plugin's permission");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_BUY_HERE));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_BUY_HERE));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_BUY));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_BUY));
|
||||
plugin.debug(p.getName() + " is not permitted to buy");
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUYING_DISABLED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.BUYING_DISABLED));
|
||||
plugin.debug("Buying is disabled");
|
||||
}
|
||||
}
|
||||
@ -557,7 +556,7 @@ public class ShopInteractListener implements Listener {
|
||||
if (p.hasPermission(Permissions.SELL)) {
|
||||
boolean externalPluginsAllowed = true;
|
||||
|
||||
if (plugin.hasPlotSquared() && config.enable_plotsquared_integration) {
|
||||
if (plugin.hasPlotSquared() && Config.enablePlotsquaredIntegration) {
|
||||
com.intellectualcrafters.plot.object.Location plotLocation =
|
||||
new com.intellectualcrafters.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
|
||||
|
||||
@ -567,7 +566,7 @@ public class ShopInteractListener implements Listener {
|
||||
externalPluginsAllowed = Utils.isFlagAllowedOnPlot(plot, flag, p);
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasWorldGuard() && config.enable_worldguard_integration) {
|
||||
if (externalPluginsAllowed && plugin.hasWorldGuard() && Config.enableWorldGuardIntegration) {
|
||||
RegionContainer container = worldGuard.getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
|
||||
@ -580,9 +579,9 @@ public class ShopInteractListener implements Listener {
|
||||
int amount = stack ? shop.getProduct().getMaxStackSize() : shop.getProduct().getAmount();
|
||||
|
||||
if (Utils.getAmount(p.getInventory(), shop.getProduct()) >= amount) {
|
||||
if (confirmed || !config.confirm_shopping) {
|
||||
if (confirmed || !Config.confirmShopping) {
|
||||
sell(p, shop, stack);
|
||||
if (config.confirm_shopping) {
|
||||
if (Config.confirmShopping) {
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.remove(shop.getID());
|
||||
if (ids.isEmpty()) needsConfirmation.remove(p.getUniqueId());
|
||||
@ -590,16 +589,16 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Needs confirmation");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_TO_CONFIRM));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_TO_CONFIRM));
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.add(shop.getID());
|
||||
needsConfirmation.put(p.getUniqueId(), ids);
|
||||
}
|
||||
} else {
|
||||
if (config.auto_calculate_item_amount && Utils.getAmount(p.getInventory(), shop.getProduct()) > 0) {
|
||||
if (confirmed || !config.confirm_shopping) {
|
||||
if (Config.autoCalculateItemAmount && Utils.getAmount(p.getInventory(), shop.getProduct()) > 0) {
|
||||
if (confirmed || !Config.confirmShopping) {
|
||||
sell(p, shop, stack);
|
||||
if (config.confirm_shopping) {
|
||||
if (Config.confirmShopping) {
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.remove(shop.getID());
|
||||
if (ids.isEmpty()) needsConfirmation.remove(p.getUniqueId());
|
||||
@ -607,26 +606,26 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Needs confirmation");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CLICK_TO_CONFIRM));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.CLICK_TO_CONFIRM));
|
||||
Set<Integer> ids = needsConfirmation.containsKey(p.getUniqueId()) ? needsConfirmation.get(p.getUniqueId()) : new HashSet<Integer>();
|
||||
ids.add(shop.getID());
|
||||
needsConfirmation.put(p.getUniqueId(), ids);
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_ITEMS));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_ITEMS));
|
||||
plugin.debug(p.getName() + " doesn't have enough items");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.debug(p.getName() + " doesn't have external plugin's permission");
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_SELL_HERE));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_SELL_HERE));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_SELL));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_SELL));
|
||||
plugin.debug(p.getName() + " is not permitted to sell");
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SELLING_DISABLED));
|
||||
p.sendMessage(LanguageUtils.getMessage(Message.SELLING_DISABLED));
|
||||
plugin.debug("Selling is disabled");
|
||||
}
|
||||
} else {
|
||||
@ -642,17 +641,17 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||
if (config.enable_authme_integration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(e.getPlayer())) return;
|
||||
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(e.getPlayer())) return;
|
||||
handleInteractEvent(e);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent e) {
|
||||
if (!plugin.getShopChestConfig().enable_hologram_interaction) return;
|
||||
if (!Config.enableHologramInteraction) return;
|
||||
|
||||
Entity entity = e.getRightClicked();
|
||||
Player p = e.getPlayer();
|
||||
if (config.enable_authme_integration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
|
||||
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
|
||||
|
||||
if (Utils.getMajorVersion() == 8 || e.getHand() == EquipmentSlot.HAND) {
|
||||
if (entity instanceof ArmorStand) {
|
||||
@ -680,14 +679,14 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDamageEntity(EntityDamageByEntityEvent e) {
|
||||
if (!plugin.getShopChestConfig().enable_hologram_interaction) return;
|
||||
if (!Config.enableHologramInteraction) return;
|
||||
|
||||
Entity entity = e.getEntity();
|
||||
Entity damager = e.getDamager();
|
||||
|
||||
if (!(damager instanceof Player)) return;
|
||||
Player p = (Player) damager;
|
||||
if (config.enable_authme_integration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
|
||||
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
|
||||
|
||||
if (entity instanceof ArmorStand) {
|
||||
ArmorStand armorStand = (ArmorStand) entity;
|
||||
@ -726,12 +725,12 @@ public class ShopInteractListener implements Listener {
|
||||
plugin.debug(executor.getName() + " is creating new shop...");
|
||||
|
||||
if (!executor.hasPermission(Permissions.CREATE)) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_CREATE));
|
||||
plugin.debug(executor.getName() + " is not permitted to create the shop");
|
||||
return;
|
||||
}
|
||||
|
||||
double creationPrice = (shopType == ShopType.NORMAL) ? config.shop_creation_price_normal : config.shop_creation_price_admin;
|
||||
double creationPrice = (shopType == ShopType.NORMAL) ? Config.shopCreationPriceNormal : Config.shopCreationPriceAdmin;
|
||||
Shop shop = new Shop(plugin, executor, product, location, buyPrice, sellPrice, shopType);
|
||||
|
||||
ShopCreateEvent event = new ShopCreateEvent(executor, shop, creationPrice);
|
||||
@ -745,8 +744,8 @@ public class ShopInteractListener implements Listener {
|
||||
EconomyResponse r = plugin.getEconomy().withdrawPlayer(executor, location.getWorld().getName(), creationPrice);
|
||||
if (!r.transactionSuccess()) {
|
||||
plugin.debug("Economy transaction failed: " + r.errorMessage);
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, r.errorMessage)));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED,
|
||||
new Replacement(Placeholder.ERROR, r.errorMessage)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -755,13 +754,13 @@ public class ShopInteractListener implements Listener {
|
||||
plugin.debug("Shop created");
|
||||
shopUtils.addShop(shop, true);
|
||||
|
||||
LocalizedMessage.ReplacedPlaceholder placeholder = new LocalizedMessage.ReplacedPlaceholder(
|
||||
Replacement placeholder = new Replacement(
|
||||
Placeholder.CREATION_PRICE, String.valueOf(creationPrice));
|
||||
|
||||
if (shopType == ShopType.ADMIN) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ADMIN_SHOP_CREATED, placeholder));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.ADMIN_SHOP_CREATED, placeholder));
|
||||
} else {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_CREATED, placeholder));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.SHOP_CREATED, placeholder));
|
||||
}
|
||||
|
||||
// next update will display the new shop
|
||||
@ -786,14 +785,14 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
shopUtils.removeShop(shop, true);
|
||||
plugin.debug("Removed shop (#" + shop.getID() + ")");
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_REMOVED));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.SHOP_REMOVED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a shop
|
||||
* @param executor Player, who executed the command and will receive the message
|
||||
* @param shop Shop to be opened
|
||||
* @param message Whether the player should receive the {@link LocalizedMessage.Message#OPENED_SHOP} message
|
||||
* @param message Whether the player should receive the {@link Message#OPENED_SHOP} message
|
||||
*/
|
||||
private void open(Player executor, Shop shop, boolean message) {
|
||||
plugin.debug(executor.getName() + " is opening " + shop.getVendor().getName() + "'s shop (#" + shop.getID() + ")");
|
||||
@ -806,8 +805,8 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
executor.openInventory(shop.getInventoryHolder().getInventory());
|
||||
plugin.debug("Opened shop (#" + shop.getID() + ")");
|
||||
if (message) executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.OPENED_SHOP,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.VENDOR, shop.getVendor().getName())));
|
||||
if (message) executor.sendMessage(LanguageUtils.getMessage(Message.OPENED_SHOP,
|
||||
new Replacement(Placeholder.VENDOR, shop.getVendor().getName())));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -833,39 +832,39 @@ public class ShopInteractListener implements Listener {
|
||||
String vendorName = (shop.getVendor().getName() == null ?
|
||||
shop.getVendor().getUniqueId().toString() : shop.getVendor().getName());
|
||||
|
||||
String vendorString = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_VENDOR,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.VENDOR, vendorName));
|
||||
String vendorString = LanguageUtils.getMessage(Message.SHOP_INFO_VENDOR,
|
||||
new Replacement(Placeholder.VENDOR, vendorName));
|
||||
|
||||
String productString = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_PRODUCT,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(shop.getProduct().getAmount())),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(shop.getProduct())));
|
||||
String productString = LanguageUtils.getMessage(Message.SHOP_INFO_PRODUCT,
|
||||
new Replacement(Placeholder.AMOUNT, String.valueOf(shop.getProduct().getAmount())),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(shop.getProduct())));
|
||||
|
||||
String enchantmentString = "";
|
||||
String potionEffectString = "";
|
||||
String bookGenerationString = "";
|
||||
String musicDiscTitleString = "";
|
||||
|
||||
String disabled = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_DISABLED);
|
||||
String disabled = LanguageUtils.getMessage(Message.SHOP_INFO_DISABLED);
|
||||
|
||||
String priceString = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_PRICE,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.BUY_PRICE, (shop.getBuyPrice() > 0 ? String.valueOf(shop.getBuyPrice()) : disabled)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.SELL_PRICE, (shop.getSellPrice() > 0 ? String.valueOf(shop.getSellPrice()) : disabled)));
|
||||
String priceString = LanguageUtils.getMessage(Message.SHOP_INFO_PRICE,
|
||||
new Replacement(Placeholder.BUY_PRICE, (shop.getBuyPrice() > 0 ? String.valueOf(shop.getBuyPrice()) : disabled)),
|
||||
new Replacement(Placeholder.SELL_PRICE, (shop.getSellPrice() > 0 ? String.valueOf(shop.getSellPrice()) : disabled)));
|
||||
|
||||
String shopType = LanguageUtils.getMessage(shop.getShopType() == ShopType.NORMAL ?
|
||||
LocalizedMessage.Message.SHOP_INFO_NORMAL : LocalizedMessage.Message.SHOP_INFO_ADMIN);
|
||||
Message.SHOP_INFO_NORMAL : Message.SHOP_INFO_ADMIN);
|
||||
|
||||
String stock = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_STOCK,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.STOCK, String.valueOf(amount)));
|
||||
String stock = LanguageUtils.getMessage(Message.SHOP_INFO_STOCK,
|
||||
new Replacement(Placeholder.STOCK, String.valueOf(amount)));
|
||||
|
||||
String potionEffectName = LanguageUtils.getPotionEffectName(shop.getProduct());
|
||||
|
||||
if (potionEffectName.length() > 0) {
|
||||
boolean potionExtended = ItemUtils.isExtendedPotion(shop.getProduct());
|
||||
|
||||
String extended = potionExtended ? LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_EXTENDED) : "";
|
||||
potionEffectString = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_POTION_EFFECT,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.POTION_EFFECT, potionEffectName),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.EXTENDED, extended));
|
||||
String extended = potionExtended ? LanguageUtils.getMessage(Message.SHOP_INFO_EXTENDED) : "";
|
||||
potionEffectString = LanguageUtils.getMessage(Message.SHOP_INFO_POTION_EFFECT,
|
||||
new Replacement(Placeholder.POTION_EFFECT, potionEffectName),
|
||||
new Replacement(Placeholder.EXTENDED, extended));
|
||||
}
|
||||
|
||||
if (type == Material.WRITTEN_BOOK) {
|
||||
@ -883,22 +882,22 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
bookGenerationString = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_BOOK_GENERATION,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.GENERATION, LanguageUtils.getBookGenerationName(generation)));
|
||||
bookGenerationString = LanguageUtils.getMessage(Message.SHOP_INFO_BOOK_GENERATION,
|
||||
new Replacement(Placeholder.GENERATION, LanguageUtils.getBookGenerationName(generation)));
|
||||
}
|
||||
|
||||
String musicDiscName = LanguageUtils.getMusicDiscName(type);
|
||||
if (musicDiscName.length() > 0) {
|
||||
musicDiscTitleString = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_MUSIC_TITLE,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.MUSIC_TITLE, musicDiscName));
|
||||
musicDiscTitleString = LanguageUtils.getMessage(Message.SHOP_INFO_MUSIC_TITLE,
|
||||
new Replacement(Placeholder.MUSIC_TITLE, musicDiscName));
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> enchantmentMap = ItemUtils.getEnchantments(shop.getProduct());
|
||||
String enchantmentList = LanguageUtils.getEnchantmentString(enchantmentMap);
|
||||
|
||||
if (enchantmentList.length() > 0) {
|
||||
enchantmentString = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_ENCHANTMENTS,
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ENCHANTMENT, enchantmentList));
|
||||
enchantmentString = LanguageUtils.getMessage(Message.SHOP_INFO_ENCHANTMENTS,
|
||||
new Replacement(Placeholder.ENCHANTMENT, enchantmentList));
|
||||
}
|
||||
|
||||
executor.sendMessage(" ");
|
||||
@ -931,12 +930,12 @@ public class ShopInteractListener implements Listener {
|
||||
double price = shop.getBuyPrice();
|
||||
if (stack) price = (price / shop.getProduct().getAmount()) * amount;
|
||||
|
||||
if (econ.getBalance(executor, worldName) >= price || config.auto_calculate_item_amount) {
|
||||
if (econ.getBalance(executor, worldName) >= price || Config.autoCalculateItemAmount) {
|
||||
|
||||
int amountForMoney = (int) (amount / price * econ.getBalance(executor, worldName));
|
||||
|
||||
if (amountForMoney == 0 && config.auto_calculate_item_amount) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_MONEY));
|
||||
if (amountForMoney == 0 && Config.autoCalculateItemAmount) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_MONEY));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -948,7 +947,7 @@ public class ShopInteractListener implements Listener {
|
||||
int amountForChestItems = Utils.getAmount(c.getInventory(), shop.getProduct());
|
||||
|
||||
if (amountForChestItems == 0 && shop.getShopType() != ShopType.ADMIN) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.OUT_OF_STOCK));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.OUT_OF_STOCK));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -960,13 +959,13 @@ public class ShopInteractListener implements Listener {
|
||||
int freeSpace = Utils.getFreeSpaceForItem(inventory, product);
|
||||
|
||||
if (freeSpace == 0) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_INVENTORY_SPACE));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_INVENTORY_SPACE));
|
||||
return;
|
||||
}
|
||||
|
||||
int newAmount = amount;
|
||||
|
||||
if (config.auto_calculate_item_amount) {
|
||||
if (Config.autoCalculateItemAmount) {
|
||||
if (shop.getShopType() == ShopType.ADMIN)
|
||||
newAmount = Math.min(amountForMoney, freeSpace);
|
||||
else
|
||||
@ -1016,21 +1015,21 @@ public class ShopInteractListener implements Listener {
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
String vendorName = (shop.getVendor().getName() == null ? shop.getVendor().getUniqueId().toString() : shop.getVendor().getName());
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUY_SUCCESS, new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedPlaceholder(Placeholder.BUY_PRICE, String.valueOf(newPrice)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.VENDOR, vendorName)));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.BUY_SUCCESS, new Replacement(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new Replacement(Placeholder.BUY_PRICE, String.valueOf(newPrice)),
|
||||
new Replacement(Placeholder.VENDOR, vendorName)));
|
||||
|
||||
plugin.debug(executor.getName() + " successfully bought (#" + shop.getID() + ")");
|
||||
|
||||
if (shop.getVendor().isOnline() && config.enable_vendor_messages) {
|
||||
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SOMEONE_BOUGHT, new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedPlaceholder(Placeholder.BUY_PRICE, String.valueOf(newPrice)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.PLAYER, executor.getName())));
|
||||
if (shop.getVendor().isOnline() && Config.enableVendorMessages) {
|
||||
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(Message.SOMEONE_BOUGHT, new Replacement(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new Replacement(Placeholder.BUY_PRICE, String.valueOf(newPrice)),
|
||||
new Replacement(Placeholder.PLAYER, executor.getName())));
|
||||
}
|
||||
|
||||
} else {
|
||||
plugin.debug("Economy transaction failed (r2): " + r2.errorMessage + " (#" + shop.getID() + ")");
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, r2.errorMessage)));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r2.errorMessage)));
|
||||
econ.withdrawPlayer(shop.getVendor(), worldName, newPrice);
|
||||
econ.depositPlayer(executor, worldName, newPrice);
|
||||
}
|
||||
@ -1058,21 +1057,21 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUY_SUCCESS_ADMIN, new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedPlaceholder(Placeholder.BUY_PRICE, String.valueOf(newPrice))));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.BUY_SUCCESS_ADMIN, new Replacement(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new Replacement(Placeholder.BUY_PRICE, String.valueOf(newPrice))));
|
||||
|
||||
plugin.debug(executor.getName() + " successfully bought (#" + shop.getID() + ")");
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Economy transaction failed (r): " + r.errorMessage + " (#" + shop.getID() + ")");
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, r.errorMessage)));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage)));
|
||||
econ.depositPlayer(executor, worldName, newPrice);
|
||||
}
|
||||
} else {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_INVENTORY_SPACE));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_INVENTORY_SPACE));
|
||||
}
|
||||
} else {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_MONEY));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_MONEY));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1092,13 +1091,13 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
String worldName = shop.getLocation().getWorld().getName();
|
||||
|
||||
if (econ.getBalance(shop.getVendor(), worldName) >= price || shop.getShopType() == ShopType.ADMIN || config.auto_calculate_item_amount) {
|
||||
if (econ.getBalance(shop.getVendor(), worldName) >= price || shop.getShopType() == ShopType.ADMIN || Config.autoCalculateItemAmount) {
|
||||
int amountForMoney = (int) (amount / price * econ.getBalance(shop.getVendor(), worldName));
|
||||
|
||||
plugin.debug("Vendor has enough money for " + amountForMoney + " item(s) (#" + shop.getID() + ")");
|
||||
|
||||
if (amountForMoney == 0 && config.auto_calculate_item_amount && shop.getShopType() != ShopType.ADMIN) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.VENDOR_NOT_ENOUGH_MONEY));
|
||||
if (amountForMoney == 0 && Config.autoCalculateItemAmount && shop.getShopType() != ShopType.ADMIN) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.VENDOR_NOT_ENOUGH_MONEY));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1108,7 +1107,7 @@ public class ShopInteractListener implements Listener {
|
||||
int amountForItemCount = Utils.getAmount(executor.getInventory(), shop.getProduct());
|
||||
|
||||
if (amountForItemCount == 0) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_ITEMS));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_ITEMS));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1120,13 +1119,13 @@ public class ShopInteractListener implements Listener {
|
||||
int freeSpace = Utils.getFreeSpaceForItem(inventory, product);
|
||||
|
||||
if (freeSpace == 0 && shop.getShopType() != ShopType.ADMIN) {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE));
|
||||
return;
|
||||
}
|
||||
|
||||
int newAmount = amount;
|
||||
|
||||
if (config.auto_calculate_item_amount) {
|
||||
if (Config.autoCalculateItemAmount) {
|
||||
if (shop.getShopType() == ShopType.ADMIN)
|
||||
newAmount = amountForItemCount;
|
||||
else
|
||||
@ -1176,21 +1175,21 @@ public class ShopInteractListener implements Listener {
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
String vendorName = (shop.getVendor().getName() == null ? shop.getVendor().getUniqueId().toString() : shop.getVendor().getName());
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SELL_SUCCESS, new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedPlaceholder(Placeholder.SELL_PRICE, String.valueOf(newPrice)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.VENDOR, vendorName)));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.SELL_SUCCESS, new Replacement(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new Replacement(Placeholder.SELL_PRICE, String.valueOf(newPrice)),
|
||||
new Replacement(Placeholder.VENDOR, vendorName)));
|
||||
|
||||
plugin.debug(executor.getName() + " successfully sold (#" + shop.getID() + ")");
|
||||
|
||||
if (shop.getVendor().isOnline() && config.enable_vendor_messages) {
|
||||
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SOMEONE_SOLD, new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedPlaceholder(Placeholder.SELL_PRICE, String.valueOf(newPrice)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.PLAYER, executor.getName())));
|
||||
if (shop.getVendor().isOnline() && Config.enableVendorMessages) {
|
||||
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(Message.SOMEONE_SOLD, new Replacement(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new Replacement(Placeholder.SELL_PRICE, String.valueOf(newPrice)),
|
||||
new Replacement(Placeholder.PLAYER, executor.getName())));
|
||||
}
|
||||
|
||||
} else {
|
||||
plugin.debug("Economy transaction failed (r2): " + r2.errorMessage + " (#" + shop.getID() + ")");
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, r2.errorMessage)));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r2.errorMessage)));
|
||||
econ.withdrawPlayer(executor, worldName, newPrice);
|
||||
econ.depositPlayer(shop.getVendor(), worldName, newPrice);
|
||||
}
|
||||
@ -1219,24 +1218,24 @@ public class ShopInteractListener implements Listener {
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SELL_SUCCESS_ADMIN, new LocalizedMessage.ReplacedPlaceholder(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedPlaceholder(Placeholder.SELL_PRICE, String.valueOf(newPrice))));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.SELL_SUCCESS_ADMIN, new Replacement(Placeholder.AMOUNT, String.valueOf(newAmount)),
|
||||
new Replacement(Placeholder.ITEM_NAME, LanguageUtils.getItemName(product)), new Replacement(Placeholder.SELL_PRICE, String.valueOf(newPrice))));
|
||||
|
||||
plugin.debug(executor.getName() + " successfully sold (#" + shop.getID() + ")");
|
||||
}
|
||||
|
||||
} else {
|
||||
plugin.debug("Economy transaction failed (r): " + r.errorMessage + " (#" + shop.getID() + ")");
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, r.errorMessage)));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage)));
|
||||
econ.withdrawPlayer(executor, worldName, newPrice);
|
||||
}
|
||||
|
||||
} else {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE));
|
||||
}
|
||||
|
||||
} else {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.VENDOR_NOT_ENOUGH_MONEY));
|
||||
executor.sendMessage(LanguageUtils.getMessage(Message.VENDOR_NOT_ENOUGH_MONEY));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,16 +14,13 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
|
||||
public class ShopItemListener implements Listener {
|
||||
|
||||
private ShopUtils shopUtils;
|
||||
private ShopChest plugin;
|
||||
|
||||
public ShopItemListener(ShopChest plugin) {
|
||||
this.plugin = plugin;
|
||||
this.shopUtils = plugin.getShopUtils();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.sk89q.worldguard.bukkit.event.entity.DamageEntityEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.entity.UseEntityEvent;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import de.epiceric.shopchest.nms.Hologram;
|
||||
import de.epiceric.shopchest.shop.Shop;
|
||||
import de.epiceric.shopchest.utils.ClickType;
|
||||
@ -78,7 +79,7 @@ public class WorldGuardListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onUseEntity(UseEntityEvent event) {
|
||||
if (plugin.getShopChestConfig().enable_worldguard_integration) {
|
||||
if (Config.enableWorldGuardIntegration) {
|
||||
Player player = event.getCause().getFirstPlayer();
|
||||
if (player == null) return;
|
||||
|
||||
@ -107,7 +108,7 @@ public class WorldGuardListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onDamageEntity(DamageEntityEvent event) {
|
||||
if (plugin.getShopChestConfig().enable_worldguard_integration) {
|
||||
if (Config.enableWorldGuardIntegration) {
|
||||
Player player = event.getCause().getFirstPlayer();
|
||||
if (player == null) return;
|
||||
|
||||
@ -136,7 +137,7 @@ public class WorldGuardListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onUseBlock(UseBlockEvent event) {
|
||||
if (plugin.getShopChestConfig().enable_worldguard_integration) {
|
||||
if (Config.enableWorldGuardIntegration) {
|
||||
Player player = event.getCause().getFirstPlayer();
|
||||
if (player == null) return;
|
||||
|
||||
|
@ -42,23 +42,21 @@ public class Hologram {
|
||||
private final List<ArmorStandWrapper> wrappers = new ArrayList<>();
|
||||
private final Location location;
|
||||
private final ShopChest plugin;
|
||||
private final Config config;
|
||||
|
||||
private boolean exists;
|
||||
private ArmorStandWrapper interactArmorStandWrapper;
|
||||
|
||||
public Hologram(ShopChest plugin, String[] lines, Location location) {
|
||||
this.plugin = plugin;
|
||||
this.config = plugin.getShopChestConfig();
|
||||
this.location = location;
|
||||
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
addLine(i, lines[i]);
|
||||
}
|
||||
|
||||
if (plugin.getShopChestConfig().enable_hologram_interaction) {
|
||||
if (Config.enableHologramInteraction) {
|
||||
double y = 0.6;
|
||||
if (config.hologram_fixed_bottom) y = 0.85;
|
||||
if (Config.hologramFixedBottom) y = 0.85;
|
||||
|
||||
Location loc = getLocation().add(0, y, 0);
|
||||
interactArmorStandWrapper = new ArmorStandWrapper(plugin, loc, null, true);
|
||||
@ -215,7 +213,7 @@ public class Hologram {
|
||||
|
||||
text = ChatColor.translateAlternateColorCodes('&', text);
|
||||
|
||||
if (config.hologram_fixed_bottom) {
|
||||
if (Config.hologramFixedBottom) {
|
||||
for (int i = 0; i < line; i++) {
|
||||
ArmorStandWrapper wrapper = wrappers.get(i);
|
||||
wrapper.setLocation(wrapper.getLocation().add(0, 0.25, 0));
|
||||
@ -229,7 +227,7 @@ public class Hologram {
|
||||
|
||||
Location loc = getLocation();
|
||||
|
||||
if (!config.hologram_fixed_bottom) {
|
||||
if (!Config.hologramFixedBottom) {
|
||||
loc.subtract(0, line * 0.25, 0);
|
||||
}
|
||||
|
||||
@ -274,7 +272,7 @@ public class Hologram {
|
||||
*/
|
||||
public void removeLine(int line) {
|
||||
if (line < wrappers.size()) {
|
||||
if (config.hologram_fixed_bottom) {
|
||||
if (Config.hologramFixedBottom) {
|
||||
for (int i = 0; i < line; i++) {
|
||||
ArmorStandWrapper wrapper = wrappers.get(i);
|
||||
wrapper.setLocation(wrapper.getLocation().subtract(0, 0.25, 0));
|
||||
|
@ -37,7 +37,6 @@ public class Shop {
|
||||
private final double buyPrice;
|
||||
private final double sellPrice;
|
||||
private final ShopType shopType;
|
||||
private final Config config;
|
||||
|
||||
private boolean created;
|
||||
private int id;
|
||||
@ -53,7 +52,6 @@ public class Shop {
|
||||
this.buyPrice = buyPrice;
|
||||
this.sellPrice = sellPrice;
|
||||
this.shopType = shopType;
|
||||
this.config = plugin.getShopChestConfig();
|
||||
}
|
||||
|
||||
public Shop(ShopChest plugin, OfflinePlayer vendor, ItemStack product, Location location, double buyPrice, double sellPrice, ShopType shopType) {
|
||||
@ -96,14 +94,14 @@ public class Shop {
|
||||
Block b = location.getBlock();
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.TRAPPED_CHEST) {
|
||||
ChestNotFoundException ex = new ChestNotFoundException(String.format("No Chest found in world '%s' at location: %d; %d; %d", b.getWorld().getName(), b.getX(), b.getY(), b.getZ()));
|
||||
plugin.getShopUtils().removeShop(this, config.remove_shop_on_error);
|
||||
plugin.getShopUtils().removeShop(this, Config.removeShopOnError);
|
||||
if (showConsoleMessages) plugin.getLogger().severe(ex.getMessage());
|
||||
plugin.debug("Failed to create shop (#" + id + ")");
|
||||
plugin.debug(ex);
|
||||
return false;
|
||||
} else if ((b.getRelative(BlockFace.UP).getType() != Material.AIR) && config.show_shop_items) {
|
||||
} else if ((b.getRelative(BlockFace.UP).getType() != Material.AIR) && Config.showShopItems) {
|
||||
NotEnoughSpaceException ex = new NotEnoughSpaceException(String.format("No space above chest in world '%s' at location: %d; %d; %d", b.getWorld().getName(), b.getX(), b.getY(), b.getZ()));
|
||||
plugin.getShopUtils().removeShop(this, config.remove_shop_on_error);
|
||||
plugin.getShopUtils().removeShop(this, Config.removeShopOnError);
|
||||
if (showConsoleMessages) plugin.getLogger().severe(ex.getMessage());
|
||||
plugin.debug("Failed to create shop (#" + id + ")");
|
||||
plugin.debug(ex);
|
||||
@ -142,7 +140,7 @@ public class Shop {
|
||||
* <b>Call this after {@link #createHologram()}, because it depends on the hologram's location</b>
|
||||
*/
|
||||
private void createItem() {
|
||||
if (config.show_shop_items) {
|
||||
if (Config.showShopItems) {
|
||||
plugin.debug("Creating item (#" + id + ")");
|
||||
|
||||
Location itemLocation;
|
||||
@ -283,7 +281,7 @@ public class Shop {
|
||||
|
||||
double subtractY = 0.6;
|
||||
|
||||
if (config.hologram_fixed_bottom) subtractY = 0.85;
|
||||
if (Config.hologramFixedBottom) subtractY = 0.85;
|
||||
|
||||
if (doubleChest) {
|
||||
Chest r = chests[0];
|
||||
@ -310,7 +308,7 @@ public class Shop {
|
||||
holoLocation = new Location(w, x + 0.5, y - subtractY, z + 0.5);
|
||||
}
|
||||
|
||||
holoLocation.add(0, config.hologram_lift, 0);
|
||||
holoLocation.add(0, Config.hologramLift, 0);
|
||||
|
||||
return holoLocation;
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ public class ShopItem {
|
||||
Class<?> craftWorldClass = Utils.getCraftClass("CraftWorld");
|
||||
Class<?> nmsWorldClass = Utils.getNMSClass("World");
|
||||
|
||||
Class[] requiredClasses = new Class[] {
|
||||
Class<?>[] requiredClasses = new Class[] {
|
||||
nmsWorldClass, craftWorldClass, nmsItemStackClass, craftItemStackClass, entityItemClass,
|
||||
packetPlayOutSpawnEntityClass, packetPlayOutEntityMetadataClass, dataWatcherClass,
|
||||
packetPlayOutEntityDestroyClass, entityClass, packetPlayOutEntityVelocityClass,
|
||||
};
|
||||
|
||||
for (Class c : requiredClasses) {
|
||||
for (Class<?> c : requiredClasses) {
|
||||
if (c == null) {
|
||||
plugin.debug("Failed to create shop item: Could not find all required classes");
|
||||
entityItem = null;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.epiceric.shopchest.sql;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import de.epiceric.shopchest.event.ShopBuySellEvent;
|
||||
import de.epiceric.shopchest.exceptions.WorldNotFoundException;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
@ -385,7 +386,7 @@ public abstract class Database {
|
||||
* @param callback Callback that - if succeeded - returns {@code null}
|
||||
*/
|
||||
public void logEconomy(final Player executor, final ItemStack product, final OfflinePlayer vendor, final ShopType shopType, final Location location, final double price, final ShopBuySellEvent.Type type, final Callback<Void> callback) {
|
||||
if (plugin.getShopChestConfig().enable_ecomomy_log) {
|
||||
if (Config.enableEcomomyLog) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.epiceric.shopchest.sql;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.sql.Connection;
|
||||
@ -23,10 +24,10 @@ public class MySQL extends Database {
|
||||
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
|
||||
String connectUrl = "jdbc:mysql://" + plugin.getShopChestConfig().database_mysql_host + ":" + plugin.getShopChestConfig().database_mysql_port + "/" + plugin.getShopChestConfig().database_mysql_database + "?autoReconnect=true&useSSL=false";
|
||||
plugin.debug("Connecting to MySQL Server \"" + connectUrl + "\" as user \"" + plugin.getShopChestConfig().database_mysql_username + "\"");
|
||||
String connectUrl = "jdbc:mysql://" + Config.databaseMySqlHost + ":" + Config.databaseMySqlPort + "/" + Config.databaseMySqlDatabase + "?autoReconnect=true&useSSL=false";
|
||||
plugin.debug("Connecting to MySQL Server \"" + connectUrl + "\" as user \"" + Config.databaseMySqlUsername + "\"");
|
||||
|
||||
connection = DriverManager.getConnection(connectUrl, plugin.getShopChestConfig().database_mysql_username, plugin.getShopChestConfig().database_mysql_password);
|
||||
connection = DriverManager.getConnection(connectUrl, Config.databaseMySqlUsername, Config.databaseMySqlPassword);
|
||||
|
||||
return connection;
|
||||
} catch (Exception ex) {
|
||||
|
@ -7,7 +7,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.epiceric.shopchest.utils;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@ -44,7 +45,7 @@ public class ShopUpdater {
|
||||
*/
|
||||
public void start() {
|
||||
if (!isRunning()) {
|
||||
long interval = plugin.getShopChestConfig().update_quality.getInterval();
|
||||
long interval = Config.updateQuality.getInterval();
|
||||
running = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new ShopUpdaterTask(), interval, interval);
|
||||
}
|
||||
}
|
||||
|
@ -192,20 +192,20 @@ public class ShopUtils {
|
||||
}
|
||||
|
||||
if (limit < -1) limit = -1;
|
||||
return (useDefault ? plugin.getShopChestConfig().default_limit : limit);
|
||||
return (useDefault ?Config.defaultLimit : limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of shops of a player
|
||||
* @param p Player, whose shops should be counted
|
||||
* @return The amount of a shops a player has (if {@link Config#exclude_admin_shops} is true, admin shops won't be counted)
|
||||
* @return The amount of a shops a player has (if {@link Config#excludeAdminShops} is true, admin shops won't be counted)
|
||||
*/
|
||||
public int getShopAmount(OfflinePlayer p) {
|
||||
float shopCount = 0;
|
||||
|
||||
for (Shop shop : getShops()) {
|
||||
if (shop.getVendor().equals(p)) {
|
||||
if (shop.getShopType() != Shop.ShopType.ADMIN || !plugin.getShopChestConfig().exclude_admin_shops) {
|
||||
if (shop.getShopType() != Shop.ShopType.ADMIN || !Config.excludeAdminShops) {
|
||||
shopCount++;
|
||||
|
||||
InventoryHolder ih = shop.getInventoryHolder();
|
||||
@ -288,7 +288,7 @@ public class ShopUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getShopChestConfig().only_show_shops_in_sight) {
|
||||
if (Config.onlyShowShopsInSight) {
|
||||
updateVisibleShops(player);
|
||||
} else {
|
||||
updateNearestShops(player);
|
||||
@ -308,12 +308,12 @@ public class ShopUtils {
|
||||
private static final double TARGET_THRESHOLD = 1;
|
||||
|
||||
private void updateVisibleShops(Player player) {
|
||||
double itemDistSquared = Math.pow(plugin.getShopChestConfig().maximal_item_distance, 2);
|
||||
double hologramDistSquared = Math.pow(plugin.getShopChestConfig().maximal_distance, 2);
|
||||
double itemDistSquared = Math.pow(Config.maximalItemDistance, 2);
|
||||
double hologramDistSquared = Math.pow(Config.maximalDistance, 2);
|
||||
|
||||
boolean firstShopInSight = plugin.getShopChestConfig().only_show_first_shop_in_sight;
|
||||
boolean firstShopInSight =Config.onlyShowFirstShopInSight;
|
||||
|
||||
// used if only_show_first_shop_in_sight
|
||||
// used if onlyShowFirstShopInSight
|
||||
List<Shop> otherShopsInSight = firstShopInSight ? new ArrayList<Shop>() : null;
|
||||
double nearestDistance = 0;
|
||||
Shop nearestShop = null;
|
||||
@ -403,8 +403,8 @@ public class ShopUtils {
|
||||
}
|
||||
|
||||
private void updateNearestShops(Player p) {
|
||||
double holoDistSqr = Math.pow(plugin.getShopChestConfig().maximal_distance, 2);
|
||||
double itemDistSqr = Math.pow(plugin.getShopChestConfig().maximal_item_distance, 2);
|
||||
double holoDistSqr = Math.pow(Config.maximalDistance, 2);
|
||||
double itemDistSqr = Math.pow(Config.maximalItemDistance, 2);
|
||||
|
||||
for (Shop shop : getShops()) {
|
||||
if (p.getLocation().getWorld().getName().equals(shop.getLocation().getWorld().getName())) {
|
||||
|
Loading…
Reference in New Issue
Block a user