mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2025-10-02 12:37:27 +00:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
56e0fd8430 | |||
fa9eead0a9 | |||
6ed44b3def | |||
5b6abc1c07 | |||
7d908ff59a | |||
c83ace24c9 | |||
b409fcc32f | |||
714ce2fa32 | |||
7f1c37ec4e | |||
3f781c473c | |||
5bab17a117 | |||
b9a9fe292c | |||
efb4e18617 | |||
f807c054d4 | |||
037f5138bb |
29
pom.xml
29
pom.xml
@ -3,7 +3,8 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.maxgamer</groupId>
|
||||
<artifactId>QuickShop</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>1.5</version>
|
||||
<description>快捷商店重置版本...</description>
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
<resources>
|
||||
@ -31,14 +32,9 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>cn.citycraft:PluginHelper</include>
|
||||
<include>org.mcstats.*:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.mcstats</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.mcstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>cn.citycraft.PluginHelper</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||
@ -56,6 +52,11 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||
<update.description>更新7老板的底层Gson库...</update.description>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
@ -63,11 +64,7 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sumcraft-repo</id>
|
||||
<url>http://ci.sumcraft.net:8080/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/public</url>
|
||||
<url>${jenkins.url}/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
@ -98,13 +95,9 @@
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mcstats.bukkit</groupId>
|
||||
<artifactId>metrics</artifactId>
|
||||
<version>R8-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
||||
<artifactId>WowSuchCleaner</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
@ -19,8 +19,8 @@ public class CommandBuy extends BaseCommand {
|
||||
public CommandBuy(final QuickShop plugin) {
|
||||
super("buy");
|
||||
this.plugin = plugin;
|
||||
setPermission("quickshop.create.buy");
|
||||
setOnlyPlayerExecutable();
|
||||
setPermission("quickshop.create.buy");
|
||||
setDescription(MsgUtil.p("command.description.buy"));
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class CommandEmpty extends BaseCommand {
|
||||
public CommandEmpty(final QuickShop plugin) {
|
||||
super("empty");
|
||||
this.plugin = plugin;
|
||||
setPermission("quickshop.refill");
|
||||
setPermission("quickshop.empty");
|
||||
setDescription(MsgUtil.p("command.description.empty"));
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class CommandInfo extends BaseCommand {
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||
int buying, selling, doubles, chunks, worlds;
|
||||
buying = selling = doubles = chunks = worlds = 0;
|
||||
int buying, selling, doubles, chunks, worlds, unlimited;
|
||||
buying = selling = doubles = chunks = worlds = unlimited = 0;
|
||||
int nostock = 0;
|
||||
sender.sendMessage(ChatColor.RED + "开始检索商店信息中...");
|
||||
for (final HashMap<ShopChunk, HashMap<Location, Shop>> inWorld : plugin.getShopManager().getShops().values()) {
|
||||
@ -36,6 +36,9 @@ public class CommandInfo extends BaseCommand {
|
||||
for (final HashMap<Location, Shop> inChunk : inWorld.values()) {
|
||||
chunks++;
|
||||
for (final Shop shop : inChunk.values()) {
|
||||
if (shop.isUnlimited()) {
|
||||
unlimited++;
|
||||
}
|
||||
if (shop.isBuying()) {
|
||||
buying++;
|
||||
} else if (shop.isSelling()) {
|
||||
@ -52,6 +55,7 @@ public class CommandInfo extends BaseCommand {
|
||||
sender.sendMessage(MsgUtil.p("info.title", chunks, buying + selling, worlds));
|
||||
sender.sendMessage(MsgUtil.p("info.selling", selling));
|
||||
sender.sendMessage(MsgUtil.p("info.buying", buying));
|
||||
sender.sendMessage(MsgUtil.p("info.unlimited", unlimited));
|
||||
sender.sendMessage(MsgUtil.p("info.double", doubles));
|
||||
sender.sendMessage(MsgUtil.p("info.canclean", nostock));
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class CommandUnlimited extends BaseCommand {
|
||||
super("unlimited");
|
||||
this.plugin = plugin;
|
||||
setOnlyPlayerExecutable();
|
||||
setPermission("quickshop.unlimited");
|
||||
setDescription(MsgUtil.p("command.description.unlimited"));
|
||||
}
|
||||
|
||||
|
@ -5,21 +5,24 @@ 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 cn.citycraft.PluginHelper.tellraw.FancyMessage;
|
||||
|
||||
public class ConfigManager {
|
||||
private boolean enableMagicLib = false;
|
||||
/** Whether debug info should be shown in the console */
|
||||
protected boolean debug = false;
|
||||
/** Whether we should use display items or not */
|
||||
protected boolean display = true;
|
||||
protected double feeForPriceChange = 0.0;
|
||||
protected int findDistance = 30;
|
||||
protected String guiTitle;
|
||||
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,23 @@ public class ConfigManager {
|
||||
this.feeForPriceChange = config.getDouble("shop.fee-for-price-change");
|
||||
this.preventhopper = config.getBoolean("preventhopper");
|
||||
this.guiTitle = config.getMessage("guititle");
|
||||
if (config.getBoolean("usemagiclib", true)) {
|
||||
try {
|
||||
plugin.getLogger().info("启用魔改库 尝试启动中...");
|
||||
final FancyMessage fm = FancyMessage.newFM("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 Error | Exception e) {
|
||||
plugin.getLogger().warning("+=========================================");
|
||||
plugin.getLogger().warning("| 警告: 启动魔改库失败 将使用GUI商店界面...");
|
||||
plugin.getLogger().warning("+=========================================");
|
||||
this.enableMagicLib = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double getFeeForPriceChange() {
|
||||
@ -123,6 +143,10 @@ public class ConfigManager {
|
||||
return display;
|
||||
}
|
||||
|
||||
public boolean isEnableMagicLib() {
|
||||
return enableMagicLib;
|
||||
}
|
||||
|
||||
public boolean isLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
import org.maxgamer.QuickShop.QuickShop;
|
||||
@ -62,6 +63,11 @@ public class PlayerListener implements Listener {
|
||||
shop.onClick();
|
||||
// Text menu
|
||||
MsgUtil.sendShopInfo(p, shop);
|
||||
if (!plugin.getConfigManager().isEnableMagicLib() && !shop.getOwner().equalsIgnoreCase(p.getName()) && b.getType() == Material.WALL_SIGN) {
|
||||
final Inventory in = Bukkit.createInventory(null, 9, plugin.getConfigManager().getGuiTitle());
|
||||
in.setItem(4, shop.getItem());
|
||||
p.openInventory(in);
|
||||
}
|
||||
if (shop.isSelling()) {
|
||||
p.sendMessage(MsgUtil.p("how-many-buy"));
|
||||
} else {
|
||||
|
@ -2,11 +2,12 @@ package org.maxgamer.QuickShop.Listeners;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
@ -14,8 +15,10 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.maxgamer.QuickShop.QuickShop;
|
||||
import org.maxgamer.QuickShop.Shop.Shop;
|
||||
import org.maxgamer.QuickShop.Util.MarkUtil;
|
||||
|
||||
public class ProtectListener implements Listener {
|
||||
@ -26,18 +29,41 @@ public class ProtectListener implements Listener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public Shop getShop(final Inventory inv) {
|
||||
if (inv == null) {
|
||||
return null;
|
||||
}
|
||||
InventoryHolder holder = inv.getHolder();
|
||||
if (holder instanceof DoubleChest) {
|
||||
holder = ((DoubleChest) holder).getLeftSide();
|
||||
}
|
||||
|
||||
if (holder instanceof BlockState) {
|
||||
final Block block = ((BlockState) holder).getBlock();
|
||||
final Shop sp = plugin.getShopManager().getShop(block.getLocation());
|
||||
if (sp != null) {
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInvMove(final InventoryMoveItemEvent e) {
|
||||
final ItemStack ci = e.getItem();
|
||||
if (MarkUtil.hasMark(ci)) {
|
||||
e.setCancelled(true);
|
||||
final ItemStack[] items = e.getSource().getContents();
|
||||
for (final ItemStack itemStack : items) {
|
||||
if (MarkUtil.hasMark(itemStack)) {
|
||||
itemStack.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
e.getSource().setContents(items);
|
||||
}
|
||||
|
||||
final Inventory src = e.getSource();
|
||||
final Inventory me = e.getInitiator();
|
||||
final Inventory des = e.getDestination();
|
||||
final Shop srcshop = getShop(src);
|
||||
final Shop meshop = getShop(me);
|
||||
final Shop desshop = getShop(des);
|
||||
|
||||
if ((srcshop != null && meshop == null) || (meshop != null && desshop == null) || (srcshop != null && desshop != null && srcshop.getOwner().equalsIgnoreCase(desshop.getOwner()))) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,14 +101,6 @@ public class ProtectListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemDespawn(final ItemDespawnEvent e) {
|
||||
final ItemStack ci = e.getEntity().getItemStack();
|
||||
if (MarkUtil.hasMark(ci)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerHandlerItem(final PlayerItemHeldEvent e) {
|
||||
final Player p = e.getPlayer();
|
||||
|
@ -0,0 +1,32 @@
|
||||
package org.maxgamer.QuickShop.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.maxgamer.QuickShop.Util.MarkUtil;
|
||||
|
||||
import io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent;
|
||||
|
||||
public class WowSuchCleanerListener implements Listener {
|
||||
@EventHandler
|
||||
public void onWSCClear(final ItemPreCleanEvent e) {
|
||||
final List<Item> clearList = new ArrayList<Item>();
|
||||
final List<ItemStack> aucList = new ArrayList<ItemStack>();
|
||||
for (final Item item : e.getItemsToClean()) {
|
||||
if (MarkUtil.hasMark(item.getItemStack())) {
|
||||
clearList.add(item);
|
||||
}
|
||||
}
|
||||
for (final ItemStack itemStack : e.getItemsToAuction()) {
|
||||
if (MarkUtil.hasMark(itemStack)) {
|
||||
aucList.add(itemStack);
|
||||
}
|
||||
}
|
||||
e.getItemsToClean().removeAll(clearList);
|
||||
e.getItemsToAuction().removeAll(aucList);
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package org.maxgamer.QuickShop;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -14,13 +13,13 @@ 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;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@ -42,6 +41,7 @@ import org.maxgamer.QuickShop.Listeners.LockListener;
|
||||
import org.maxgamer.QuickShop.Listeners.PlayerListener;
|
||||
import org.maxgamer.QuickShop.Listeners.ProtectListener;
|
||||
import org.maxgamer.QuickShop.Listeners.WorldListener;
|
||||
import org.maxgamer.QuickShop.Listeners.WowSuchCleanerListener;
|
||||
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||
import org.maxgamer.QuickShop.Shop.Shop;
|
||||
import org.maxgamer.QuickShop.Shop.ShopManager;
|
||||
@ -50,11 +50,9 @@ import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||
import org.maxgamer.QuickShop.Util.Util;
|
||||
import org.maxgamer.QuickShop.Watcher.ItemWatcher;
|
||||
import org.maxgamer.QuickShop.Watcher.LogWatcher;
|
||||
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 */
|
||||
@ -63,26 +61,16 @@ public class QuickShop extends JavaPlugin {
|
||||
public FileConfig config;
|
||||
// private HeroChatListener heroChatListener;
|
||||
// Listeners (These don't)
|
||||
private final BlockListener blockListener = new BlockListener(this);
|
||||
// Listeners - We decide which one to use at runtime
|
||||
private ChatListener chatListener;
|
||||
private final ChunkListener chunkListener = new ChunkListener(this);
|
||||
/** The Config Manager used to read config */
|
||||
private ConfigManager configManager;
|
||||
|
||||
/** The database for storing all our data for persistence */
|
||||
private Database database;
|
||||
/** The economy we hook into for transactions */
|
||||
private Economy economy;
|
||||
private boolean enableMagicLib;
|
||||
private BukkitTask itemWatcherTask;
|
||||
|
||||
private LogWatcher logWatcher;
|
||||
private final PlayerListener playerListener = new PlayerListener(this);
|
||||
private final ProtectListener protectListener = new ProtectListener(this);
|
||||
/** The Shop Manager used to store shops */
|
||||
private ShopManager shopManager;
|
||||
private final WorldListener worldListener = new WorldListener(this);
|
||||
|
||||
/**
|
||||
* Prints debug information if QuickShop is configured to do so.
|
||||
@ -144,10 +132,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.
|
||||
@ -196,9 +180,13 @@ public class QuickShop extends JavaPlugin {
|
||||
logWatcher.close(); // Closes the file
|
||||
}
|
||||
/* Remove all display items, and any dupes we can find */
|
||||
shopManager.clear();
|
||||
if (shopManager != null) {
|
||||
shopManager.clear();
|
||||
}
|
||||
/* Empty the buffer */
|
||||
database.close();
|
||||
if (database != null) {
|
||||
database.close();
|
||||
}
|
||||
try {
|
||||
this.database.getConnection().close();
|
||||
} catch (final SQLException e) {
|
||||
@ -226,23 +214,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;
|
||||
@ -336,19 +307,29 @@ public class QuickShop extends JavaPlugin {
|
||||
MsgUtil.clean();
|
||||
// Register events
|
||||
final PluginManager pm = this.getServer().getPluginManager();
|
||||
pm.registerEvents(blockListener, this);
|
||||
pm.registerEvents(playerListener, this);
|
||||
pm.registerEvents(worldListener, this);
|
||||
pm.registerEvents(protectListener, this);
|
||||
final Plugin wsc = pm.getPlugin("WowSuchCleaner");
|
||||
if (wsc != null && wsc.isEnabled()) {
|
||||
getLogger().info("发现 WowSuchCleaner 插件 开启相关功能...");
|
||||
try {
|
||||
Class.forName("io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent");
|
||||
pm.registerEvents(new WowSuchCleanerListener(), this);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
getLogger().info("WowSuchCleaner 版本过低 可能造成悬浮物上架...");
|
||||
}
|
||||
}
|
||||
pm.registerEvents(new BlockListener(this), this);
|
||||
pm.registerEvents(new PlayerListener(this), this);
|
||||
pm.registerEvents(new WorldListener(this), this);
|
||||
pm.registerEvents(new ProtectListener(this), this);
|
||||
pm.registerEvents(new ChatListener(this), this);
|
||||
if (configManager.isDisplay()) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(chunkListener, this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new ChunkListener(this), this);
|
||||
// Display item handler thread
|
||||
getLogger().info("开启商店检查以及悬浮物刷新线程...");
|
||||
final ItemWatcher itemWatcher = new ItemWatcher(this);
|
||||
itemWatcherTask = Bukkit.getScheduler().runTaskTimer(this, itemWatcher, 20, 1800);
|
||||
}
|
||||
this.chatListener = new ChatListener(this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(chatListener, this);
|
||||
|
||||
// Command handlers
|
||||
final QuickShopCommands commandExecutor = new QuickShopCommands(this);
|
||||
getCommand("qs").setExecutor(commandExecutor);
|
||||
@ -357,11 +338,6 @@ public class QuickShop extends JavaPlugin {
|
||||
}
|
||||
this.getLogger().info("载入完成! 版本: " + this.getDescription().getVersion() + " 重制 by 喵♂呜");
|
||||
new VersionChecker(this);
|
||||
try {
|
||||
final Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
} catch (final IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -601,10 +601,12 @@ public class ContainerShop implements Shop {
|
||||
final String[] lines = new String[4];
|
||||
lines[0] = ChatColor.RED + "[QuickShop]";
|
||||
if (this.isBuying()) {
|
||||
lines[1] = MsgUtil.p("signs.buying", "" + this.getRemainingSpace());
|
||||
final int remsp = this.getRemainingSpace();
|
||||
lines[1] = MsgUtil.p("signs.buying", "" + (remsp == 10000 ? "无限" : remsp));
|
||||
}
|
||||
if (this.isSelling()) {
|
||||
lines[1] = MsgUtil.p("signs.selling", "" + this.getRemainingStock());
|
||||
final int remst = this.getRemainingStock();
|
||||
lines[1] = MsgUtil.p("signs.selling", "" + (remst == 10000 ? "无限" : remst));
|
||||
}
|
||||
lines[2] = Util.getNameForSign(this.item);
|
||||
lines[3] = MsgUtil.p("signs.price", "" + this.getPrice());
|
||||
|
@ -9,13 +9,12 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.maxgamer.QuickShop.QuickShop;
|
||||
import org.maxgamer.QuickShop.Shop.Shop;
|
||||
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import cn.citycraft.PluginHelper.tellraw.FancyMessage;
|
||||
|
||||
public class MsgUtil {
|
||||
private static FileConfig messages;
|
||||
@ -90,7 +89,7 @@ public class MsgUtil {
|
||||
public static String p(final String loc, final Object... args) {
|
||||
String raw = messages.getString(loc);
|
||||
if (raw == null || raw.isEmpty()) {
|
||||
return "语言文件词条丢失: " + loc;
|
||||
return ChatColor.RED + "语言文件词条丢失: " + loc;
|
||||
}
|
||||
if (args == null) {
|
||||
return raw;
|
||||
@ -128,7 +127,7 @@ public class MsgUtil {
|
||||
|
||||
public static void sendItemMessage(final Player p, final ItemStack is, final String msg) {
|
||||
try {
|
||||
final FancyMessage fm = new FancyMessage();
|
||||
final FancyMessage fm = FancyMessage.newFM();
|
||||
fm.text(msg).itemTooltip(is).send(p);
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchMethodError e) {
|
||||
p.sendMessage(msg);
|
||||
@ -181,10 +180,10 @@ public class MsgUtil {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.damage-percent-remaining", Util.getToolPercentage(items)));
|
||||
}
|
||||
if (shop.isSelling()) {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.stock", "" + stock));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.stock", "" + (stock == 10000 ? "无限" : stock)));
|
||||
} else {
|
||||
final int space = shop.getRemainingSpace();
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.space", "" + space));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.space", "" + (space == 10000 ? "无限" : space)));
|
||||
}
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.price-per", shop.getDataName(), Util.format(shop.getPrice())));
|
||||
if (shop.isBuying()) {
|
||||
@ -193,10 +192,5 @@ public class MsgUtil {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.this-shop-is-selling"));
|
||||
}
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||
if (!plugin.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
|
||||
|
@ -1,4 +1,4 @@
|
||||
Version: 1.2
|
||||
Version: 1.4
|
||||
|
||||
not-looking-at-shop: '&c没找到快捷商店. 你必须看着那个商店.'
|
||||
no-permission: '&4你没有此命令的权限.'
|
||||
@ -58,6 +58,7 @@ info:
|
||||
title: '&a当前加载的 &e{0} &a个区块中 共有 &e{1} &a个商店 覆盖 &e{2} &a个世界.'
|
||||
selling: '&b出售商店&a有 &e{0} &a个.'
|
||||
buying: '&d收购商店&a有 &e{0} &a个.'
|
||||
unlimited: '&c无限商店&a有 &e{0} &a个.'
|
||||
double: '&3大箱子商店 &e{0} &a个.'
|
||||
canclean: '&a可以用 &b/qs clean &a清理的商店有 &e{0} &a个.'
|
||||
|
||||
|
@ -2,53 +2,59 @@ name: ${project.artifactId}
|
||||
description: ${project.description}
|
||||
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||
version: ${project.version}
|
||||
authors: [Netherfoam,Timtower, KaiNoMood,喵♂呜]
|
||||
softdepend: [Vault]
|
||||
website: http://ci.sumcraft.net:8080/job/${project.artifactId}/
|
||||
|
||||
authors:
|
||||
- Netherfoam
|
||||
- Timtower
|
||||
- KaiNoMood
|
||||
- 喵♂呜
|
||||
softdepend:
|
||||
- Vault
|
||||
- WowSuchCleaner
|
||||
website: ${jenkins.url}/job/${project.artifactId}/
|
||||
commands:
|
||||
qs:
|
||||
description: QuickShop command
|
||||
usage: '§c未知的子命令 请输入 §b/qs help §c查看帮助!'
|
||||
aliases: [quickshop,shop]
|
||||
|
||||
qs:
|
||||
description: QuickShop command
|
||||
usage: §c未知的子命令 请输入 §b/qs help §c查看帮助!
|
||||
aliases:
|
||||
- quickshop
|
||||
- shop
|
||||
permissions:
|
||||
quickshop.create.sell:
|
||||
description: Allows a player to sell from a shop
|
||||
default: op
|
||||
quickshop.create.buy:
|
||||
description: Allows a player to buy from a shop
|
||||
default: op
|
||||
quickshop.create.double:
|
||||
description: Allows a player to create a double shop
|
||||
default: op
|
||||
quickshop.use:
|
||||
description: Allows a player to buy/sell using other players shops
|
||||
default: true
|
||||
quickshop.unlimited:
|
||||
description: Allows a Staff Member to use /qs unlimited and make a shop infinite
|
||||
quickshop.bypass.<itemID>:
|
||||
description: Allows a player to sell <itemID>, even if its blacklisted
|
||||
quickshop.other.destroy:
|
||||
description: Allows a Staff Member to destroy other players shops if they are locked in the config
|
||||
quickshop.other.open:
|
||||
description: Allows a Staff Member to open someone elses shop if they are locked in the config
|
||||
quickshop.other.price:
|
||||
description: Allows a Staff Member to change the price of someone elses shop
|
||||
quickshop.setowner:
|
||||
description: Allows a Staff Member to change the owner of any shop
|
||||
quickshop.find:
|
||||
description: Allows a player to locate the nearest shop of a specific item type. Works in a 3 chunk radius.
|
||||
default: true
|
||||
quickshop.refill:
|
||||
description: Allows a Staff Member to refill the shop theyre looking at with the given number of items.
|
||||
default: op
|
||||
quickshop.empty:
|
||||
description: Allows a Staff Member to empty the shop theyre looking at of all items.
|
||||
default: op
|
||||
quickshop.debug:
|
||||
description: Enables debug info to console
|
||||
default: op
|
||||
quickshop.export:
|
||||
description: Allows exporting database to mysql or sqlite
|
||||
default: op
|
||||
quickshop.create.sell:
|
||||
description: Allows a player to sell from a shop
|
||||
default: op
|
||||
quickshop.create.buy:
|
||||
description: Allows a player to buy from a shop
|
||||
default: op
|
||||
quickshop.create.double:
|
||||
description: Allows a player to create a double shop
|
||||
default: op
|
||||
quickshop.use:
|
||||
description: Allows a player to buy/sell using other players shops
|
||||
default: true
|
||||
quickshop.unlimited:
|
||||
description: Allows a Staff Member to use /qs unlimited and make a shop infinite
|
||||
quickshop.bypass.<itemID>:
|
||||
description: Allows a player to sell <itemID>, even if its blacklisted
|
||||
quickshop.other.destroy:
|
||||
description: Allows a Staff Member to destroy other players shops if they are locked in the config
|
||||
quickshop.other.open:
|
||||
description: Allows a Staff Member to open someone elses shop if they are locked in the config
|
||||
quickshop.other.price:
|
||||
description: Allows a Staff Member to change the price of someone elses shop
|
||||
quickshop.setowner:
|
||||
description: Allows a Staff Member to change the owner of any shop
|
||||
quickshop.find:
|
||||
description: Allows a player to locate the nearest shop of a specific item type. Works in a 3 chunk radius.
|
||||
default: true
|
||||
quickshop.refill:
|
||||
description: Allows a Staff Member to refill the shop theyre looking at with the given number of items.
|
||||
default: op
|
||||
quickshop.empty:
|
||||
description: Allows a Staff Member to empty the shop theyre looking at of all items.
|
||||
default: op
|
||||
quickshop.debug:
|
||||
description: Enables debug info to console
|
||||
default: op
|
||||
quickshop.export:
|
||||
description: Allows exporting database to mysql or sqlite
|
||||
default: op
|
Reference in New Issue
Block a user