init
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
|||||||
|
# User-specific stuff
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Common working directory
|
||||||
|
run*/
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
target/
|
||||||
|
dependency-reduced-pom.xml
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<?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>xyz.fortern</groupId>
|
||||||
|
<artifactId>fortern-helper</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>fortern-helper</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>25</java.version>
|
||||||
|
<kotlin.version>2.4.0</kotlin.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<defaultGoal>clean package</defaultGoal>
|
||||||
|
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-maven-plugin</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<jvmTarget>${java.version}</jvmTarget>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.5.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigotmc-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>26.1-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package xyz.fortern.forternhelper
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin
|
||||||
|
import xyz.fortern.forternhelper.listener.ForternListener
|
||||||
|
|
||||||
|
class Helper : JavaPlugin() {
|
||||||
|
|
||||||
|
override fun onEnable() {
|
||||||
|
// Plugin startup logic
|
||||||
|
logger.info("Registering events...")
|
||||||
|
logger.info("监听末影人生成...")
|
||||||
|
Bukkit.getPluginManager().registerEvents(ForternListener(this), this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDisable() {
|
||||||
|
// Plugin shutdown logic
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package xyz.fortern.forternhelper.listener
|
||||||
|
|
||||||
|
import org.bukkit.entity.Enderman
|
||||||
|
import org.bukkit.entity.Player
|
||||||
|
import org.bukkit.entity.Villager
|
||||||
|
import org.bukkit.event.EventHandler
|
||||||
|
import org.bukkit.event.Listener
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent
|
||||||
|
import org.bukkit.event.entity.VillagerReplenishTradeEvent
|
||||||
|
import org.bukkit.event.inventory.TradeSelectEvent
|
||||||
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent
|
||||||
|
import xyz.fortern.forternhelper.Helper
|
||||||
|
|
||||||
|
class ForternListener(val helper: Helper) : Listener {
|
||||||
|
@EventHandler
|
||||||
|
fun onCreatureSpawn(event: CreatureSpawnEvent) {
|
||||||
|
val entity = event.entity
|
||||||
|
if (entity !is Enderman) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val location = event.location
|
||||||
|
val x = location.x
|
||||||
|
val y = location.y
|
||||||
|
val z = location.z
|
||||||
|
// x: -900
|
||||||
|
if (x > -1028 && x < -770 && y > 0 && y < 186 && z > -777 && z < -521) {
|
||||||
|
helper.logger.info("Enderman spawned at ${entity.location}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
name: fortern-helper
|
||||||
|
version: '${version}'
|
||||||
|
authors: [ Fortern ]
|
||||||
|
api-version: '26.1'
|
||||||
|
main: xyz.fortern.forternhelper.Helper
|
||||||
|
|
||||||
|
libraries:
|
||||||
|
- org.jetbrains.kotlin:kotlin-stdlib:2.3.21
|
||||||
|
|
||||||
|
commands:
|
||||||
|
helper:
|
||||||
|
description: "游戏主命令"
|
||||||
|
permission: op
|
||||||
Reference in New Issue
Block a user