當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockPhysicsEvent類代碼示例

本文整理匯總了Java中org.bukkit.event.block.BlockPhysicsEvent的典型用法代碼示例。如果您正苦於以下問題:Java BlockPhysicsEvent類的具體用法?Java BlockPhysicsEvent怎麽用?Java BlockPhysicsEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BlockPhysicsEvent類屬於org.bukkit.event.block包,在下文中一共展示了BlockPhysicsEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPhysics(BlockPhysicsEvent event) {
    if (event.isCancelled()) {
        return;
    }

    if (event.getBlock().getType() != Material.SAND && event.getBlock().getType() != Material.GRAVEL) {
        return;
    }

    if (!DeprecatedMethods.applyPhysics(event.getBlock())) {
        return;
    }

    BlockUpdate.Update(event.getBlock());
}
 
開發者ID:SamaGames,項目名稱:AntiCheat,代碼行數:17,代碼來源:OrebfuscatorBlockListener.java

示例2: PhysicsCheck

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
   public void PhysicsCheck(BlockPhysicsEvent event) {
       if (ConfigPatch.fixInfRail == true) {
           if (event.getChangedType().name().contains("RAIL")) {
               if(CheckFast()){
               	event.setCancelled(true);
               }
               LastCheckedTime = System.currentTimeMillis();
           }
           if (event.getChangedTypeId() == 165) {
           	if(CheckFast()){
               	event.setCancelled(true);
               }
               LastCheckedTime = System.currentTimeMillis();
           }
       }
   }
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:19,代碼來源:AntiInfRail.java

示例3: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPhysics(final BlockPhysicsEvent event) {
	if (!event.isCancelled()) {

		final Block block = event.getBlock();
		if (Craft_Hyperspace.hyperspaceBlocks.contains(block)) {
			event.setCancelled(true);
		}

		
		if ((block.getTypeId() == 63) || (block.getTypeId() == 68) || (block.getTypeId() == 50) || (block.getTypeId() == 75) || (block.getTypeId() == 76) || (block.getTypeId() == 65) || (block.getTypeId() == 64) || (block.getTypeId() == 71) || (block.getTypeId() == 70) || (block.getTypeId() == 72) || (block.getTypeId() == 143)) {
			Craft c = Craft.getCraft(block.getX(), block.getY(), block.getZ());
			if (c != null) {

				// if not iron door being controlled by circuit...
				if ((event.getChangedTypeId() != 0) && !(((block.getTypeId() == 71) || (block.getTypeId() == 64)) && ((event.getChangedTypeId() == 69) || (event.getChangedTypeId() == 77) || (event.getChangedTypeId() == 55) || (event.getChangedTypeId() == 70) || (event.getChangedTypeId() == 72) || (block.getTypeId() == 143) || (block.getTypeId() == 75) || (block.getTypeId() == 76) || (block.getTypeId() == 50)))) {

					event.setCancelled(true);
				}
			}
		}
		
	}
}
 
開發者ID:Maximuspayne,項目名稱:NavyCraft2-Lite,代碼行數:25,代碼來源:NavyCraft_BlockListener.java

示例4: e

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
    if (!f(world, blockposition, iblockdata)) {
        // CraftBukkit Start
        org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
        @SuppressWarnings("deprecation")
        BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
        world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
            return;
        }
        // CraftBukkit end
        this.b(world, blockposition, iblockdata, 0);
        world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
    }

}
 
開發者ID:MCCarbon,項目名稱:Carbon-2,代碼行數:18,代碼來源:BlockPlant.java

示例5: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockPhysics(final BlockPhysicsEvent event) {
	if (event.isCancelled())
		return;

	final Block block = event.getBlock();
	final WorldCoord coord = new WorldCoord(block);

	// Stop portal blocks from breaking
	if (BlockUtil.isStandableGateMaterial(block.getType()) && Gates.gateFromPortal(coord) != null) {
		event.setCancelled(true);
	}

	// Stop sand falling when part of the frame
	if (block.getType() == Material.SAND && Gates.gateFromFrame(coord) != null) {
		event.setCancelled(true);
	}

	return;
}
 
開發者ID:NoChanceSD,項目名稱:AncientGates,代碼行數:21,代碼來源:PluginBlockListener.java

示例6: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@Override
public void onBlockPhysics(BlockPhysicsEvent event) {
    final Block b = event.getBlock();
    long timeNow = getLocation().getWorld().getFullTime();
    Debugger.getInstance().debug(this + ": BUD physics: time=" + timeNow + ", lastPulse=" + lastPulse + ", duration=" + getDuration());
    if (timeNow - lastPulse > getDuration() + getQuiet() && isRedstoneActive()) {
        // emit a signal for one or more ticks
        lastPulse = timeNow;
        active = true;
        repaint(b);
        Bukkit.getScheduler().runTaskLater(getProviderPlugin(), new Runnable() {
            @Override
            public void run() {
                active = false;
                repaint(b);
            }
        }, duration);
    }
}
 
開發者ID:desht,項目名稱:sensibletoolbox,代碼行數:20,代碼來源:BlockUpdateDetector.java

示例7: e

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
    if (!this.f(world, blockposition, iblockdata)) {
        // CraftBukkit Start
        org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
        BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
        world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
            return;
        }
        // CraftBukkit end
        this.b(world, blockposition, iblockdata, 0);
        world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
    }

}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:17,代碼來源:BlockPlant.java

