mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-12-27 07:48:48 +00:00
完善异步玩家背包检测流程...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
86d0eb796e
commit
79ea58412a
4
pom.xml
4
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.maxgamer</groupId>
|
||||
<artifactId>QuickShop</artifactId>
|
||||
<version>1.6.8</version>
|
||||
<version>1.6.9</version>
|
||||
<description>快捷商店重置版本...</description>
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
@ -55,7 +55,7 @@
|
||||
<properties>
|
||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||
<env.BUILD_NUMBER>DEBUG</env.BUILD_NUMBER>
|
||||
<update.description>&c删除所谓的&4"DDOS"&c模块&e停止插件所有更新...&a你们提交PullRequest我还是会合并的...</update.description>
|
||||
<update.description>&a增加1.7版本兼容(&e测试&a) &c完善异步背包检测流程 发现非法物品后自动扫描...</update.description>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user