@Override public Location getLocation() { return base.getLocation(); }
@Override public Location getLocation(Location loc) { return base.getLocation(loc); }
/** * Get the center of the given block. * * @param blockState The {@link BlockState} of the block * @return A {@link Location} lying at the center of the block */ public static Location getBlockCenter(BlockState blockState) { return blockState.getLocation().add(0.5, 0.5, 0.5); }
@Override public MCLocation getLocation() { return new BukkitMCLocation(bs.getLocation()); }
@Override public SpellResult step(CastContext context) { BlockState tile = tiles.get(currentTile); actionContext.setTargetLocation(tile.getLocation()); return startActions(); }
public static void clearItems(BlockState block) { if (block != null && (block instanceof InventoryHolder || block.getType() == Material.FLOWER_POT)) { NMSUtils.clearItems(block.getLocation()); } }
public MgBlockData(BlockState original, MinigamePlayer modifier){ location = original.getLocation(); state = original; blockData = state.getBlockData().getAsString(); if(modifier !=null)playerUUID = modifier.getUUID(); }
Claim blockClaim = this.dataStore.getClaimAt(block.getLocation(), false, rootClaim);
public AlchemyBrewTask(BlockState brewingStand, Player player) { this.brewingStand = brewingStand; this.location = brewingStand.getLocation(); this.player = player; brewSpeed = DEFAULT_BREW_SPEED; brewTimer = DEFAULT_BREW_TICKS; if (player != null && !Misc.isNPCEntity(player) && Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)) { double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY)); McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis); mcMMO.p.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { brewSpeed = catalysis; } } if (Alchemy.brewingStandMap.containsKey(location)) { Alchemy.brewingStandMap.get(location).cancel(); } fuel = ((BrewingStand) brewingStand).getFuelLevel(); if (((BrewingStand) brewingStand).getBrewingTime() == -1) // Only decrement on our end if it isn't a vanilla ingredient. fuel--; Alchemy.brewingStandMap.put(location, this); this.runTaskTimer(mcMMO.p, 1, 1); }
if(BlockEventHandler.isActiveBlock(active)) if(this.contains(active.getLocation(), false, false))
} else return lowestXZ.getLocation();
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlocksPlace(BlockMultiPlaceEvent placeEvent) { Player player = placeEvent.getPlayer(); //don't track in worlds where claims are not enabled if(!GriefPrevention.instance.claimsEnabledForWorld(placeEvent.getBlock().getWorld())) return; //make sure the player is allowed to build at the location for(BlockState block : placeEvent.getReplacedBlockStates()) { String noBuildReason = GriefPrevention.instance.allowBuild(player, block.getLocation(), block.getType()); if(noBuildReason != null) { GriefPrevention.sendMessage(player, TextMode.Err, noBuildReason); placeEvent.setCancelled(true); return; } } }
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ); ParticleEffectUtils.playFluxEffect(blockState.getLocation()); return true;
@EventHandler(ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent event) { if (event instanceof BlockMultiPlaceEvent) return; BlockState previousState = event.getBlockReplacedState(); // Some blocks, like tall grass and fire, get replaced if (previousState.getType() != Material.AIR) { Events.fireToCancel(event, new BreakBlockEvent(event, create(event.getPlayer()), previousState.getLocation(), previousState.getType())); } if (!event.isCancelled()) { ItemStack itemStack = new ItemStack(event.getBlockPlaced().getType(), 1); Events.fireToCancel(event, new UseItemEvent(event, create(event.getPlayer()), event.getPlayer().getWorld(), itemStack)); } if (!event.isCancelled()) { Events.fireToCancel(event, new PlaceBlockEvent(event, create(event.getPlayer()), event.getBlock())); } if (event.isCancelled()) { playDenyEffect(event.getPlayer(), event.getBlockPlaced().getLocation().add(0.5, 0.5, 0.5)); } }
BlockState blockState = block.getState(); if (blockState != null && (blockState instanceof InventoryHolder || blockState.getType() == Material.FLOWER_POT)) { NMSUtils.clearItems(blockState.getLocation());
Location location = blockState.getLocation();
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
Field existingField = plugin.getForceFieldManager().getField(state.getLocation());