示例8: onBlockPhysicsChange

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler
public void onBlockPhysicsChange(BlockPhysicsEvent event) {
	if (event.getBlock().getState() instanceof Sign) {
		Sign droppedSign = (Sign) event.getBlock().getState();
		if (plugin.jailMan.isJailSign(droppedSign.getLine(0))) {
			if (plugin.jailMan.jailExists(droppedSign.getLine(1))) {
				plugin.jailMan.destroyCell(droppedSign.getLine(1),
						Integer.valueOf(droppedSign.getLine(2)));
				plugin.getLogger().info("[Zeus] Cell Destroyed");
			}
		}
	}

	/*
	 * Block pressurePlate = event.getBlock(); if
	 * (pressurePlate.getState().getType() == Material.WOOD_PLATE ||
	 * pressurePlate.getState().getType() == Material.STONE_PLATE) {
	 * 
	 * }
	 */
}
 
開發者ID:illegalprime,項目名稱:Zeus,代碼行數:22,代碼來源:ZeusEventHandler.java

示例9: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent event) {
    final Block physics = event.getBlock();
    if (physics.getRelative(BlockFace.DOWN).getType() != Material.AIR) {
        return;
    }
    final Sprout sprout = plugin.getWorldRegistry().remove(physics.getWorld().getName(), physics.getX(), physics.getY(), physics.getZ());
    final SaveThread thread = ((SaveThread) ThreadRegistry.get(physics.getWorld().getName()));
    if (thread != null) {
        thread.remove(physics.getLocation(), (SimpleSprout) sprout);
    }
    if (sprout == null) {
        return;
    }
    event.setCancelled(true);
    physics.setType(Material.AIR);
    ((SpoutBlock) physics).setCustomBlock(null);
    if (!sprout.getRequiredTools().isEmpty()) {
    	disperseDrops(sprout, physics, false);
    }
}
 
開發者ID:AlmuraDev,項目名稱:Sprout,代碼行數:22,代碼來源:SproutListener.java

示例10: checkBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void checkBlockPhysics(final BlockPhysicsEvent event) {
    BlockEventQuery query = new BlockEventQuery(event, event.getBlock().getState());
    for(EventRule rule : this.ruleContext.get(EventRuleScope.BLOCK_PHYSICS)) {
        if(rule.region().contains(event.getBlock()) && processQuery(rule, query)) break;
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:8,代碼來源:EventRuleMatchModule.java

示例11: handleBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
public void handleBlockPhysics(BlockPhysicsEvent event) {
    Block block = event.getBlock();

    if(this.waitingBlocks.remove(block)) {
        processBlock(block, block.isBlockPowered());
    }
}
 
開發者ID:Aleksey-Terzi,項目名稱:CastleGates,代碼行數:8,代碼來源:BridgeEventHandler.java

示例12: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent event) {
    Region region = this.regions.fetch(event.getBlock());
    FilterResult result = this.getFilterResult(region, RegionEventType.BLOCK_PHYSICS, null, null, event.getBlock());

    if (result.equals(FilterResult.DENY)) {
        event.setCancelled(true);
    }
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:10,代碼來源:RegionListeners.java

示例13: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
/**
 * Filters BlockPhysicsEvent, like redstone updating, or sand start falling.
 *
 * <p>Applies to: block physics<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent event) {
  Match match = Cardinal.getMatch(event.getWorld());
  if (match == null) {
    return;
  }
  for (AppliedRegion reg : get(match, ApplyType.BLOCK_PHYSICS)) {
    if (apply(reg, event.getBlock().getLocation(), null, event, event, event.getBlock())) {
      break;
    }
  }
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:18,代碼來源:AppliedModule.java

示例14: containsSetAir

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
protected boolean containsSetAir(Exception e, BlockPhysicsEvent event) {
    for (int frame = 25; frame < 35; frame++) {
        StackTraceElement elem = getElement(e, frame);
        if (elem != null) {
            String methodName = elem.getMethodName();
            // setAir (hacky, but this needs to be efficient)
            if (methodName.charAt(0) == 's' && methodName.length() == 6) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:14,代碼來源:ChunkListener.java

示例15: onBlockPhysics

import org.bukkit.event.block.BlockPhysicsEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPhysics(BlockPhysicsEvent e) {
	boolean cancelled = false;
	String w = e.getBlock().getWorld().getName();
	for (String p : worlds.keySet()) {
		for (int i = 0; i < worlds.get(p).size(); i++) {
			if (worlds.get(p).get(i).equals(w)) {
				if (!Minigame.getMinigameInstance(p).getConfigManager().areBlockPhysicsAllowed()) {
					e.setCancelled(true);
					cancelled = true;
					break;
				}
			}
		}
	}
	if (cancelled) {
		return;
	}
	Block adjBlock = MGUtil.getAttachedSign(e.getBlock());
	if (adjBlock != null) {
		for (Minigame mg : Minigame.getMinigameInstances()) {
			for (LobbySign l : mg.getLobbyManager().signs.values()) {
				if (l.getX() == adjBlock.getX() && l.getY() == adjBlock.getY() && l.getZ() == adjBlock.getZ() &&
						l.getWorld().equals(adjBlock.getWorld().getName())) {
					e.setCancelled(true);
					break;
				}
			}
		}
	}
}
 
開發者ID:myiume,項目名稱:MyiuLib,代碼行數:32,代碼來源:MGListener.java


注:本文中的org.bukkit.event.block.BlockPhysicsEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。