Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MEFRREEX committed Mar 31, 2024
0 parents commit 98a1582
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/
.idea/
*.class
target/
50 changes: 50 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mefrreex.beehivefixer</groupId>
<artifactId>beehivefixer</artifactId>
<version>1.0.0</version>

<name>BeehiveFixer</name>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>opencollab-repository-maven-snapshots</id>
<url>https://repo.opencollab.dev/maven-snapshots</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.github.PowerNukkitX</groupId>
<artifactId>PowerNukkitX</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<defaultGoal>clean package</defaultGoal>
<finalName>${project.name}-${project.version}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources/</directory>
</resource>
</resources>
</build>

</project>
24 changes: 24 additions & 0 deletions src/main/java/com/mefrreex/beehivefixer/BeehiveFixer.java
Original file line number Diff line number Diff line change
@@ -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();
}
});
}
}
5 changes: 5 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: "${project.name}"
version: "${project.version}"
api: ["2.0.0"]
author: MEFRREEX
main: com.mefrreex.beehivefixer.BeehiveFixer

0 comments on commit 98a1582

Please sign in to comment.