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


Java Material.WALL_SIGN属性代码示例

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


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

示例1: exists

public boolean exists(Sign sign)
{
    try
    {
        if (Bukkit.getWorld(sign.getPosition().getWorld()) != null)
        {
            Location location = toLocation(sign.getPosition());
            return location.getBlock().getType() == Material.SIGN_POST || location.getBlock().getType() == Material.WALL_SIGN;
        } else
        {
            return false;
        }
    } catch (Throwable ex)
    {
        return false;
    }
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:17,代码来源:SignSelector.java

示例2: onProjectileHit

@EventHandler
public void onProjectileHit(ProjectileHitEvent event)
{
    if (event.getEntity().getType() != EntityType.SNOWBALL || !event.getEntity().hasMetadata("paintball-ball") || !event.getEntity().getMetadata("paintball-ball").get(0).asString().equals(this.uuid.toString()))
        return;

    for (Block block : getNearbyBlocks(event.getEntity().getLocation(), 2))
    {
        if (block.getType() == Material.AIR || block.getType() == Material.SIGN || block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
            continue;

        if (this.isBlockGloballyUsed(block.getLocation()))
            continue;

        SimpleBlock simpleBlock = new SimpleBlock(Material.STAINED_CLAY, DyeColor.values()[new Random().nextInt(DyeColor.values().length)].getWoolData());
        this.addBlockToUse(block.getLocation(), simpleBlock);

        block.setType(simpleBlock.getType());
        block.setData(simpleBlock.getData());
    }

    event.getEntity().remove();
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:23,代码来源:PaintballDisplayer.java

示例3: updateSign

public void updateSign(int gameNumber) {
	GameSign gameSign = signJoinGames.get(gameNumber);
	if (gameSign != null) {
		World world = SkyWarsReloaded.get().getServer().getWorld(gameSign.getWorld());
		if (world != null) {
			Block b = world.getBlockAt(gameSign.getX(), gameSign.getY(), gameSign.getZ());
			if(b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN_POST) {
				Sign s = (Sign) b.getState();
				meteSign = (org.bukkit.material.Sign) b.getState().getData();
				Block attachedBlock = b.getRelative(meteSign.getAttachedFace());
				String state = getStatusName(getGame(gameNumber));
				setMaterial(getStatus(getGame(gameNumber)), attachedBlock);
				int max = getGame(gameNumber).getNumberOfSpawns();
				int count = getGame(gameNumber).getPlayers().size();
				if (s != null) {
					s.getBlock().getChunk().load();
					s.setLine(0, new Messaging.MessageFormatter().format("signJoinSigns.line1"));
					s.setLine(1, new Messaging.MessageFormatter().setVariable("mapName", gameSign.getName().toUpperCase()).format("signJoinSigns.line2"));
					s.setLine(2, new Messaging.MessageFormatter().setVariable("gameStatus", state).format("signJoinSigns.line3"));
					s.setLine(3, new Messaging.MessageFormatter().setVariable("count", "" + count).setVariable("max", "" + max).format("signJoinSigns.line4"));
					s.update();
				}
			}
		}
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:26,代码来源:GameController.java

示例4: isShopBlockNearby

private boolean isShopBlockNearby(Block b) {
	if (b == null) {
		return false;
	}
	Block nearChest = null;
	if (b.getType() == Material.CHEST) {
		nearChest = getBlockNearby(b, Material.CHEST);
	} else if (b.getType() == Material.TRAPPED_CHEST) {
		nearChest = getBlockNearby(b, Material.TRAPPED_CHEST);
	}
	if (nearChest == null) {
		return false;
	}
	for (BlockFace face : BLOCKFACE) {
		Block maybeSign = nearChest.getRelative(face);
		if (maybeSign != null && Material.WALL_SIGN == maybeSign.getType()) {
			Sign sign = (Sign) maybeSign.getState();
			if (sign.getLines().length > 0 && sign.getLines()[0].contains(cm.quickshopSignFlag)) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:24,代码来源:AntiQuickShopDoubleChest.java

示例5: updateSignContent

/**
 * Update the sign content according to the sign registration
 * @param sr
 * @return
 */
public static boolean updateSignContent(SignRegistration sr) {
    Block b = sr.location.getBlock();
    if (b.getType() != Material.SIGN_POST && b.getType() != Material.WALL_SIGN)
        return false;
    Sign s = (Sign)b.getState();
    s.setLine(0, I18n.format("user.tp.sign_title"));
    s.setLine(1, sr.description);
    if (sr.acquired) {
        s.setLine(2, String.format("%.0f %.0f %.0f", sr.targetLocation.getX(), sr.targetLocation.getY(),sr.targetLocation.getZ()));
        s.setLine(3, String.format("%.1f", sr.teleportFee));
    } else {
        s.setLine(2, I18n.format("user.tp.available"));
        s.setLine(3, String.format("%.1f", sr.acquireFee));
    }
    s.update();
    return true;
}
 
开发者ID:NyaaCat,项目名称:CapCat,代码行数:22,代码来源:SignDatabase.java

示例6: onPlayerInteractEvent

@EventHandler
public void onPlayerInteractEvent(PlayerInteractEvent event)
{
    if (event.getClickedBlock() != null)
    {
        Material material = event.getClickedBlock().getType();

        if (material == Material.SIGN || material == Material.SIGN_POST || material == Material.WALL_SIGN)
        {
            Sign sign = (Sign) event.getClickedBlock().getState();

            if (sign.hasMetadata("game") && sign.hasMetadata("map"))
            {
                AbstractGame game = this.hub.getGameManager().getGameByIdentifier(sign.getMetadata("game").get(0).asString());
                GameSign gameSign = game.getGameSignsByMap(sign.getMetadata("map").get(0).asString()).get(0);

                if (SamaGamesAPI.get().getPermissionsManager().hasPermission(event.getPlayer(), "hub.debug.sign") && event.getPlayer().isSneaking())
                {
                    gameSign.developperClick(event.getPlayer());
                    return;
                }

                gameSign.click(event.getPlayer());
            }
        }
        else if (material == Material.SKULL)
        {
            Optional<AbstractGame> optional = this.hub.getGameManager().getGames().values().stream().filter(game -> game.getWebsiteDescriptionSkull().getBlock().getLocation().equals(event.getClickedBlock().getLocation())).findAny();

            if (optional.isPresent() && optional.get().getWebsiteDescriptionURL() != null)
                optional.get().showRulesWarning(event.getPlayer());
        }
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:34,代码来源:PlayerListener.java

示例7: signRemoved

@EventHandler
  public void signRemoved(BlockBreakEvent event) {
      Location blockLocation = event.getBlock().getLocation();
      World w = blockLocation.getWorld();
  	Block b = w.getBlockAt(blockLocation);
if(b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN_POST){
   	Sign sign = (Sign) b.getState();
   	String line1 = ChatColor.stripColor(sign.getLine(0));
	if (line1.equalsIgnoreCase(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', new Messaging.MessageFormatter().format("signJoinSigns.line1"))))) {
          	 String world = blockLocation.getWorld().getName().toString();
       		 int x = blockLocation.getBlockX();
       		 int y = blockLocation.getBlockY();
       		 int z = blockLocation.getBlockZ();
       		 File signJoinFile = new File(SkyWarsReloaded.get().getDataFolder(), "signJoinGames.yml");
       		 if (signJoinFile.exists()) {
       			FileConfiguration storage = YamlConfiguration.loadConfiguration(signJoinFile);
                  for (String gameNumber : storage.getConfigurationSection("games.").getKeys(false)) {
                  	String world1 = storage.getString("games." + gameNumber + ".world");
                  	int x1 = storage.getInt("games." + gameNumber + ".x");
                  	int y1 = storage.getInt("games." + gameNumber + ".y");
                  	int z1 = storage.getInt("games." + gameNumber + ".z");
                  	if (x1 == x && y1 == y && z1 == z && world.equalsIgnoreCase(world1)) {
                  		if (event.getPlayer().hasPermission("swr.signs")) {
                        		SkyWarsReloaded.getGC().removeSignJoinGame(gameNumber);
                        	} else {
                        		event.setCancelled(true);
                          	event.getPlayer().sendMessage(ChatColor.RED + "YOU DO NOT HAVE PERMISSION TO DESTROY SWR SIGNS");
                  		}
                  	}
             	 	} 
       		 }
           }
}
  }
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:34,代码来源:SignListener.java

示例8: getKitSign

public Sign getKitSign(Sign s) {
	for (Block b : kitSigns) 
		if (b.getX() == s.getX() && b.getY() == s.getY() && b.getZ() == s.getZ())
			if (b.getType() == Material.SIGN || b.getType() == Material.WALL_SIGN)
				return (Sign) b.getState();
	return null;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:7,代码来源:Lobby.java

示例9: onSignClick

@EventHandler
public void onSignClick(PlayerInteractEvent event) {
	if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_AIR)
		return;
	
	Block b = event.getClickedBlock();
	if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN) {
		Sign sign = (Sign) b.getState();
		SignClickEvent ev = new SignClickEvent(event.getPlayer(), sign, event.getClickedBlock(), event.getAction() == Action.RIGHT_CLICK_BLOCK);
		Bukkit.getServer().getPluginManager().callEvent(ev);
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:12,代码来源:GeneralEvents.java

示例10: Portal

public Portal(String name, Block sign) {
	this.name = name;
	if (sign.getType() != Material.WALL_SIGN)
		this.sign = (Sign) sign.getState();
	
	list.add(this);
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:7,代码来源:Portal.java

示例11: ServerSign

public ServerSign(String name, String identifier, Block sign) {
	this.name = name;
	this.identifier = identifier;
	if (sign.getType() != Material.WALL_SIGN)
		this.sign = (Sign) sign.getState();
	
	list.add(this);
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:8,代码来源:ServerSign.java

示例12: isSign

public static boolean isSign(Material material) {
    return material == Material.SIGN_POST || material == Material.WALL_SIGN;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:3,代码来源:Materials.java

示例13: signPlaced

@EventHandler
public void signPlaced(SignChangeEvent event) {
    String[] lines = event.getLines();
    if (lines[0].equalsIgnoreCase("[swr]")) {
    	if (event.getPlayer().hasPermission("swr.signs")) {
    		if (SkyWarsReloaded.getCfg().signJoinMode()) {
    			Location signLocation = event.getBlock().getLocation();
                World w = signLocation.getWorld();
            	Block b = w.getBlockAt(signLocation);
            	if(b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN_POST){
           			event.setCancelled(true);
		        	String world = event.getPlayer().getWorld().getName();
		        	Location spawn = SkyWarsReloaded.getCfg().getSpawn();
		        	if (spawn != null) {
		        		String lobbyWorld = spawn.getWorld().getName();
    		    		if (world.equalsIgnoreCase(lobbyWorld)) {
                   			boolean added = SkyWarsReloaded.getGC().addSignJoinGame(signLocation, lines[1].toLowerCase());
                   			if (added) {
                   				event.getPlayer().sendMessage(ChatColor.GREEN + "Game Sign Succefully Added");
                   			} else {
                   				event.getPlayer().sendMessage(ChatColor.GREEN + "There is no map with that Name");
                   			}
               			} else {
               				event.getPlayer().sendMessage(ChatColor.RED + "SWR SIGNS CAN ONLY BE PLACED IN THE LOBBY WORLD");
               				event.setCancelled(true);
               			}
		        	} else {
           				event.getPlayer().sendMessage(ChatColor.RED + "YOU MUST SET SPAWN IN THE LOBBY WORLD WITH /SWR SETSPAWN BEFORE STARTING A GAME");
           				SkyWarsReloaded.get().getLogger().info("YOU MUST SET SPAWN IN THE LOBBY WORLD WITH /SWR SETSPAWN BEFORE STARTING A GAME");
           				event.setCancelled(true);
           			}
            	}
    		} else {
        		event.getPlayer().sendMessage(ChatColor.RED + "SIGN JOIN MODE IS NOT ENABLED");
    			event.setCancelled(true);
    		}
        } else {
        		event.getPlayer().sendMessage(ChatColor.RED + "YOU DO NOT HAVE PERMISSION TO CREATE SWR SIGNS");
    			event.setCancelled(true);
    } 
   }
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:42,代码来源:SignListener.java

示例14: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
	Player player = e.getPlayer();
	GamePlayer gPlayer = SkyWarsReloaded.getPC().getPlayer(player.getUniqueId());
   	if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
   		 if (e.getClickedBlock().getType() == Material.WALL_SIGN || e.getClickedBlock().getType() == Material.SIGN_POST ) {
   				 Sign s = (Sign) e.getClickedBlock().getState();
   				 String line1 = ChatColor.stripColor(s.getLine(0));
   				 if (line1.equalsIgnoreCase(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', new Messaging.MessageFormatter().format("signJoinSigns.line1"))))) {
   		        		if (SkyWarsReloaded.getCfg().signJoinMode()) {
   		        			Location spawn = SkyWarsReloaded.getCfg().getSpawn();
   		        			if (spawn != null) {
   		        				String world = s.getBlock().getWorld().getName();
       	    		        	String lobbyWorld = spawn.getWorld().getName();
       	    		    		if (world.equalsIgnoreCase(lobbyWorld)) {
          	       	         		 int x = s.getBlock().getX();
          	    	         		 int y = s.getBlock().getY();
          	    	         		 int z = s.getBlock().getZ();
          	    	         		 File signJoinFile = new File(SkyWarsReloaded.get().getDataFolder(), "signJoinGames.yml");
          	    	         		 if (signJoinFile.exists()) {
          	    	         			FileConfiguration storage = YamlConfiguration.loadConfiguration(signJoinFile);
          	    	                    for (String gameNumber : storage.getConfigurationSection("games.").getKeys(false)) {
          	    	                    	String world1 = storage.getString("games." + gameNumber + ".world");
          	    	                    	int x1 = storage.getInt("games." + gameNumber + ".x");
          	    	                    	int y1 = storage.getInt("games." + gameNumber + ".y");
          	    	                    	int z1 = storage.getInt("games." + gameNumber + ".z");
          	    	                    	if (x1 == x && y1 == y && z1 == z && world.equalsIgnoreCase(world1)) {
          	    	                    		if (e.getPlayer().hasPermission("swr.play")) {
          	    	                    			Game game = SkyWarsReloaded.getGC().getGame(Integer.valueOf(gameNumber));
          	    	                    			if (game != null) {
          	        	                    			if (!game.isFull() && game.getState() == GameState.PREGAME) {
          	        	                    				game.addPlayer(gPlayer);
          	        	                    			}
          	    	                    			}
          	    	                    		}
          	    	                    	}	
          	    	                    }
          	    	                  }
       	    		    		} else {
       	    		    			e.getPlayer().sendMessage(ChatColor.RED + "YOU CAN ONLY JOIN GAMES THROUGH SIGNS IN THE LOBBY WORLD");
       	    		    		}
   		        			}
   	    	             } else {
   	    	            		e.getPlayer().sendMessage(ChatColor.RED + "SIGN JOIN MODE IS NOT ENABLED");
   	    	        }
   		        }
   		 }
   	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:49,代码来源:SignListener.java

示例15: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
	if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
		return;
	
	if (event.getClickedBlock().getType() != Material.WALL_SIGN)
		return;
	
	Sign sign = (Sign) event.getClickedBlock().getState();
   	Game game = null;
   	for (Game g : Game.getList()) {
   		String line_1 = Chat.stripColor(sign.getLine(0));
   		String line_2 = Chat.stripColor(sign.getLine(1));
   		if (g.getLine_1().equalsIgnoreCase(line_1))
       		if (g.getLine_2().equalsIgnoreCase(line_2))
   				game = g;
   	}
   	
   	if (game != null) {
   		boolean exists = false;
   		for (Block b : game.getSigns()) {
   			if (b.getX() == sign.getX() && b.getY() == sign.getY() && b.getZ() == sign.getZ()) {
   				exists = true;
   				break;
   			}
   		}
   		
   		if (!exists) {
   			game.getSigns().add(sign.getBlock());
   		}
   		
   		Rank r = Gamer.get(event.getPlayer()).getRank();
   		if (game.getPlayers() >= game.getMaxPlayers()) {
   			if (r.getType() == RankType.USER) {
   				Chat.player(event.getPlayer(), "&4[Lobby] &cThat server is full! Donate to join full servers!");
   				Chat.player(event.getPlayer(), "&4[Lobby] &7Visit &ewww.mczone.co/shop &7to upgrade.");
   				return;
   			}
   		}
   		
   		Chat.player(event.getPlayer(), "&7&oConnecting you to " + game.getTitle());
   		Util.connect(event.getPlayer(), game.getAddress());
   		
   		return;
   	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:46,代码来源:GameEvents.java


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