コード例 #1
0
ファイル: FilterEvents.java プロジェクト: Prodigy4532/Rixor
 @EventHandler(priority = EventPriority.LOW)
 public void onBlockForm(BlockFormEvent event) {
   Map map = Rixor.getRotation().getSlot().getMap();
   BlockChangeEvent change =
       new BlockChangeEvent(event, map, null, event.getBlock().getState(), event.getNewState());
   Rixor.callEvent(change);
 }
コード例 #2
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onBlockForm(final BlockFormEvent event) {
   final Block b = event.getBlock();
   if (isLogging(b.getWorld(), Logging.SNOWFORM)) {
     final BlockState n = event.getNewState();
     final int type = n.getTypeId();
     if (type == 78 || type == 79) consumer.queueBlockReplace("SnowForm", b.getState(), n);
   }
 }
コード例 #3
0
 @HawkEvent(dataType = DataType.BLOCK_FORM)
 public void onBlockForm(BlockFormEvent event) {
   DataManager.addEntry(
       new BlockChangeEntry(
           "Environment",
           DataType.BLOCK_FORM,
           event.getBlock().getLocation(),
           event.getBlock().getState(),
           event.getNewState()));
 }
コード例 #4
0
ファイル: DynmapPlugin.java プロジェクト: CovertHoax/dynmap
 @Override
 public void onBlockForm(BlockFormEvent event) {
   if (event.isCancelled()) return;
   /* Call listeners */
   List<Listener> ll = event_handlers.get(event.getType());
   if (ll != null) {
     for (Listener l : ll) {
       ((BlockListener) l).onBlockForm(event);
     }
   }
 }
コード例 #5
0
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockForm(final BlockFormEvent event) {
    Block b = event.getBlock();

    if (PlotManager.isPlotWorld(b)) {
      String id = PlotManager.getPlotId(b.getLocation());

      if (id.equalsIgnoreCase("")) {
        event.setCancelled(true);
      }
    }
  }
コード例 #6
0
  /*
   * Called when a block is formed based on world conditions.
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockForm(BlockFormEvent event) {
    ConfigurationManager cfg = plugin.getGlobalStateManager();
    WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());

    if (cfg.activityHaltToggle) {
      event.setCancelled(true);
      return;
    }

    int type = event.getNewState().getTypeId();

    if (type == BlockID.ICE) {
      if (wcfg.disableIceFormation) {
        event.setCancelled(true);
        return;
      }
      if (wcfg.useRegions
          && !plugin
              .getGlobalRegionManager()
              .allows(DefaultFlag.ICE_FORM, event.getBlock().getLocation())) {
        event.setCancelled(true);
        return;
      }
    }

    if (type == BlockID.SNOW) {
      if (wcfg.disableSnowFormation) {
        event.setCancelled(true);
        return;
      }
      if (wcfg.useRegions
          && !plugin
              .getGlobalRegionManager()
              .allows(DefaultFlag.SNOW_FALL, event.getBlock().getLocation())) {
        event.setCancelled(true);
        return;
      }
    }
  }
コード例 #7
0
 /*    */ @EventHandler
 /*    */ public void onBlockForm(BlockFormEvent event) /*    */ {
   /* 41 */ if (this.noFreeze) /* 42 */ event.setCancelled(true);
   /*    */ }
コード例 #8
0
 @EventHandler
 public void BlockFormEvent(BlockFormEvent event) {
   if (!arena.getRegion().isInside(event.getBlock().getLocation()) || arena.getEditMode()) return;
   event.setCancelled(true);
 }
コード例 #9
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onBlockForm(BlockFormEvent event) {
   addToCheck(event.getBlock(), event.getBlock().getState());
 }
コード例 #10
0
  protected void g() {
    super.g();
    int i = 0;
    int j = 0;
    // CraftBukkit start
    // Iterator iterator = this.chunkTickList.iterator();

    for (long chunkCoord : this.chunkTickList.popAll()) {
      int chunkX = LongHash.msw(chunkCoord);
      int chunkZ = LongHash.lsw(chunkCoord);
      // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
      int k = chunkX * 16;
      int l = chunkZ * 16;

      this.methodProfiler.a("getChunk");
      Chunk chunk = this.getChunkAt(chunkX, chunkZ);
      // CraftBukkit end

      this.a(k, l, chunk);
      this.methodProfiler.c("tickChunk");
      chunk.k();
      this.methodProfiler.c("thunder");
      int i1;
      int j1;
      int k1;
      int l1;

      if (this.random.nextInt(100000) == 0 && this.Q() && this.P()) {
        this.k = this.k * 3 + 1013904223;
        i1 = this.k >> 2;
        j1 = k + (i1 & 15);
        k1 = l + (i1 >> 8 & 15);
        l1 = this.h(j1, k1);
        if (this.isRainingAt(j1, l1, k1)) {
          this.strikeLightning(new EntityLightning(this, (double) j1, (double) l1, (double) k1));
        }
      }

      this.methodProfiler.c("iceandsnow");
      int i2;

      if (this.random.nextInt(16) == 0) {
        this.k = this.k * 3 + 1013904223;
        i1 = this.k >> 2;
        j1 = i1 & 15;
        k1 = i1 >> 8 & 15;
        l1 = this.h(j1 + k, k1 + l);
        if (this.y(j1 + k, l1 - 1, k1 + l)) {
          // CraftBukkit start
          BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1 - 1, k1 + l).getState();
          blockState.setTypeId(Block.ICE.id);

          BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
          this.getServer().getPluginManager().callEvent(iceBlockForm);
          if (!iceBlockForm.isCancelled()) {
            blockState.update(true);
          }
          // CraftBukkit end
        }

        if (this.Q() && this.z(j1 + k, l1, k1 + l)) {
          // CraftBukkit start
          BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState();
          blockState.setTypeId(Block.SNOW.id);

          BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
          this.getServer().getPluginManager().callEvent(snow);
          if (!snow.isCancelled()) {
            blockState.update(true);
          }
          // CraftBukkit end
        }

        if (this.Q()) {
          BiomeBase biomebase = this.getBiome(j1 + k, k1 + l);

          if (biomebase.d()) {
            i2 = this.getTypeId(j1 + k, l1 - 1, k1 + l);
            if (i2 != 0) {
              Block.byId[i2].g(this, j1 + k, l1 - 1, k1 + l);
            }
          }
        }
      }

      this.methodProfiler.c("tickTiles");
      ChunkSection[] achunksection = chunk.i();

      j1 = achunksection.length;

      for (k1 = 0; k1 < j1; ++k1) {
        ChunkSection chunksection = achunksection[k1];

        if (chunksection != null && chunksection.shouldTick()) {
          for (int j2 = 0; j2 < 3; ++j2) {
            this.k = this.k * 3 + 1013904223;
            i2 = this.k >> 2;
            int k2 = i2 & 15;
            int l2 = i2 >> 8 & 15;
            int i3 = i2 >> 16 & 15;
            int j3 = chunksection.getTypeId(k2, i3, l2);

            ++j;
            Block block = Block.byId[j3];

            if (block != null && block.isTicking()) {
              ++i;
              block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random);
            }
          }
        }
      }

      this.methodProfiler.b();
    }
  }