本文整理匯總了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));
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}