/**
* Fires when an item is consumed. As we are not altering the event,
* but we do want to know if it is cancelled, we run it on the Monitor
* priority.
*
* @param event Event to handle.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onItemConsume(PlayerItemConsumeEvent event) {
if (event.getItem().getType() == Material.MILK_BUCKET) {
// We don't want to cancel the event, but we want to re-apply darkness after the event
// has completed - if needed, so that the player can't cheat using the milk.
final Player player = event.getPlayer();
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
DarkerNights.checkBlindness(player);
}
});
}
}
DarkerNights.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:DarkerNights
作者:
评论列表
文章目录