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


Java Material.SIGN_POST属性代码示例

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


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

示例5: 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

示例6: 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

示例7: 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

示例8: isSign

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

示例9: 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

示例10: 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


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