當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。