Java 类org.bukkit.event.block.EntityBlockFormEvent 实例源码
项目:WorldGuardExtraFlagsPlugin
文件:BlockListener.java
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
{
if (WorldGuardExtraFlagsPlugin.isSupportFrostwalker())
{
BlockState newState = event.getNewState();
if (newState.getType() == Material.FROSTED_ICE)
{
if (event.getEntity() instanceof Player)
{
Player player = (Player)event.getEntity();
if (!WorldGuardUtils.hasBypass(player))
{
ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(newState.getLocation());
if (regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.FROSTWALKER) == State.DENY)
{
event.setCancelled(true);
}
}
}
}
}
}
项目:RedProtect
文件:RPGlobalListener.java
@EventHandler
public void onPlayerFrostWalk(EntityBlockFormEvent e) {
Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());
if (r != null){
return;
}
RedProtect.get().logger.debug("RPGlobalListener - EntityBlockFormEvent canceled? " + e.isCancelled());
if (e.getEntity() instanceof Player){
Player p = (Player) e.getEntity();
if (!RPConfig.getGlobalFlagBool(p.getWorld().getName()+".iceform-by.player") && !p.hasPermission("redprotect.bypass.world")){
e.setCancelled(true);
}
}
else if (!RPConfig.getGlobalFlagBool(e.getEntity().getWorld().getName()+".iceform-by.entity")){
e.setCancelled(true);
}
}
项目:bskyblock
文件:IslandGuard1_9.java
/**
* Handles Frost Walking on visitor's islands
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBlockForm(EntityBlockFormEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 " +e.getEventName());
}
if (e.getEntity() instanceof Player && e.getNewState().getType().equals(Material.FROSTED_ICE)) {
Player player= (Player) e.getEntity();
if (!Util.inWorld(player)) {
return;
}
if (player.isOp()) {
return;
}
// This permission bypasses protection
if (VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
// Check island
Island island = plugin.getIslands().getIslandAt(player.getLocation());
if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
return;
}
if (island !=null) {
if (island.getMembers().contains(player.getUniqueId()) || island.getFlag(SettingsFlag.PLACE_BLOCKS)) {
return;
}
}
// Silently cancel the event
e.setCancelled(true);
}
}
项目:EchoPet
文件:PetEntityListener.java
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockForm(EntityBlockFormEvent event) {
Entity e = event.getEntity();
if (ReflectionUtil.getEntityHandle(e) instanceof IEntityPet && event.getNewState().getType().equals(Material.SNOW)) {
event.setCancelled(true);
event.getNewState().setType(Material.AIR);
}
}
项目:WorldGuardFix
文件:Listeners.java
@EventHandler(ignoreCancelled = true)
public void disableFrostWalker(EntityBlockFormEvent e) {
if (config.checkEnabled(Config.Node.FROSTWALKER, e.getBlock().getLocation())
&& e.getEntity() instanceof Player
&& !wg.canBuild((Player) e.getEntity(), e.getBlock())) e.setCancelled(true);
}
项目:SonarPet
文件:PetEntityListener.java
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockForm(EntityBlockFormEvent event) {
Entity e = event.getEntity();
if (plugin.isPet(e) && event.getNewState().getType().equals(Material.SNOW)) {
event.setCancelled(true);
event.getNewState().setType(Material.AIR);
}
}
项目:RedProtect
文件:RPEntityListener.java
@EventHandler
public void onPlayerFrostWalk(EntityBlockFormEvent e) {
if (e.getEntity() instanceof Player){
return;
}
RedProtect.get().logger.debug("RPEntityListener - EntityBlockFormEvent canceled? " + e.isCancelled());
Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());
if (r != null && !r.canIceForm()){
e.setCancelled(true);
}
}
项目:RedProtect
文件:RPPlayerListener.java
@EventHandler(priority = EventPriority.LOW)
public void onPlayerFrostWalk(EntityBlockFormEvent e) {
if (!(e.getEntity() instanceof Player)){
return;
}
RedProtect.get().logger.debug("RPPlayerListener - EntityBlockFormEvent canceled? " + e.isCancelled());
Player p = (Player) e.getEntity();
Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());
if (r != null && e.getNewState().getType().name().contains("FROSTED_ICE") && !r.canIceForm(p)){
e.setCancelled(true);
}
}
项目:CraftBukkit
文件:EntitySnowman.java
public void e() {
super.e();
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
if (this.L()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
if (this.world.getBiome(i, k).a(i, j, k) > 1.0F) {
this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
for (int l = 0; l < 4; ++l) {
i = MathHelper.floor(this.locX + (double) ((float) (l % 2 * 2 - 1) * 0.25F));
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F));
if (this.world.getType(i, j, k).getMaterial() == Material.AIR && this.world.getBiome(i, k).a(i, j, k) < 0.8F && Blocks.SNOW.canPlace(this.world, i, j, k)) {
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState();
blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW));
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
项目:PlotSquared-Chinese
文件:PlayerEvents.java
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEntityBlockForm(final EntityBlockFormEvent e) {
final String world = e.getBlock().getWorld().getName();
if (!PlotSquared.isPlotWorld(world)) {
return;
}
if ((!(e.getEntity() instanceof Player))) {
if (MainUtil.isPlotArea(BukkitUtil.getLocation(e.getBlock().getLocation()))) {
e.setCancelled(true);
}
}
}
项目:Almura-Server
文件:EntitySnowman.java
public void c() {
super.c();
if (this.G()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
if (this.world.getBiome(i, j).j() > 1.0F) {
this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
for (i = 0; i < 4; ++i) {
j = MathHelper.floor(this.locX + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
int k = MathHelper.floor(this.locY);
int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));
if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).j() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
blockState.setTypeId(Block.SNOW.id);
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
项目:acidisland
文件:IslandGuard1_9.java
/**
* Handles Frost Walking on visitor's islands
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBlockForm(EntityBlockFormEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 " +e.getEventName());
}
if (e.getEntity() instanceof Player && e.getNewState().getType().equals(Material.FROSTED_ICE)) {
Player player= (Player) e.getEntity();
if (!IslandGuard.inWorld(player)) {
return;
}
if (player.isOp()) {
return;
}
// This permission bypasses protection
if (VaultHelper.checkPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
// Check island
Island island = plugin.getGrid().getIslandAt(player.getLocation());
if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
return;
}
if (island !=null) {
if (island.getMembers().contains(player.getUniqueId()) || island.getIgsFlag(SettingsFlag.PLACE_BLOCKS)) {
return;
}
}
// Silently cancel the event
e.setCancelled(true);
}
}
项目:Tweakkit-Server
文件:EntitySnowman.java
public void e() {
super.e();
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
if (this.L()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
if (this.world.getBiome(i, k).a(i, j, k) > 1.0F) {
this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
for (int l = 0; l < 4; ++l) {
i = MathHelper.floor(this.locX + (double) ((float) (l % 2 * 2 - 1) * 0.25F));
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F));
if (this.world.getType(i, j, k).getMaterial() == Material.AIR && this.world.getBiome(i, k).a(i, j, k) < 0.8F && Blocks.SNOW.canPlace(this.world, i, j, k)) {
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState();
blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW));
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
项目:askyblock
文件:IslandGuard1_9.java
/**
* Handles Frost Walking on visitor's islands
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBlockForm(EntityBlockFormEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 " +e.getEventName());
}
if (e.getEntity() instanceof Player && e.getNewState().getType().equals(Material.FROSTED_ICE)) {
Player player= (Player) e.getEntity();
if (!IslandGuard.inWorld(player)) {
return;
}
if (player.isOp()) {
return;
}
// This permission bypasses protection
if (VaultHelper.checkPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
// Check island
Island island = plugin.getGrid().getIslandAt(player.getLocation());
if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
return;
}
if (island !=null) {
if (island.getMembers().contains(player.getUniqueId()) || island.getIgsFlag(SettingsFlag.PLACE_BLOCKS)) {
return;
}
}
// Silently cancel the event
e.setCancelled(true);
}
}
项目:Cauldron
文件:EntitySnowman.java
public void onLivingUpdate()
{
super.onLivingUpdate();
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY);
int k = MathHelper.floor_double(this.posZ);
if (this.isWet())
{
this.attackEntityFrom(DamageSource.drown, 1.0F);
}
if (this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) > 1.0F)
{
this.attackEntityFrom(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
for (int l = 0; l < 4; ++l)
{
i = MathHelper.floor_double(this.posX + (double)((float)(l % 2 * 2 - 1) * 0.25F));
j = MathHelper.floor_double(this.posY);
k = MathHelper.floor_double(this.posZ + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F));
if (this.worldObj.getBlock(i, j, k).getMaterial() == Material.air && this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) < 0.8F && Blocks.snow_layer.canPlaceBlockAt(this.worldObj, i, j, k))
{
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.worldObj.getWorld().getBlockAt(i, j, k).getState();
blockState.setType(CraftMagicNumbers.getMaterial(Blocks.snow_layer));
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.worldObj.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled())
{
blockState.update(true);
}
// CraftBukkit end
}
}
}
项目:modules-extra
文件:ListenerEntityBlock.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityBlockForm(final EntityBlockFormEvent event)
{
ActionEntityBlock action = this.newAction(EntityForm.class, event.getBlock().getWorld());
if (action != null)
{
action.setNewBlock(event.getNewState());
this.setAndLog(action, event.getBlock().getState(), event.getEntity());
}
}
项目:modules-extra
文件:ListenerBlock.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockForm(BlockFormEvent event)
{
if (event instanceof EntityBlockFormEvent)
{
return;
}
this.setAndLog(BlockForm.class, event.getBlock().getState(), event.getNewState());
}
项目:Empirecraft
文件:OnEntityBlockForm.java
@EventHandler
public void onEntityBlockForm(EntityBlockFormEvent event) {
Block block = event.getBlock();
String world = block.getWorld().getUID().toString();
Integer x = block.getLocation().getChunk().getX(), z = block.getLocation().getChunk().getZ();
if (QuickChecks.isWorldChunkClaimed(serverdata.get("worldmap").get(world), x, z, "cla")) {
if (((HashMap) ((HashMap) serverdata.get("worldmap").get(world).get(x)).get(z)).containsKey("str")) {
event.setCancelled(true);
}
}
}
项目:SpigotSource
文件:EnchantmentFrostWalker.java
public static void a(EntityLiving entityliving, World world, BlockPosition blockposition, int i) {
if (entityliving.onGround) {
float f = (float) Math.min(16, 2 + i);
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(0, 0, 0);
Iterator iterator = BlockPosition.b(blockposition.a((double) (-f), -1.0D, (double) (-f)), blockposition.a((double) f, -1.0D, (double) f)).iterator();
while (iterator.hasNext()) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition1 = (BlockPosition.MutableBlockPosition) iterator.next();
if (blockposition_mutableblockposition1.g(entityliving.locX, entityliving.locY, entityliving.locZ) <= (double) (f * f)) {
blockposition_mutableblockposition.c(blockposition_mutableblockposition1.getX(), blockposition_mutableblockposition1.getY() + 1, blockposition_mutableblockposition1.getZ());
IBlockData iblockdata = world.getType(blockposition_mutableblockposition);
if (iblockdata.getBlock() == Blocks.AIR) {
IBlockData iblockdata1 = world.getType(blockposition_mutableblockposition1);
if (iblockdata1.getMaterial() == Material.WATER && ((Integer) iblockdata1.get(BlockFluids.LEVEL)).intValue() == 0 && world.a(Blocks.FROSTED_ICE, blockposition_mutableblockposition1, false, EnumDirection.DOWN, (Entity) null, (ItemStack) null)) {
// CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(blockposition_mutableblockposition1.getX(), blockposition_mutableblockposition1.getY(), blockposition_mutableblockposition1.getZ()).getState();
blockState.setType(CraftMagicNumbers.getMaterial(Blocks.FROSTED_ICE));
EntityBlockFormEvent event = new EntityBlockFormEvent(entityliving.bukkitEntity, blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
}
// CraftBukkit End
}
}
}
}
}
}
项目:Craft-city
文件:EntitySnowman.java
public void c() {
super.c();
if (this.F()) {
this.damageEntity(DamageSource.DROWN, 1);
}
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
if (this.world.getBiome(i, j).j() > 1.0F) {
this.damageEntity(CraftEventFactory.MELTING, 1); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
for (i = 0; i < 4; ++i) {
j = MathHelper.floor(this.locX + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
int k = MathHelper.floor(this.locY);
int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));
if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).j() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
blockState.setTypeId(Block.SNOW.id);
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
项目:ProjectAres
文件:AnvilTracker.java
@EventHandler(priority = EventPriority.MONITOR)
public void onLand(EntityBlockFormEvent event) {
AnvilInfo info = resolveEntity(event.getEntity());
if(info != null) blocks().trackBlockState(event.getNewState(), info);
}
项目:libelula
文件:EventListener.java
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
public void onEntityBlockForm(EntityBlockFormEvent e) {
e.setCancelled(true);
}
项目:SpigotSource
文件:EntitySnowman.java
public void n() {
super.n();
if (!this.world.isClientSide) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
if (this.ah()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
if (this.world.getBiome(new BlockPosition(i, 0, k)).a(new BlockPosition(i, j, k)) > 1.0F) {
this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
if (!this.world.getGameRules().getBoolean("mobGriefing")) {
return;
}
for (int l = 0; l < 4; ++l) {
i = MathHelper.floor(this.locX + (double) ((float) (l % 2 * 2 - 1) * 0.25F));
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F));
BlockPosition blockposition = new BlockPosition(i, j, k);
if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(new BlockPosition(i, 0, k)).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) {
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState();
blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW_LAYER));
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
}
项目:Shopkeepers
文件:LivingEntityShopListener.java
@EventHandler(ignoreCancelled = true)
void onEntityBlockForm(EntityBlockFormEvent event) {
if (plugin.isShopkeeper(event.getEntity())) {
event.setCancelled(true);
}
}