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


Java FallingBlock.remove方法代碼示例

本文整理匯總了Java中org.bukkit.entity.FallingBlock.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java FallingBlock.remove方法的具體用法?Java FallingBlock.remove怎麽用?Java FallingBlock.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.FallingBlock的用法示例。


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

示例1: fall

import org.bukkit.entity.FallingBlock; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private void fall(long pos, @Nullable ParticipantState breaker) {
    // Block must be removed BEFORE spawning the FallingBlock, or it will not appear on the client
    // https://bugs.mojang.com/browse/MC-72248
    Block block = blockAt(this.getMatch().getWorld(), pos);
    BlockState oldState = block.getState();
    block.setType(Material.AIR, false);
    FallingBlock fallingBlock = oldState.spawnFallingBlock();

    BlockFallEvent event = new BlockFallEvent(block, fallingBlock);
    getMatch().callEvent(breaker == null ? new BlockTransformEvent(event, block, Material.AIR)
                                         : new ParticipantBlockTransformEvent(event, block, Material.AIR, breaker));

    if(event.isCancelled()) {
        fallingBlock.remove();
        oldState.update(true, false); // Restore the old block if the fall is cancelled
    } else {
        // This is already air, but physics have not been applied yet, so do that now
        block.simulateChangeForNeighbors(oldState.getMaterialData(), new MaterialData(Material.AIR));
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:22,代碼來源:FallingBlocksMatchModule.java

示例2: claimPoint

import org.bukkit.entity.FallingBlock; //導入方法依賴的package包/類
private void claimPoint(Player player, Location location) {
    if(!this.currentLocations.containsKey(location)) return;
    final PointType pointType = (PointType) this.currentLocations.get(location)[0];
    final FallingBlock entity = (FallingBlock) this.currentLocations.get(location)[1];
    this.currentLocations.remove(location);
    entity.getWorld().playSound(entity.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1f, 1f);
    player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1f, 1.1f);
    entity.remove();
    ScoreSidebar scoreSidebar = ((ScoreSidebar) this.getSidebar());
    scoreSidebar.setScore(player, (scoreSidebar.getScore(player) + pointType.getPoints()));
    if(pointType == PointType.SUPER_BOOST) {
        player.setVelocity(new org.bukkit.util.Vector(0, 1.7D, 0));
    }
    this.spawnPoint();
}
 
開發者ID:ArcadiaPlugins,項目名稱:Arcadia-Spigot,代碼行數:16,代碼來源:TrampolinioGame.java

示例3: onGameEnd

import org.bukkit.entity.FallingBlock; //導入方法依賴的package包/類
@Subscribe
public void onGameEnd(GameEndEvent event) {
	if (task.isRunning()) {
		task.cancel();
	}
	
	for (FallingBlock block : fallingAnvils) {
		block.remove();
	}
}
 
開發者ID:xaniox,項目名稱:HeavySpleef,代碼行數:11,代碼來源:FlagAnvilSpleef.java

示例4: onBlockFall

import org.bukkit.entity.FallingBlock; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onBlockFall(EntityChangeBlockEvent event) {
    if (Zones.inNoDemigodsZone(event.getBlock().getLocation())) return;
    if (event.getEntityType() != EntityType.FALLING_BLOCK || event.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.AIR))
        return;
    FallingBlock block = (FallingBlock) event.getEntity();
    Location blockLocation = block.getLocation();
    if (DemigodsStructureType.Util.isInRadiusWithFlag(DemigodsLocation.getFloorBelowLocation(block.getLocation()), DemigodsStructureType.Flag.NO_GRIEFING)) {
        // Break the block
        event.setCancelled(true);
        event.getBlock().setType(Material.AIR);
        blockLocation.getWorld().dropItemNaturally(blockLocation, new ItemStack(block.getMaterial()));
        block.remove();
    }
}
 
開發者ID:DemigodsRPG,項目名稱:Demigods3,代碼行數:16,代碼來源:GriefListener.java

示例5: onDisable

import org.bukkit.entity.FallingBlock; //導入方法依賴的package包/類
public void onDisable() {

		for(XPlayer xp : getManagers().getPlayerManager().getPlayers()) {
			xp.save();
		}

		if(getUUIDManager().isExecutorServiceRunning()) {
			getUUIDManager().shutdownExecutorService();
		}
		getManagers().getPlayerManager().clear();
		if(conf.getEntityConfig().isRealisticGlassEnabled()) {
			getManagers().getRealisticGlassManager().saveGlassBlocks();
		}
		if(conf.getChatConfig().isRssBroadcastEnabled()) {
			getManagers().getRssManager().saveLastFeed();
		}

		if(getManagers().getGreylistManager().isRunning()) {
			SimpleServer server = getManagers().getGreylistManager();
			log("stopping server " + server.getName() + " at port " + server.getPort(), LogType.INFO);
			try {
				server.stopServer();
				log("server successfully stopped!", LogType.INFO);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		if(getManagers().getBroadcastManager().isRunning()) {
			getManagers().getBroadcastManager().stop();
		}

		if(conf.getEntityConfig().isExplosionRegenEnabled()) {
			for(World w : Bukkit.getWorlds()) {
				for(Entity entity : w.getEntities()) {
					if(entity instanceof FallingBlock) {
						FallingBlock fb = (FallingBlock)entity;
						if(fb.getMaterial() != Material.GRAVEL || fb.getMaterial() != Material.SAND || fb.getMaterial() != Material.TNT) {
							fb.remove();
						}
					}
				}
			}
			getManagers().getExplosionRegenManager().saveRegenObjects();
			if(conf.getMiscConfig().isChairsEnabled()) {
				getManagers().getChairManager().killAll();	
			}
		}
		if(conf.getEntityConfig().isRealisticWaterEnabled()) {
			getManagers().getRealisticWaterManager().stop();
		}
		log("has been disabled!", LogType.INFO);
		
		getManagers().getMinigamesManager().disablePlugins();
	}
 
開發者ID:xEssentials,項目名稱:xEssentials-deprecated-bukkit,代碼行數:56,代碼來源:xEssentials.java


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