diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b820f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.vscode/ +.idea/ +*.class +target/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a6d2d61 --- /dev/null +++ b/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + com.mefrreex.beehivefixer + beehivefixer + 1.0.0 + + BeehiveFixer + + + 17 + 17 + UTF-8 + + + + + jitpack.io + https://jitpack.io + + + opencollab-repository-maven-snapshots + https://repo.opencollab.dev/maven-snapshots + + + + + + com.github.PowerNukkitX + PowerNukkitX + master-SNAPSHOT + + + + + clean package + ${project.name}-${project.version} + src/main/java + + + true + src/main/resources/ + + + + + diff --git a/src/main/java/com/mefrreex/beehivefixer/BeehiveFixer.java b/src/main/java/com/mefrreex/beehivefixer/BeehiveFixer.java new file mode 100644 index 0000000..fd013f5 --- /dev/null +++ b/src/main/java/com/mefrreex/beehivefixer/BeehiveFixer.java @@ -0,0 +1,24 @@ +package com.mefrreex.beehivefixer; + +import cn.nukkit.blockentity.BlockEntityBeehive; +import cn.nukkit.event.EventHandler; +import cn.nukkit.event.Listener; +import cn.nukkit.event.level.ChunkLoadEvent; +import cn.nukkit.plugin.PluginBase; + +public class BeehiveFixer extends PluginBase implements Listener { + + @Override + public void onEnable() { + this.getServer().getPluginManager().registerEvents(this, this); + } + + @EventHandler + public void onChunkLoad(ChunkLoadEvent event) { + event.getLevel().getBlockEntities().values().forEach(entity -> { + if (entity instanceof BlockEntityBeehive) { + entity.close(); + } + }); + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..65b43ca --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,5 @@ +name: "${project.name}" +version: "${project.version}" +api: ["2.0.0"] +author: MEFRREEX +main: com.mefrreex.beehivefixer.BeehiveFixer \ No newline at end of file