本文整理汇总了Java中net.canarymod.hook.player.BedEnterHook类的典型用法代码示例。如果您正苦于以下问题:Java BedEnterHook类的具体用法?Java BedEnterHook怎么用?Java BedEnterHook使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BedEnterHook类属于net.canarymod.hook.player包,在下文中一共展示了BedEnterHook类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEnteringBed
import net.canarymod.hook.player.BedEnterHook; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onEnteringBed(final BedEnterHook hook) {
PlayerBedEnterEvent event =
new PlayerBedEnterEvent(new CanaryPlayer(hook.getPlayer()), new CanaryBlock(hook.getBed()));
event.setCancelled(hook.isCanceled());
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
hook.setCanceled();
}
}
示例2: onTrySleep
import net.canarymod.hook.player.BedEnterHook; //导入依赖的package包/类
@Inject(method = "trySleep", at = @At(value = "INVOKE"))
public void onTrySleep(BlockPos bedLocation, CallbackInfoReturnable<EntityPlayer.EnumStatus> callbackInfo) {
if (this instanceof Player) {
BedEnterHook bedEnterHook = (BedEnterHook)
new BedEnterHook((Player) this, this.getWorld().getBlockAt(bedLocation.getX(),
bedLocation.getY(), bedLocation.getZ())).call();
if (bedEnterHook.isCanceled()) {
callbackInfo.setReturnValue(EntityPlayer.EnumStatus.OTHER_PROBLEM);
}
}
}