From 6526ee66e1438732e519f838f00a8749ded89f40 Mon Sep 17 00:00:00 2001
From: tianyu <32282861@qq.com>
Date: Thu, 25 Jul 2024 04:39:47 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 38 ++++++++
pom.xml | 37 ++++++++
.../Listener/AntiChangeSpawn.java | 34 +++++++
.../DemonAntiEvent/Listener/AntiCommand.java | 22 +++++
.../DemonAntiEvent/Listener/AntiCraft.java | 31 +++++++
.../DemonAntiEvent/Listener/AntiEgg.java | 30 ++++++
.../DemonAntiEvent/Listener/AntiEnchant.java | 92 +++++++++++++++++++
.../DemonAntiEvent/Listener/AntiLagLimit.java | 86 +++++++++++++++++
.../DemonAntiEvent/Listener/AntiRedStone.java | 72 +++++++++++++++
.../DemonAntiEvent/Listener/AntiUse.java | 33 +++++++
.../DemonAntiEvent/Listener/JumpPlate.java | 26 ++++++
.../java/me/Demon/DemonAntiEvent/Main.java | 53 +++++++++++
src/main/resources/plugin.yml | 5 +
13 files changed, 559 insertions(+)
create mode 100644 .gitignore
create mode 100644 pom.xml
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiChangeSpawn.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCommand.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCraft.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEgg.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEnchant.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiLagLimit.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiRedStone.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/AntiUse.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Listener/JumpPlate.java
create mode 100644 src/main/java/me/Demon/DemonAntiEvent/Main.java
create mode 100644 src/main/resources/plugin.yml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ff6309
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..be19b73
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+
+ org.example
+ DemonAntiEvent
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+ public-rpg
+ https://repo.aurora-pixels.com/repository/public-rpg/
+
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.12.2
+
+
+ me.Demon.DemonPlugin
+ DemonAPI
+ 1.2.0
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiChangeSpawn.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiChangeSpawn.java
new file mode 100644
index 0000000..a9d3f39
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiChangeSpawn.java
@@ -0,0 +1,34 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+public class AntiChangeSpawn implements Listener {
+
+ @EventHandler
+ public void onTryChangeSpanwerType(PlayerInteractEvent e) {
+ Player p = e.getPlayer();
+ if (e.isCancelled()) {return;}
+ if (!e.hasItem() || !e.hasBlock()) {return;}
+ if (e.getClickedBlock().getType() == Material.MOB_SPAWNER) {
+ e.setCancelled(true);
+ p.sendMessage("§7[§6财产保护§7] §f目标方块已受财产保护禁止修改.");
+ }
+ }
+
+ @EventHandler
+ public void AntiBreakMob_Spawner(BlockBreakEvent e) {
+ Player p = e.getPlayer();
+ if (e.isCancelled()) {return;}
+ if (!p.isOp()) {return;}
+ if(e.getBlock().getType() == Material.MOB_SPAWNER){
+ e.setCancelled(true);
+ p.sendMessage("§7[§6财产保护§7] §f目标方块已受财产保护无法拆除.");
+ }
+ }
+
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCommand.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCommand.java
new file mode 100644
index 0000000..0ad1dce
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCommand.java
@@ -0,0 +1,22 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+
+import java.util.List;
+
+public class AntiCommand implements Listener {
+ @EventHandler(priority= EventPriority.HIGHEST)
+ public void onCommand(PlayerCommandPreprocessEvent e) {
+ Player p = e.getPlayer();
+ if(p.isOp()){return;}
+ String commands = e.getMessage().toLowerCase();
+ if(commands.contains("mv") || commands.contains("multiverse-core:mv") || commands.contains("multiverse-core")){
+ e.setCancelled(true);
+ p.sendMessage("§7[§6战争领域§7] §f该命令已被管理员禁止.");
+ }
+ }
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCraft.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCraft.java
new file mode 100644
index 0000000..1fc5938
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiCraft.java
@@ -0,0 +1,31 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.PrepareItemCraftEvent;
+import org.bukkit.inventory.ItemStack;
+
+public class AntiCraft implements Listener {
+
+ @EventHandler
+ public void onClick(PrepareItemCraftEvent e) {
+ if ((e.getRecipe() == null) || (e.getRecipe().getResult() == null)) {
+ return;
+ }
+ if (CheckISBlock(e.getRecipe().getResult())) {
+ ItemStack item = e.getRecipe().getResult();
+ item.setAmount(2);
+ e.getInventory().setItem(0, item);
+ }
+ }
+ /*判断合成物品的Type类型是否存在禁止合成列表中*/
+ public static boolean CheckISBlock(ItemStack item){
+ if(item.getType() == Material.DIRT){
+ if(item.getDurability() == 1) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEgg.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEgg.java
new file mode 100644
index 0000000..ec3900f
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEgg.java
@@ -0,0 +1,30 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import me.Demon.DemonAntiEvent.Main;
+import me.Demon.DemonPlugin.DemonAPI;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.ItemStack;
+
+public class AntiEgg implements Listener {
+
+ @EventHandler
+ public void onUseEgg(PlayerInteractEvent e) {
+ Player p = e.getPlayer();
+ if(!p.getWorld().getName().contains("ASkyBlock")){
+ ItemStack item = p.getItemInHand();
+ if(!DemonAPI.itemIsNull(item) && item.getType() == Material.EGG){
+ e.setCancelled(true);
+ p.sendMessage( "§7[§6战争领域§7] §f怎么能把哥哥的蛋乱扔呢?" );
+ p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 0.5F, 1.5F);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEnchant.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEnchant.java
new file mode 100644
index 0000000..28f18ed
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiEnchant.java
@@ -0,0 +1,92 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import me.Demon.DemonAntiEvent.Main;
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonPlugin.Util.ItemNameUtil;
+import org.bukkit.Sound;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AntiEnchant implements Listener {
+
+ public static String getItemName(ItemStack item) {
+ ItemStack items = item.clone();
+ return ItemNameUtil.getChineseName(items);
+ }
+
+ @EventHandler
+ public void onPlayerUse(PlayerInteractEvent e) {
+ Player p = e.getPlayer();
+ ItemStack item = p.getItemInHand();
+ if (!DemonAPI.itemIsNull(item) && DemonAPI.itemIsName(item)) {
+ String name = item.getType().name();
+ boolean butt = false;
+ if (name.contains("_AXE")) {
+ butt = true;
+ } else if (name.contains("_SPADE")) {
+ butt = true;
+ } else if (name.contains("_PICKAXE")) {
+ butt = true;
+ }
+ if (butt) {
+ if (item.getEnchantments().size() >= 1) {
+ ItemMeta meta = item.getItemMeta();
+ if (!meta.spigot().isUnbreakable()) {
+ item.setDurability((short) 0);
+ meta.spigot().setUnbreakable(true);
+ }
+ String itemName = getItemName(item);
+ meta.setDisplayName("§7[§f普通§7]§r" + itemName);
+ List lore = new ArrayList<>();
+ lore.add("§7§0§1§r§7§7耐久§0§1§r§7§f§l: §0§2§r§a" + 512 + "§7/§a" + 512);
+ meta.setLore(lore);
+ meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
+ meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ item.setItemMeta(meta);
+ for (Enchantment enchant : item.getEnchantments().keySet()) {
+ if (enchant.getId() == 34) {
+ item.removeEnchantment(enchant);
+ }
+ }
+ p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 0.5F, 1.5F);
+ p.sendMessage("§7[§6战争领域§7] §f您的工具已完成RPG属性升级.");
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onUnbreakable(PlayerInteractEvent e) {
+ Player p = e.getPlayer();
+ ItemStack item = p.getItemInHand();
+ if (!DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) {
+ ItemMeta meta = item.getItemMeta();
+ if (meta.getDisplayName().contains(":")) {
+ String itemName = getItemName(item);
+ meta.setDisplayName("§7[§f普通§7]§r" + itemName);
+ if (!meta.spigot().isUnbreakable()) {
+ item.setDurability((short) 0);
+ meta.spigot().setUnbreakable(true);
+ }
+ meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
+ item.setItemMeta(meta);
+ for (Enchantment enchant : item.getEnchantments().keySet()) {
+ if (enchant.getId() == 34) {
+ item.removeEnchantment(enchant);
+ }
+ }
+ p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 0.5F, 1.5F);
+ p.sendMessage("§7[§6战争领域§7] §f您的工具已完成RPG属性升级.");
+ }
+ }
+ }
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiLagLimit.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiLagLimit.java
new file mode 100644
index 0000000..4a3d0cd
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiLagLimit.java
@@ -0,0 +1,86 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import me.Demon.DemonAntiEvent.Main;
+import me.jet315.minions.events.MinerBlockBreakEvent;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public class AntiLagLimit implements Listener {
+
+ @EventHandler
+ public void onmini(MinerBlockBreakEvent e){
+ e.setCancelled(true);
+ }
+
+ public static List lockPlayer = new ArrayList<>();
+
+
+ @EventHandler(priority= EventPriority.HIGHEST)
+ public void onJoin(PlayerJoinEvent e) {
+ Player p = e.getPlayer();
+ lockPlayer.add(p.getUniqueId());
+ Bukkit.getScheduler().runTaskLater(Main.plugin, (Runnable) new Runnable() {
+ @Override
+ public void run() {
+ lockPlayer.remove(p.getUniqueId());
+ if(p.isOp()) {
+ p.sendMessage("§c[系统] §a数据已读取完成.");
+ }
+ }
+ }, (long) 60L);
+ }
+
+ @EventHandler(priority= EventPriority.HIGHEST)
+ public void onCommand(PlayerCommandPreprocessEvent e) {
+ Player p = e.getPlayer();
+ if(lockPlayer.contains(p.getUniqueId())){
+ e.setCancelled(true);
+ }
+ }
+
+
+ @EventHandler(priority= EventPriority.HIGHEST)
+ public void onClick(InventoryClickEvent e) {
+ Player p = (Player) e.getWhoClicked();
+ if(lockPlayer.contains(p.getUniqueId())){
+ e.setCancelled(true);
+ }
+ }
+
+ @EventHandler(priority= EventPriority.HIGHEST)
+ public void onInteract(PlayerInteractEvent e) {
+ Player p = e.getPlayer();
+ if(lockPlayer.contains(p.getUniqueId())){
+ e.setCancelled(true);
+ }
+ }
+
+ @EventHandler(priority= EventPriority.HIGHEST)
+ public void onBlockp(BlockPlaceEvent e) {
+ Player p = e.getPlayer();
+ if(lockPlayer.contains(p.getUniqueId())){
+ e.setCancelled(true);
+ }
+ }
+
+ @EventHandler(priority= EventPriority.HIGHEST)
+ public void onBlockb(BlockBreakEvent e) {
+ Player p = e.getPlayer();
+ if(lockPlayer.contains(p.getUniqueId())){
+ e.setCancelled(true);
+ }
+ }
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiRedStone.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiRedStone.java
new file mode 100644
index 0000000..1bc7e25
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiRedStone.java
@@ -0,0 +1,72 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import me.Demon.DemonAntiEvent.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.entity.EntitySpawnEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.ItemStack;
+
+public class AntiRedStone implements Listener {
+
+ @EventHandler
+ public void onplace(BlockPlaceEvent e){
+ Player p = e.getPlayer();
+ Block block = e.getBlock();
+ Location location = block.getLocation();
+ if(location.getWorld().getName().equalsIgnoreCase("ASkyBlock_nether")){
+ if(isRedStone(block.getType())){
+ e.setCancelled(true);
+ p.sendMessage( "§7[§6战争领域§7] §f因有玩家在该领域建造红石机造成卡服,故已停止建设红石项目." );
+ p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 0.5F, 1.5F);
+ }
+ }
+ }
+
+ public boolean isRedStone(Material material){
+ if(material == Material.REDSTONE_BLOCK){
+ return true;
+ }
+ if(material == Material.PISTON_BASE){
+ return true;
+ }
+ if(material == Material.PISTON_STICKY_BASE){
+ return true;
+ }
+ if(material == Material.REDSTONE_COMPARATOR_OFF){
+ return true;
+ }
+ if(material == Material.REDSTONE_TORCH_ON){
+ return true;
+ }
+ if(material == Material.DIODE_BLOCK_OFF){
+ return true;
+ }
+ return false;
+ }
+
+ /*@EventHandler
+ public void onEntitySpawn(EntitySpawnEvent event) {
+ if (event.getEntityType() == EntityType.PIG_ZOMBIE) {
+ int maxSpawnCount = 3;
+ int currentSpawnCount = 0;
+ for (Entity entity : event.getLocation().getChunk().getEntities()) {
+ if (entity.getType() == EntityType.PIG_ZOMBIE) {
+ currentSpawnCount++;
+ }
+ }
+ if (currentSpawnCount >= maxSpawnCount) {
+ event.setCancelled(true);
+ }
+ }
+ }*/
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiUse.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiUse.java
new file mode 100644
index 0000000..c59e35f
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/AntiUse.java
@@ -0,0 +1,33 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+public class AntiUse implements Listener {
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
+ public void onUseBed(PlayerInteractEvent e) {
+ Player p = e.getPlayer();
+ if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
+ if (e.getClickedBlock().getType() == Material.ANVIL) {
+ e.setCancelled(true);
+ p.sendTitle("§7[§6属性保护§7] §f", "§f服务器禁止使用铁砧");
+ p.sendMessage("§7[§6属性保护§7] §f因担心RPG装备会被原版修改属性导致失效,所以禁止");
+ p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 0.5F, 1.5F);
+ }
+ if (e.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE) {
+ e.setCancelled( true );
+ p.sendTitle( "§7[§6属性保护§7] §f", "§f服务器禁止使用附魔台" );
+ p.sendMessage( "§7[§6属性保护§7] §f因担心RPG装备会特殊的附魔导致失效,所以禁止" );
+ p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 0.5F, 1.5F);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Listener/JumpPlate.java b/src/main/java/me/Demon/DemonAntiEvent/Listener/JumpPlate.java
new file mode 100644
index 0000000..706922f
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Listener/JumpPlate.java
@@ -0,0 +1,26 @@
+package me.Demon.DemonAntiEvent.Listener;
+
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.util.Vector;
+
+public class JumpPlate implements Listener {
+
+ @EventHandler
+ public void onJumpPlate(PlayerMoveEvent e) {
+ Player p = e.getPlayer();
+ if(p.getWorld().getName().equals("kuangqu")) {
+ if (e.getPlayer().getLocation().getBlock().getType() == Material.GOLD_PLATE) {
+ Vector vector = e.getPlayer().getLocation().getDirection().multiply(1.5D).setY(1.0D);
+ e.getPlayer().setVelocity(vector);
+ e.getPlayer().playSound(e.getPlayer().getLocation(), Sound.BLOCK_PISTON_EXTEND, 1.0F, 1.0F);
+ e.getPlayer().setFallDistance(-9999.0F);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/me/Demon/DemonAntiEvent/Main.java b/src/main/java/me/Demon/DemonAntiEvent/Main.java
new file mode 100644
index 0000000..ac310e7
--- /dev/null
+++ b/src/main/java/me/Demon/DemonAntiEvent/Main.java
@@ -0,0 +1,53 @@
+package me.Demon.DemonAntiEvent;
+
+import me.Demon.DemonAntiEvent.Listener.*;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
+public class Main extends JavaPlugin {
+
+ public static Main plugin;
+
+ @Override
+ public void onEnable() {
+ plugin = this;
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-命令禁止");
+ Bukkit.getPluginManager().registerEvents(new AntiCommand(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-合成配方禁用");
+ Bukkit.getPluginManager().registerEvents(new AntiCraft(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-数据延迟保护");
+ Bukkit.getPluginManager().registerEvents(new AntiLagLimit(), plugin);
+ Bukkit.getPluginManager().registerEvents(new AntiEgg(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-扔鸡蛋保护");
+ Bukkit.getPluginManager().registerEvents(new AntiUse(), plugin);
+ Bukkit.getPluginManager().registerEvents(new AntiEnchant(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-铁砧保护");
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-附魔台保护");
+ Bukkit.getPluginManager().registerEvents(new JumpPlate(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-踏板跳跃");
+ Bukkit.getPluginManager().registerEvents(new AntiChangeSpawn(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-刷怪笼保护");
+ Bukkit.getPluginManager().registerEvents(new AntiRedStone(), plugin);
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f事件注册-地狱红石禁止");
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §a插件成功载入Server!");
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §a妖魂QQ:1763917516");
+ }
+
+ @Override
+ public void onDisable() {
+ Bukkit.getConsoleSender().sendMessage("§c[生存禁止] §f插件已关闭.");
+ }
+
+ public boolean onCommand(CommandSender sender, Command cmd, String Command, String[] args) {
+ if (Command.equalsIgnoreCase("antienent") && sender.isOp()) {
+ Player p = (Player) sender;
+ World world = p.getWorld();
+ sender.sendMessage("当前时间: " + world.getTime());
+ }
+ return false;
+ }
+}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
new file mode 100644
index 0000000..e476490
--- /dev/null
+++ b/src/main/resources/plugin.yml
@@ -0,0 +1,5 @@
+name: DemonAntiEvent
+main: me.Demon.DemonAntiEvent.Main
+version: 1.0.1
+commands:
+ antienent:
\ No newline at end of file