1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-11-22 01:58:54 +00:00

修复悬浮物刷物品 异步检测装备...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-11-23 21:00:24 +08:00
parent a0f4846fd1
commit 2467855766
4 changed files with 42 additions and 30 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.maxgamer</groupId> <groupId>org.maxgamer</groupId>
<artifactId>QuickShop</artifactId> <artifactId>QuickShop</artifactId>
<version>1.6.1</version> <version>1.6.2</version>
<description>快捷商店重置版本...</description> <description>快捷商店重置版本...</description>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
@ -54,7 +54,7 @@
</build> </build>
<properties> <properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url> <jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<update.description>&amp;c更新LocalUtil &amp;a新增更多武器翻译...</update.description> <update.description>&amp;c修复部分回收悬浮物的插件导致的刷物品 异步检测装备...</update.description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>

View File

@ -17,6 +17,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.maxgamer.QuickShop.QuickShop; import org.maxgamer.QuickShop.QuickShop;
import org.maxgamer.QuickShop.Shop.Shop; import org.maxgamer.QuickShop.Shop.Shop;
import org.maxgamer.QuickShop.Util.MarkUtil; import org.maxgamer.QuickShop.Util.MarkUtil;
@ -103,15 +104,28 @@ public class ProtectListener implements Listener {
@EventHandler @EventHandler
public void onPlayerHandlerItem(final PlayerItemHeldEvent e) { public void onPlayerHandlerItem(final PlayerItemHeldEvent e) {
final Player p = e.getPlayer(); Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
final ItemStack[] cis = p.getInventory().getArmorContents(); @Override
for (final ItemStack itemStack : cis) { public void run() {
if (MarkUtil.hasMark(itemStack)) { final Player p = e.getPlayer();
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法 §e§l穿戴 " + itemStack.getItemMeta().getDisplayName() + " §a已清理..."); final PlayerInventory inv = p.getInventory();
itemStack.setType(Material.AIR); final ItemStack[] cis = inv.getArmorContents();
for (int i = 0; i < cis.length; i++) {
final ItemStack itemStack = cis[i];
if (MarkUtil.hasMark(itemStack)) {
cis[i] = new ItemStack(Material.AIR);
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法 §e§l穿戴 " + itemStack.getItemMeta().getDisplayName() + " §a已清理...");
}
}
inv.setArmorContents(cis);
final int newslot = e.getNewSlot();
final ItemStack newItem = inv.getItem(newslot);
if (MarkUtil.hasMark(newItem)) {
inv.setItem(newslot, new ItemStack(Material.AIR));
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法 §e§l使用 " + newItem.getItemMeta().getDisplayName() + " §a已清理...");
}
} }
} });
p.getInventory().setArmorContents(cis);
} }
@EventHandler @EventHandler

View File

@ -55,9 +55,9 @@ import cn.citycraft.PluginHelper.utils.LocalUtil;
import cn.citycraft.PluginHelper.utils.VersionChecker; import cn.citycraft.PluginHelper.utils.VersionChecker;
public class QuickShop extends JavaPlugin { public class QuickShop extends JavaPlugin {
/** The active instance of QuickShop */ /** 初始化 QuickShop 的接口 */
public static QuickShop instance; public static QuickShop instance;
/** The plugin default config */ /** 插件的配置文件 */
public FileConfig config; public FileConfig config;
// private HeroChatListener heroChatListener; // private HeroChatListener heroChatListener;
// Listeners (These don't) // Listeners (These don't)
@ -110,8 +110,6 @@ public class QuickShop extends JavaPlugin {
return economy; return economy;
} }
/** The plugin metrics from Hidendra */
// public Metrics getMetrics(){ return metrics; }
public int getShopLimit(final Player p) { public int getShopLimit(final Player p) {
int max = configManager.getLimitdefault(); int max = configManager.getLimitdefault();
for (final Entry<String, Integer> entry : configManager.getLimits().entrySet()) { for (final Entry<String, Integer> entry : configManager.getLimits().entrySet()) {

View File

@ -13,48 +13,48 @@ softdepend:
website: ${jenkins.url}/job/${project.artifactId}/ website: ${jenkins.url}/job/${project.artifactId}/
commands: commands:
qs: qs:
description: QuickShop command description: QuickShop 命令
usage: §c未知的子命令 请输入 §b/qs help §c查看帮助! usage: §c未知的子命令 请输入 §b/qs help §c查看帮助!
aliases: aliases:
- quickshop - quickshop
- shop - shop
permissions: permissions:
quickshop.create.sell: quickshop.create.sell:
description: Allows a player to sell from a shop description: 允许玩家创建出售商店
default: op default: op
quickshop.create.buy: quickshop.create.buy:
description: Allows a player to buy from a shop description: 允许玩家创建收购商店
default: op default: op
quickshop.create.double: quickshop.create.double:
description: Allows a player to create a double shop description: 允许玩家创建双箱商店
default: op default: op
quickshop.use: quickshop.use:
description: Allows a player to buy/sell using other players shops description: 允许玩家在其他商店交易
default: true default: true
quickshop.unlimited: quickshop.unlimited:
description: Allows a Staff Member to use /qs unlimited and make a shop infinite description: 允许玩家使用/qs unlimited创建无限商店
quickshop.bypass.<itemID>: quickshop.bypass.<itemID>:
description: Allows a player to sell <itemID>, even if its blacklisted description: 允许玩家出售 <itemID>, 即使物品在黑名单里
quickshop.other.destroy: quickshop.other.destroy:
description: Allows a Staff Member to destroy other players shops if they are locked in the config description: 允许玩家摧毁其他玩家的商店
quickshop.other.open: quickshop.other.open:
description: Allows a Staff Member to open someone elses shop if they are locked in the config description: 允许玩家打开其他玩家的商店
quickshop.other.price: quickshop.other.price:
description: Allows a Staff Member to change the price of someone elses shop description: 允许玩家修改商店的价格
quickshop.setowner: quickshop.setowner:
description: Allows a Staff Member to change the owner of any shop description: 允许管理员设置商店的所有者
quickshop.find: quickshop.find:
description: Allows a player to locate the nearest shop of a specific item type. Works in a 3 chunk radius. description: 允许玩家查找附近的商店 (限制在3个区块内工作)
default: true default: true
quickshop.refill: quickshop.refill:
description: Allows a Staff Member to refill the shop theyre looking at with the given number of items. description: 允许玩家填满商店库存
default: op default: op
quickshop.empty: quickshop.empty:
description: Allows a Staff Member to empty the shop theyre looking at of all items. description: 允许玩家清空指定商店
default: op default: op
quickshop.debug: quickshop.debug:
description: Enables debug info to console description: 能够从控制台收到调试信息
default: op default: op
quickshop.export: quickshop.export:
description: Allows exporting database to mysql or sqlite description: 允许导出数据到SQLite或者MySQL
default: op default: op