コード例 #1
0
 @EventHandler(ignoreCancelled = true)
 public void onPlayerEntersBed(PlayerBedEnterEvent event) {
   if (dEntity.isNPC(event.getPlayer())) {
     return;
   }
   location = new dLocation(event.getBed().getLocation());
   cancelled = event.isCancelled();
   this.event = event;
   fire();
   event.setCancelled(cancelled);
 }
コード例 #2
0
ファイル: HPlayerListener.java プロジェクト: Ikke82/Heroes
  @Override
  public void onPlayerBedEnter(PlayerBedEnterEvent event) {
    Properties props = plugin.getConfigManager().getProperties();
    if (event.isCancelled()
        || !props.bedHeal
        || props.disabledWorlds.contains(event.getPlayer().getWorld().getName())) return;

    Hero hero = plugin.getHeroManager().getHero(event.getPlayer());
    long period = props.healInterval * 1000;
    double tickHealPercent = props.healPercent / 100.0;
    BedHealEffect bhEffect = new BedHealEffect(period, tickHealPercent);
    hero.addEffect(bhEffect);
  }
コード例 #3
0
  @EventHandler
  public void onSleep(PlayerBedEnterEvent bee) {

    Player p = bee.getPlayer();

    Game g = Main.getInstance().getGameManager().getGameOfPlayer(p);
    if (g == null) {
      return;
    }

    if (g.getState() == GameState.STOPPED) {
      return;
    }

    bee.setCancelled(true);
  }
コード例 #4
0
 @Override
 public ScriptEntryData getScriptEntryData() {
   return new BukkitScriptEntryData(
       dEntity.isPlayer(event.getPlayer()) ? dEntity.getPlayerFrom(event.getPlayer()) : null,
       null);
 }
コード例 #5
0
 @Override
 public void destroy() {
   PlayerBedEnterEvent.getHandlerList().unregister(this);
 }
コード例 #6
0
 @Override
 public void onPlayerBedEnter(PlayerBedEnterEvent event) {
   plugin.triggerMessages(event.getPlayer(), "onbedenter");
   if (plugin.triggerMessages(event.getPlayer(), "onbedenter|override")) event.setCancelled(true);
 }