当前位置: 首页>>代码示例>>Java>>正文


Java BlockPlaceEvent.getPlayer方法代码示例

本文整理汇总了Java中org.bukkit.event.block.BlockPlaceEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPlaceEvent.getPlayer方法的具体用法?Java BlockPlaceEvent.getPlayer怎么用?Java BlockPlaceEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.block.BlockPlaceEvent的用法示例。


在下文中一共展示了BlockPlaceEvent.getPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlaceDropper

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceDropper(final BlockPlaceEvent e) {
	if (!cm.tileLimitEnabled) {
		return;
	}
	if (e.getBlock().getType() == Material.DROPPER) {
		Player p = e.getPlayer();
		if (p.isOp()) {
			return;
		}
		int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.dropper.");
		if (limit <= 0) {
			limit = cm.tileLimitDefaultDropper;
		}
		if (isLimit(e.getBlock().getLocation(), Material.DROPPER, limit)) {
			e.setCancelled(true);
			p.sendMessage(i18n.tr("message", limit));
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:21,代码来源:TilesLimiter.java

示例2: PlaceCheckDoor

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
 public void PlaceCheckDoor(BlockPlaceEvent e) {
     if(ConfigPatch.AntiInfSuagrenable){
if(e.isCancelled()){
	Player p = e.getPlayer();
             List<Entity> entities = p.getNearbyEntities(2, 2, 2);
             for(int i=0;i<entities.size();i++){
                 Entity ent = entities.get(i);
                 if(ent.getType() == EntityType.DROPPED_ITEM){
                     Item item = (Item)ent;
                     if(item.getItemStack().getType() == Material.SUGAR_CANE||item.getItemStack().getType() == Material.CACTUS){
                         ent.remove();
                     }
                 }
             }
}
     }
 }
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:19,代码来源:AntiInfSuagr.java

示例3: onPlaceDispenser

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceDispenser(final BlockPlaceEvent e) {
	if (!cm.tileLimitEnabled) {
		return;
	}
	if (e.getBlock().getType() == Material.DISPENSER) {
		Player p = e.getPlayer();
		if (p.isOp()) {
			return;
		}
		int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.dispenser.");
		if (limit <= 0) {
			limit = cm.tileLimitDefaultDispenser;
		}
		if (isLimit(e.getBlock().getLocation(), Material.DISPENSER, limit)) {
			e.setCancelled(true);
			p.sendMessage(i18n.tr("message", limit));
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:21,代码来源:TilesLimiter.java

示例4: onPlaceHopper

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceHopper(final BlockPlaceEvent e) {
	if (!cm.tileLimitEnabled) {
		return;
	}
	if (e.getBlock().getType() == Material.HOPPER) {
		Player p = e.getPlayer();
		if (p.isOp()) {
			return;
		}
		int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.hopper.");
		if (limit <= 0) {
			limit = cm.tileLimitDefaultHopper;
		}
		if (isLimit(e.getBlock().getLocation(), Material.HOPPER, limit)) {
			e.setCancelled(true);
			p.sendMessage(i18n.tr("message", limit));
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:21,代码来源:TilesLimiter.java

示例5: onBlockBreak

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
public void onBlockBreak(BlockPlaceEvent event) {
    if (event.isCancelled()) {
        Player player = event.getPlayer();
        if (player.getGameMode() == GameMode.CREATIVE || player.getAllowFlight()) {
            return;
        }

        Block block = event.getBlockPlaced();
        if (block.getType().isSolid() && !(block.getState() instanceof Sign)) {
            int playerY = player.getLocation().getBlockY();
            int blockY = block.getLocation().getBlockY();
            if (playerY > blockY) {
                Vector vector = player.getVelocity();
                vector.setX(-0.1);
                vector.setZ(-0.1);
                player.setVelocity(vector.setY(vector.getY() - 0.41999998688697815D)); // Magic number acquired from EntityLiving#bj()
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:22,代码来源:BlockJumpGlitchFixListener.java

示例6: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event) {
    Block block = event.getBlockPlaced();
    ItemStack stack = event.getItemInHand();
    Player player = event.getPlayer();
    if (block.getState() instanceof CreatureSpawner && stack.hasItemMeta()) {
        ItemMeta meta = stack.getItemMeta();

        if (meta.hasLore() && meta.hasDisplayName()) {
            CreatureSpawner spawner = (CreatureSpawner) block.getState();
            List<String> lore = meta.getLore();
            if (!lore.isEmpty()) {
                String spawnerName = ChatColor.stripColor(lore.get(0).toUpperCase());
                Optional<EntityType> entityTypeOptional = GuavaCompat.getIfPresent(EntityType.class, spawnerName);
                if (entityTypeOptional.isPresent()) {
                    spawner.setSpawnedType(entityTypeOptional.get());
                    spawner.update(true, true);
                    player.sendMessage(ChatColor.AQUA + "Placed a " + ChatColor.BLUE + spawnerName + ChatColor.AQUA + " spawner.");
                }
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:24,代码来源:CrowbarListener.java

示例7: BlockPlaceEvent

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void BlockPlaceEvent(BlockPlaceEvent e){
    Player p = e.getPlayer();
    Block b = e.getBlock();

    if (e.getItemInHand().getType() == Material.DROPPER && e.getItemInHand().getEnchantments() != null && e.getItemInHand().getEnchantments().containsKey(Enchantment.ARROW_DAMAGE)) {
        Casino c = new Casino(e.getBlockPlaced().getLocation());
        c.effect();
    }

    for(Entity en : p.getNearbyEntities (4D, 4D, 4D)){
        if (en instanceof Player){
            if(en == p) continue;
            if(b.getType() == Material.FIRE){

                if(Files.user.getBoolean("Users." + en.getName() + ".pvp") == false){
                    p.sendMessage(Utils.colorize(PAData.SURVIVAL.getPrefix() + ChatColor.DARK_RED + " No puedes poner ese bloque cerca de un jugador con el pvp desactivado."));
                    e.setCancelled(true);
                }
            }
        }
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:24,代码来源:PlayerEvents.java

示例8: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
    Player player = event.getPlayer();
    Block b = event.getBlock();
    b.setMetadata("blockBreaker", new FixedMetadataValue(PrisonPicks.getInstance(), player.getUniqueId()));
}
 
开发者ID:ThePhilderbeast,项目名称:prisonPicks,代码行数:8,代码来源:Events.java

示例9: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
	Player player = e.getPlayer();
	if (!player.hasPermission("superiorcraft.editworld")) {
		e.setCancelled(true);
		player.sendMessage(ChatColor.RED + "You may not place blocks here");
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:9,代码来源:SuperiorCraft.java

示例10: onBlockPlaced

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlaced(BlockPlaceEvent e) {
    Player player = e.getPlayer();
    GamePlayer gPlayer = SkyWarsReloaded.getPC().getPlayer(player.getUniqueId());

    if (gPlayer.inGame()) {
    	gPlayer.setBlocks(gPlayer.getBlocks() + 1);
    }
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:10,代码来源:PlayerListener.java

示例11: onBlockPlaceEvent

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlaceEvent(BlockPlaceEvent e) {
	Player player = e.getPlayer();
	if (!hasIgnorePermission(player)) {
		 if (inLobbyWorld(player) && SkyWarsReloaded.getCfg().playerBuildDisabled()) {
				e.setCancelled(true);
		 }
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:10,代码来源:LobbyListener.java

示例12: onPlaceWithItemVisibility

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlaceWithItemVisibility(BlockPlaceEvent e) {
	Player p = e.getPlayer();
	
	if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Enable")) {
		if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Option.Ultimate-Protection-Of-The-Items")) {
			if ((p.getItemInHand().getItemMeta().getDisplayName() == Check) || (p.getItemInHand().getItemMeta().getDisplayName() == CheckTwo)) {
				e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:13,代码来源:CustomJoinItem.java

示例13: onPlacePistion

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlacePistion(final BlockPlaceEvent e) {
	if (!cm.tileLimitEnabled) {
		return;
	}
	Player p = e.getPlayer();
	if (p.isOp()) {
		return;
	}
	Material type = e.getBlock().getType();
	Material checkType = null;
	if (type == Material.PISTON_BASE) {
		checkType = Material.PISTON_BASE;
	} else if (type == Material.PISTON_STICKY_BASE) {
		checkType = Material.PISTON_STICKY_BASE;
	}
	if (checkType != null) {
		int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.piston.");
		if (limit <= 0) {
			limit = cm.tileLimitDefaultPiston;
		}
		if (isLimit(e.getBlock().getLocation(), Material.DISPENSER, limit)) {
			e.setCancelled(true);
			p.sendMessage(i18n.tr("message", limit));
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:28,代码来源:TilesLimiter.java

示例14: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent e) {
    final Player player = e.getPlayer();
    if(player != null) {
        DACManager.getBackend().checkFastPlace(player);
    }
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:8,代码来源:BlockListener.java

示例15: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent event)
{
  Player player = event.getPlayer();
  Material block = event.getBlock().getType();
  if ((modMode.contains(player.getName())) &&
    (block == Material.CARPET)) {
    event.setCancelled(true);
    player.updateInventory();
  }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:12,代码来源:ModeratorMode.java


注:本文中的org.bukkit.event.block.BlockPlaceEvent.getPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。