mirror of
https://e.coding.net/circlecloud/MenuProtect.git
synced 2024-11-21 10:48:46 +00:00
feat: 添加扫地大妈支持
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
ebbe4c4f1e
commit
74e30a5295
9
pom.xml
9
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>pw.yumc</groupId>
|
||||
<artifactId>MenuProtect</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.3.1</version>
|
||||
<name>MenuProtect</name>
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
@ -57,7 +57,7 @@
|
||||
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
|
||||
</ciManagement>
|
||||
<properties>
|
||||
<update.description>1.3新版本 支持LoreCommand</update.description>
|
||||
<update.description>1.3.1添加扫地大妈检测</update.description>
|
||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
@ -81,6 +81,11 @@
|
||||
<type>jar</type>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
||||
<artifactId>WowSuchCleaner</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>PluginHelper</artifactId>
|
||||
|
@ -4,10 +4,13 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
import pw.yumc.MenuProtect.listen.ProtectListener;
|
||||
import pw.yumc.MenuProtect.listen.WowSuchCleanerListener;
|
||||
import pw.yumc.MenuProtect.utils.MarkUtil;
|
||||
|
||||
public class MenuProtect extends JavaPlugin {
|
||||
@ -27,6 +30,17 @@ public class MenuProtect extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Bukkit.getPluginManager().registerEvents(new ProtectListener(), this);
|
||||
final PluginManager pm = this.getServer().getPluginManager();
|
||||
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 版本过低 可能造成悬浮物上架...");
|
||||
}
|
||||
}
|
||||
this.getLogger().info("菜单物品保护已开启!");
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
package pw.yumc.MenuProtect.listen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent;
|
||||
import pw.yumc.MenuProtect.utils.MarkUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @since 2016年7月21日 下午4:57:35
|
||||
* @author 喵♂呜
|
||||
*/
|
||||
public class WowSuchCleanerListener implements Listener {
|
||||
@EventHandler
|
||||
public void onClear(final ItemPreCleanEvent e) {
|
||||
final List<ItemStack> list = e.getItemsToAuction();
|
||||
final List<ItemStack> needRemove = e.getItemsToAuction();
|
||||
for (final ItemStack itemStack : list) {
|
||||
if (MarkUtil.hasMark(itemStack)) {
|
||||
needRemove.add(itemStack);
|
||||
}
|
||||
}
|
||||
list.removeAll(needRemove);
|
||||
}
|
||||
}
|
@ -4,17 +4,16 @@ main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||
version: ${project.version}-git-${env.GIT_COMMIT}
|
||||
author: 喵♂呜
|
||||
website: ${ciManagement.url}
|
||||
softdepend:
|
||||
- WowSuchCleaner
|
||||
commands:
|
||||
${project.artifactId}:
|
||||
description: ${project.artifactId} - ${project.description}
|
||||
usage: §b使用/${project.artifactId} help 查看帮助!
|
||||
permission: ${project.artifactId}.reload
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
mp:
|
||||
mp: null
|
||||
permissions:
|
||||
${project.artifactId}.reload:
|
||||
description: 重新载入插件!
|
||||
default: op
|
||||
${project.artifactId}.reload:
|
||||
description: 重新载入插件!
|
||||
default: op
|
Loading…
Reference in New Issue
Block a user