?Notify
你是否厌倦了为每个项目重复创建用于相同事件的 mixin?在以前的好日子里,我们只需这样做一次。这就是为什么我们创建了这款出色的库/模组——只需添加一次事件,即可在所有其他项目中使用!
为此,我们使用了 alert,一个极速的事件监听工具。请参阅 alert 的文档 了解如何监听事件。
使用方法
将以下内容添加到你的模组的 build.gradle.kts 文件中:
repositories {
mavenCentral()
}
dependencies {
// ...
modImplementation("de.hglabor:notify:1.1.3")
}
然后将 notify 构建好的 jar 文件放入你的 mods 文件夹中。你应该能够像这样订阅事件:
// (在服务器端)
subscribeToEvent<PlayerJoinEvent> {
logger.info("玩家 ${it.player.name.string} 已加入")
}
当前已实现的事件
客户端的事件订阅尚未测试!(服务器/通用事件 应在服务器上正常工作)
通用
PlayerAttackEntityEvent
PlayerHungerChangeEvent
PlayerItemPickupEvent
PlayerPlaceBlockEvent
PlayerSlotClickEvent
服务器
PlayerBreakBlockEvent
PlayerDeathEvent
PlayerInteractItemEvent
PlayerInteractBlockEvent
PlayerItemDropEvent: 当玩家尝试丢弃物品时调用
PlayerItemDroppedEvent: 在物品被丢弃后调用
PrePlayerJoinEvent: 在玩家加入服务器之前调用
PlayerJoinEvent: 当玩家加入服务器时调用。允许修改加入消息
PostPlayerJoinEvent: 在玩家加入服务器之后调用
PlayerRemoveEvent: 在玩家从玩家列表中移除后调用
PlayerQuitEvent: 当玩家离开服务器时调用。允许修改离开消息
PlayerSwapHandItemsEvent
PlayerTickEvent
PlayerSetSettingsEvent: 例如当玩家更改客户端语言时调用
EntitySpawnEvent
ProjectileHitEvent: 当投射物击中另一个实体时调用
客户端
即将推出™
更多内容请阅读我们的 GitHub 说明文档
?Notify
You don't want to create mixins for each project over and over again for the same events you could just use in the good old paper days.
This is why we created this spectacular library/mod, where we just have to add the events once and can use them in every other project!
For this we use alert, a blazing fast event listening utility.
See alert's documentation on how to listen to events.
How to use
Add the following to your mod's build.gradle.kts file:
repositories {
mavenCentral()
}
dependencies {
// ...
modImplementation("de.hglabor:notify:1.1.3")
}
Then put the built jar file of notify into your mods folder. You should be able to subscribe to the events like this:
// (On the server)
subscribeToEvent<PlayerJoinEvent> {
logger.info("Player ${it.player.name.string} joined")
}
Events currently implemented
Subscribing to events on the client is not tested! (server/common events should work on the server)
Common
PlayerAttackEntityEvent
PlayerHungerChangeEvent
PlayerItemPickupEvent
PlayerPlaceBlockEvent
PlayerSlotClickEvent
Server
PlayerBreakBlockEvent
PlayerDeathEvent
PlayerInteractItemEvent
PlayerInteractBlockEvent
PlayerItemDropEvent: called when a player attempts to drop an item
PlayerItemDroppedEvent: called after an item was dropped
PrePlayerJoinEvent: called before a player joins the server
PlayerJoinEvent: called when a player joins the server. Allows modification of the join message
PostPlayerJoinEvent: called after a player joins the server
PlayerRemoveEvent: called after a player got removed from the player list
PlayerQuitEvent: called when a player quits the server. Allows modification of the quit message
PlayerSwapHandItemsEvent
PlayerTickEvent
PlayerSetSettingsEvent: called e.g. when player changes client language
EntitySpawnEvent
ProjectileHitEvent: called when a projectile hits another entity
Client
soon™
For more, read our github readme
评论 0
登录后参与评分
还没有评论,来抢沙发吧