mirror of
https://e.coding.net/circlecloud/MenuProtect.git
synced 2025-11-24 21:46:11 +00:00
181
pom.xml
181
pom.xml
@@ -1,96 +1,89 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>pw.yumc</groupId>
|
<groupId>pw.yumc</groupId>
|
||||||
<artifactId>MenuProtect</artifactId>
|
<artifactId>MenuProtect</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.4</version>
|
||||||
<name>MenuProtect</name>
|
<name>MenuProtect</name>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.7</source>
|
<source>1.7</source>
|
||||||
<target>1.7</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>2.3</version>
|
<version>2.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
<minimizeJar>true</minimizeJar>
|
<minimizeJar>true</minimizeJar>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>cn.citycraft:PluginHelper</include>
|
<include>pw.yumc:YumCore</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>cn.citycraft.PluginHelper</pattern>
|
<pattern>pw.yumc:YumCore</pattern>
|
||||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<ciManagement>
|
<ciManagement>
|
||||||
<system>Jenkins</system>
|
<system>Jenkins</system>
|
||||||
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
|
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
|
||||||
</ciManagement>
|
</ciManagement>
|
||||||
<properties>
|
<properties>
|
||||||
<update.description>1.3.1添加扫地大妈检测</update.description>
|
<update.description>1.3.1添加扫地大妈检测</update.description>
|
||||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
<env.GIT_COMMIT>DEV</env.GIT_COMMIT>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>yumc-repo</id>
|
<id>yumc-repo</id>
|
||||||
<url>http://repo.yumc.pw/content/groups/public/</url>
|
<url>http://repo.yumc.pw/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jtb</id>
|
<id>jtb</id>
|
||||||
<name>YUMC</name>
|
<name>YUMC</name>
|
||||||
<url>http://repo.yumc.pw/content/repositories/yumcenter/</url>
|
<url>http://repo.yumc.pw/content/repositories/yumcenter/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>WowSuchCleaner</artifactId>
|
||||||
<type>jar</type>
|
<version>1.6.5</version>
|
||||||
<version>1.9-R0.1-SNAPSHOT</version>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
<dependency>
|
<groupId>pw.yumc</groupId>
|
||||||
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
<artifactId>YumCore</artifactId>
|
||||||
<artifactId>WowSuchCleaner</artifactId>
|
<version>1.5</version>
|
||||||
<version>1.6.5</version>
|
</dependency>
|
||||||
</dependency>
|
</dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>cn.citycraft</groupId>
|
|
||||||
<artifactId>PluginHelper</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>1.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
||||||
@@ -8,10 +8,10 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
|
||||||
import pw.yumc.MenuProtect.listen.ProtectListener;
|
import pw.yumc.MenuProtect.listen.ProtectListener;
|
||||||
import pw.yumc.MenuProtect.listen.WowSuchCleanerListener;
|
import pw.yumc.MenuProtect.listen.WowSuchCleanerListener;
|
||||||
import pw.yumc.MenuProtect.utils.MarkUtil;
|
import pw.yumc.MenuProtect.utils.MarkUtil;
|
||||||
|
import pw.yumc.YumCore.config.FileConfig;
|
||||||
|
|
||||||
public class MenuProtect extends JavaPlugin {
|
public class MenuProtect extends JavaPlugin {
|
||||||
FileConfig config;
|
FileConfig config;
|
||||||
@@ -19,6 +19,10 @@ public class MenuProtect extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
|
if ("reload".equalsIgnoreCase(args[0])) {
|
||||||
|
onLoad();
|
||||||
|
sender.sendMessage("§a配置文件已重载!");
|
||||||
|
}
|
||||||
final Player player = Bukkit.getPlayerExact(args[0]);
|
final Player player = Bukkit.getPlayerExact(args[0]);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
@@ -33,12 +37,11 @@ public class MenuProtect extends JavaPlugin {
|
|||||||
final PluginManager pm = this.getServer().getPluginManager();
|
final PluginManager pm = this.getServer().getPluginManager();
|
||||||
final Plugin wsc = pm.getPlugin("WowSuchCleaner");
|
final Plugin wsc = pm.getPlugin("WowSuchCleaner");
|
||||||
if (wsc != null && wsc.isEnabled()) {
|
if (wsc != null && wsc.isEnabled()) {
|
||||||
getLogger().info("发现 WowSuchCleaner 插件 开启相关功能...");
|
|
||||||
try {
|
try {
|
||||||
Class.forName("io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent");
|
Class.forName("io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent");
|
||||||
pm.registerEvents(new WowSuchCleanerListener(), this);
|
pm.registerEvents(new WowSuchCleanerListener(), this);
|
||||||
} catch (final ClassNotFoundException e) {
|
getLogger().info("发现 WowSuchCleaner 插件 开启相关功能...");
|
||||||
getLogger().info("WowSuchCleaner 版本过低 可能造成悬浮物上架...");
|
} catch (final ClassNotFoundException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getLogger().info("菜单物品保护已开启!");
|
this.getLogger().info("菜单物品保护已开启!");
|
||||||
@@ -46,7 +49,7 @@ public class MenuProtect extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
config = new FileConfig(this);
|
config = new FileConfig();
|
||||||
MarkUtil.marks = config.getStringList("MarkList");
|
MarkUtil.marks = config.getStringList("MarkList");
|
||||||
MarkUtil.initCommand(config.getConfigurationSection("LoreCommand"));
|
MarkUtil.initCommand(config.getConfigurationSection("LoreCommand"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
import cn.citycraft.PluginHelper.kit.PluginKit;
|
|
||||||
import pw.yumc.MenuProtect.utils.MarkUtil;
|
import pw.yumc.MenuProtect.utils.MarkUtil;
|
||||||
|
import pw.yumc.YumCore.kit.PKit;
|
||||||
|
|
||||||
public class ProtectListener implements Listener {
|
public class ProtectListener implements Listener {
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class ProtectListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handlerPlayerClick(final Player p, final ItemStack is) {
|
private void handlerPlayerClick(final Player p, final ItemStack is) {
|
||||||
PluginKit.runTaskAsync(new Runnable() {
|
PKit.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MarkUtil.handlerItemClick(p, is);
|
MarkUtil.handlerItemClick(p, is);
|
||||||
@@ -58,7 +58,7 @@ public class ProtectListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handlerPlayerInventory(final Player p) {
|
private void handlerPlayerInventory(final Player p) {
|
||||||
PluginKit.runTaskAsync(new Runnable() {
|
PKit.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final PlayerInventory inv = p.getInventory();
|
final PlayerInventory inv = p.getInventory();
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import cn.citycraft.PluginHelper.kit.PluginKit;
|
import pw.yumc.YumCore.bukkit.Log;
|
||||||
|
import pw.yumc.YumCore.kit.PKit;
|
||||||
|
|
||||||
public class MarkUtil {
|
public class MarkUtil {
|
||||||
public static List<String> marks = null;
|
public static List<String> marks = null;
|
||||||
@@ -19,9 +20,9 @@ public class MarkUtil {
|
|||||||
public static void handlerItemClick(final Player p, final ItemStack is) {
|
public static void handlerItemClick(final Player p, final ItemStack is) {
|
||||||
if (hasMark(is) && is.getItemMeta().hasLore()) {
|
if (hasMark(is) && is.getItemMeta().hasLore()) {
|
||||||
for (final String lore : is.getItemMeta().getLore()) {
|
for (final String lore : is.getItemMeta().getLore()) {
|
||||||
if (cmds.containsKey(lore)) {
|
if (cmds.containsKey(lore) || (is.getItemMeta().hasDisplayName() && cmds.containsKey(is.getItemMeta().getDisplayName()))) {
|
||||||
for (final String cmd : cmds.get(lore)) {
|
for (final String cmd : cmds.get(lore)) {
|
||||||
PluginKit.runTask(new Runnable() {
|
PKit.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
CommandSender sender = Bukkit.getConsoleSender();
|
CommandSender sender = Bukkit.getConsoleSender();
|
||||||
@@ -41,11 +42,9 @@ public class MarkUtil {
|
|||||||
public static boolean hasMark(final ItemStack ci) {
|
public static boolean hasMark(final ItemStack ci) {
|
||||||
try {
|
try {
|
||||||
for (final String mark : marks) {
|
for (final String mark : marks) {
|
||||||
if (ci.getItemMeta().getDisplayName().startsWith(mark)) {
|
if (ci.getItemMeta().getDisplayName().startsWith(mark)) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception ignored) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -55,6 +54,6 @@ public class MarkUtil {
|
|||||||
for (final String lore : cfg.getKeys(false)) {
|
for (final String lore : cfg.getKeys(false)) {
|
||||||
cmds.put(lore, cfg.getStringList(lore));
|
cmds.put(lore, cfg.getStringList(lore));
|
||||||
}
|
}
|
||||||
PluginKit.getLogger().info("初始化LoreCommand完毕 总计: " + cmds.size() + "条...");
|
Log.info("初始化LoreCommand完毕 总计: " + cmds.size() + "条...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user