mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-22 01:58:54 +00:00
add config usemagiclib...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
037f5138bb
commit
f807c054d4
@ -5,11 +5,14 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.maxgamer.QuickShop.QuickShop;
|
||||
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
|
||||
public class ConfigManager {
|
||||
private boolean enableMagicLib;
|
||||
/** Whether debug info should be shown in the console */
|
||||
protected boolean debug = false;
|
||||
/** Whether we should use display items or not */
|
||||
@ -17,9 +20,9 @@ public class ConfigManager {
|
||||
protected double feeForPriceChange = 0.0;
|
||||
protected int findDistance = 30;
|
||||
protected String guiTitle = "§6[§b快捷商店§6]";
|
||||
|
||||
/** Whether or not to limit players shop amounts */
|
||||
protected boolean limit = false;
|
||||
|
||||
protected int limitdefault = 0;
|
||||
protected final HashMap<String, Integer> limits = new HashMap<String, Integer>();
|
||||
protected boolean logAction = true;
|
||||
@ -77,6 +80,22 @@ public class ConfigManager {
|
||||
this.feeForPriceChange = config.getDouble("shop.fee-for-price-change");
|
||||
this.preventhopper = config.getBoolean("preventhopper");
|
||||
this.guiTitle = config.getMessage("guititle");
|
||||
try {
|
||||
plugin.getLogger().info("尝试启动魔改库...");
|
||||
final FancyMessage fm = new FancyMessage("test");
|
||||
fm.then("item").itemTooltip(new ItemStack(Material.DIAMOND_SWORD));
|
||||
fm.then("link").link("ci.citycraft.cn");
|
||||
fm.then("suggest").suggest("qs help");
|
||||
fm.toJSONString();
|
||||
plugin.getLogger().info("魔改库功能测试正常...");
|
||||
this.enableMagicLib = true;
|
||||
} catch (final NoClassDefFoundError | NoSuchMethodError | Exception e) {
|
||||
plugin.getLogger().warning("+=========================================");
|
||||
plugin.getLogger().warning("| 警告: 启动魔改库失败 将使用GUI界面...");
|
||||
plugin.getLogger().warning("+=========================================");
|
||||
this.enableMagicLib = false;
|
||||
}
|
||||
this.enableMagicLib = enableMagicLib && config.getBoolean("usemagiclib", true);
|
||||
}
|
||||
|
||||
public double getFeeForPriceChange() {
|
||||
@ -123,6 +142,10 @@ public class ConfigManager {
|
||||
return display;
|
||||
}
|
||||
|
||||
public boolean isEnableMagicLib() {
|
||||
return enableMagicLib;
|
||||
}
|
||||
|
||||
public boolean isLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import java.util.Map.Entry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -54,7 +53,6 @@ import org.mcstats.Metrics;
|
||||
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
import cn.citycraft.PluginHelper.utils.VersionChecker;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
|
||||
public class QuickShop extends JavaPlugin {
|
||||
/** The active instance of QuickShop */
|
||||
@ -74,7 +72,6 @@ public class QuickShop extends JavaPlugin {
|
||||
private Database database;
|
||||
/** The economy we hook into for transactions */
|
||||
private Economy economy;
|
||||
private boolean enableMagicLib;
|
||||
private BukkitTask itemWatcherTask;
|
||||
|
||||
private LogWatcher logWatcher;
|
||||
@ -144,10 +141,6 @@ public class QuickShop extends JavaPlugin {
|
||||
return this.shopManager;
|
||||
}
|
||||
|
||||
public boolean isEnableMagicLib() {
|
||||
return enableMagicLib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to load the economy and its core. If this fails, it will try to use
|
||||
* vault. If that fails, it will return false.
|
||||
@ -226,23 +219,6 @@ public class QuickShop extends JavaPlugin {
|
||||
final LockListener ll = new LockListener(this);
|
||||
getServer().getPluginManager().registerEvents(ll, this);
|
||||
}
|
||||
|
||||
try {
|
||||
getLogger().info("尝试启动魔改库...");
|
||||
final FancyMessage fm = new FancyMessage("test");
|
||||
fm.then("item").itemTooltip(new ItemStack(Material.DIAMOND_SWORD));
|
||||
fm.then("link").link("ci.citycraft.cn");
|
||||
fm.then("suggest").suggest("qs help");
|
||||
fm.toJSONString();
|
||||
getLogger().info("魔改库功能测试正常...");
|
||||
this.enableMagicLib = true;
|
||||
} catch (final NoClassDefFoundError | NoSuchMethodError | Exception e) {
|
||||
getLogger().warning("+=========================================");
|
||||
getLogger().warning("| 警告: 启动魔改库失败 部分功能将被禁用...");
|
||||
getLogger().warning("+=========================================");
|
||||
this.enableMagicLib = false;
|
||||
}
|
||||
|
||||
try {
|
||||
final ConfigurationSection dbCfg = getConfig().getConfigurationSection("database");
|
||||
DatabaseCore dbCore;
|
||||
|
@ -193,7 +193,7 @@ public class MsgUtil {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.this-shop-is-selling"));
|
||||
}
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||
if (!plugin.isEnableMagicLib()) {
|
||||
if (!plugin.getConfigManager().isEnableMagicLib()) {
|
||||
final Inventory in = Bukkit.createInventory(null, 9, plugin.getConfigManager().getGuiTitle());
|
||||
in.setItem(4, items);
|
||||
p.openInventory(in);
|
||||
|
@ -6,6 +6,8 @@ superitem: GOLD_AXE
|
||||
preventhopper: false
|
||||
#商店GUI的标题
|
||||
guititle: '&6[&b快捷商店&6]&r'
|
||||
#启用魔改库支持
|
||||
usemagiclib: true
|
||||
|
||||
#Tax amount (decimal) - Eg, P1 buys $50 worth of stuff from P2. Therefore, P1 loses $50, P2 gains $(1-0.05)*50, and tax-account gains $(0.05)*50.
|
||||
tax: 0.00
|
||||
|
@ -2,16 +2,21 @@ name: ${project.artifactId}
|
||||
description: ${project.description}
|
||||
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||
version: ${project.version}
|
||||
authors: [Netherfoam,Timtower, KaiNoMood,喵♂呜]
|
||||
softdepend: [Vault]
|
||||
authors:
|
||||
- Netherfoam
|
||||
- Timtower
|
||||
- KaiNoMood
|
||||
- 喵♂呜
|
||||
softdepend:
|
||||
- Vault
|
||||
website: http://ci.sumcraft.net:8080/job/${project.artifactId}/
|
||||
|
||||
commands:
|
||||
qs:
|
||||
description: QuickShop command
|
||||
usage: '§c未知的子命令 请输入 §b/qs help §c查看帮助!'
|
||||
aliases: [quickshop,shop]
|
||||
|
||||
usage: §c未知的子命令 请输入 §b/qs help §c查看帮助!
|
||||
aliases:
|
||||
- quickshop
|
||||
- shop
|
||||
permissions:
|
||||
quickshop.create.sell:
|
||||
description: Allows a player to sell from a shop
|
||||
|
Loading…
Reference in New Issue
Block a user