本文整理匯總了Java中org.bukkit.event.block.BlockPhysicsEvent.setCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockPhysicsEvent.setCancelled方法的具體用法?Java BlockPhysicsEvent.setCancelled怎麽用?Java BlockPhysicsEvent.setCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.block.BlockPhysicsEvent
的用法示例。
在下文中一共展示了BlockPhysicsEvent.setCancelled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
}
}
示例2: 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);
}
}
}
}
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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;
}
}
}
}
}
示例7: onBlockPhysics
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
@EventHandler(priority=EventPriority.LOWEST)
public void onBlockPhysics(BlockPhysicsEvent event) {
long now = System.currentTimeMillis();
if (now - last < 20) {
if (count > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
event.setCancelled(true);
}
count++;
}
else {
count = 0;
}
last = now;
}
示例8: onBlockPhysics
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockPhysics(BlockPhysicsEvent event) {
if(event.getChangedType() == Material.PORTAL || event.getBlock().getType() == Material.PORTAL) {
String portal = this.module.getPortalManager().getPortal(event.getBlock().getLocation());
if(portal != null) {
event.setCancelled(true);
}
}
}
示例9: onBlockPhysics
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
/**
* Called when block physics occurs.
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent ev)
{
if (ev.getBlock().getType() != Material.PORTAL) return;
// Only cancelled when a block is placed (changedType = air), or a block is destroyed, which is not portal or obsidian
if (ev.getChangedType() != Material.PORTAL && ev.getChangedType() != Material.OBSIDIAN)
ev.setCancelled(true);
}
示例10: onIndirectSignBreak
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onIndirectSignBreak(BlockPhysicsEvent event) {
if(event.getBlock().getType() == Material.SIGN_POST || event.getBlock().getType() == Material.WALL_SIGN) {
// Check if the rent sign is really the same as a saved rent
if(SignsFeature.getSignByLocation(event.getBlock().getLocation()) != null) {
// Cancel the sign breaking, will create a floating sign but at least it is not disconnected/gone
event.setCancelled(true);
}
}
}
示例11: signDetachCheck
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
/**
* Block physics event handler<br>
* remove detached death chest signs from game to prevent players gaining additional signs
* @param event
*/
@EventHandler
public void signDetachCheck(BlockPhysicsEvent event) {
Block block = event.getBlock();
// if event is cancelled, do nothing and return
if (event.isCancelled()) {
return;
}
// if block is not a DeathChestBlock, do nothing and return
if (!DeathChestBlock.isDeathChestBlock(block)) {
return;
}
// if block is not a sign, do nothing and return
if (block.getType() != Material.WALL_SIGN && block.getType() != Material.SIGN_POST) {
return;
}
Sign sign = (Sign)block.getState().getData();
Block attached_block = block.getRelative(sign.getAttachedFace());
// if attached block is still there, do nothing and return
if (attached_block.getType() != Material.AIR) {
return;
}
// cancel event
event.setCancelled(true);
// destroy DeathChestBlock
plugin.chestManager.destroyDeathChestBlock(block);
}
示例12: onBlockPhysics
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
@Override
public void onBlockPhysics(BlockPhysicsEvent event) {
// ensure carpet layer doesn't get popped off (and thus not cleared) when block is broken
if (event.getBlock().getType() == Material.CARPET) {
event.setCancelled(true);
}
}
示例13: psycic
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
@EventHandler
public void psycic(BlockPhysicsEvent e) {
if(e.isCancelled()) {
return;
}
if(e.getBlock().getType() == Material.PORTAL) {
for(Portal portal : pl.getConfiguration().getPortalConfig().getPortals().values()) {
if(portal.getInnerBlocks().contains(e.getBlock())) {
e.setCancelled(true);
}
}
}
}
示例14: onPsyics
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
@EventHandler
public void onPsyics(BlockPhysicsEvent e) {
if(e.isCancelled()) {
return;
}
if(e.getBlock().getType() == Material.PORTAL) {
for(Portal portal : pl.getConfiguration().getPortalConfig().getPortals().values()) {
if(portal.getInnerBlocks().contains(e.getBlock())) {
e.setCancelled(true);
break;
}
}
}
}
示例15: onPhysicsEvent
import org.bukkit.event.block.BlockPhysicsEvent; //導入方法依賴的package包/類
/**
*
* @param bpe
*/
@EventHandler
public void onPhysicsEvent(final BlockPhysicsEvent bpe) {
if (DataHandler.isBlueprintBlock(bpe.getBlock())) {
DataHandler.updateBlock(bpe.getBlock());
bpe.setCancelled(true);
}
}