diff --git a/pom.xml b/pom.xml
index a68507d..f5db76e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
org.maxgamer
QuickShop
- 1.6.8
+ 1.6.9
快捷商店重置版本...
${project.name}
@@ -55,7 +55,7 @@
http://ci.citycraft.cn:8080
DEBUG
- &c删除所谓的&4"DDOS"&c模块&e停止插件所有更新...&a你们提交PullRequest我还是会合并的...
+ &a增加1.7版本兼容(&e测试&a) &c完善异步背包检测流程 发现非法物品后自动扫描...
UTF-8
diff --git a/src/main/java/org/maxgamer/QuickShop/Listeners/ProtectListener.java b/src/main/java/org/maxgamer/QuickShop/Listeners/ProtectListener.java
index 98b63b0..8b68e8c 100644
--- a/src/main/java/org/maxgamer/QuickShop/Listeners/ProtectListener.java
+++ b/src/main/java/org/maxgamer/QuickShop/Listeners/ProtectListener.java
@@ -55,14 +55,12 @@ public class ProtectListener implements Listener {
if (MarkUtil.hasMark(ci)) {
e.setCancelled(true);
}
-
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);
}
@@ -136,8 +134,28 @@ public class ProtectListener implements Listener {
}
}
+ private void clearIllegalItem(final Player player) {
+ plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
+ @Override
+ public void run() {
+ final Inventory inv = player.getInventory();
+ int clearnum = 0;
+ for (final ItemStack itemStack : inv) {
+ if (MarkUtil.hasMark(itemStack)) {
+ inv.remove(itemStack);
+ clearnum++;
+ }
+ }
+ if (clearnum != 0) {
+ Bukkit.broadcastMessage(plugin.getConfigManager().getGuiTitle() + " §4提示 §d扫描完毕 §d已清理 §a" + player.getName() + " §c非法获取的物品 §4" + clearnum + " §c个物品...");
+ }
+ }
+ });
+ }
+
private void sendWarning(final Player p, final ItemStack ci, final String action) {
Bukkit.broadcastMessage(plugin.getConfigManager().getGuiTitle() + " §4警告 " + p.getDisplayName() + " §c非法 " + action + " " + ci.getItemMeta().getDisplayName());
Bukkit.broadcastMessage(plugin.getConfigManager().getGuiTitle() + " §4提示 §d系统 §d已清理 §a" + p.getName() + " §c非法获取的物品 §a并扫描玩家背包...");
+ clearIllegalItem(p);
}
}