當前位置: 首頁>>代碼示例>>Java>>正文


Java Sign.getLocation方法代碼示例

本文整理匯總了Java中org.bukkit.block.Sign.getLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java Sign.getLocation方法的具體用法?Java Sign.getLocation怎麽用?Java Sign.getLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.block.Sign的用法示例。


在下文中一共展示了Sign.getLocation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onSelect

import org.bukkit.block.Sign; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSelect(PlayerInteractEvent event) {
    if (event.getClickedBlock().getState() instanceof Sign && event.getPlayer().equals(player) &&
            event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        Optional<SignRegistry> opRegistry = backend.getSignRegistry(gameName);
        if (opRegistry.isPresent()) {
            Sign sign = (Sign) event.getClickedBlock().getState();
            GameLocation location = new GameLocation(sign.getLocation(), true);
            opRegistry.get().put(location.toString(), new MutableMinigameSign(name, gameName,
                    location, command,
                    Arrays.asList(sign.getLines())));
            event.getPlayer().sendMessage(ChatColor.YELLOW + "Sign " + name + " has been created!");
        } else {
            event.getPlayer().sendMessage(ChatColor.RED +
                    "There was an error getting the sign registry for this game.");
        }
        HandlerList.unregisterAll(this);
    }
}
 
開發者ID:DemigodsRPG,項目名稱:demigames,代碼行數:20,代碼來源:SignSelectListener.java

示例2: SignHandle

import org.bukkit.block.Sign; //導入方法依賴的package包/類
public SignHandle(Sign sign, Navigator.Connector connector) {
    this.location = sign.getLocation();
    this.material = sign.getMaterialData();
    this.connector = connector;

    hoverEntities = CacheUtils.newCache(
        description -> new NMSHacks.FakeArmorStand(this.location.getWorld(), description.toLegacyText())
    );

    connector.startObserving(observer);

    paint();

    logger.fine("Created " + this);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:16,代碼來源:SignUpdater.java

示例3: isJoinSign

import org.bukkit.block.Sign; //導入方法依賴的package包/類
/**
 * Checks whether the given Sign is properly configured to be an JoinSign or
 * not.
 * 
 * @param sign
 *            The Sign for which the check should be done.
 * @return True if the signs.yml contains a correct value for the given Sign
 *         instance.
 */
public static boolean isJoinSign(Sign sign) {
	FileConfiguration fileConfiguration = SignConfiguration.getSignConfiguration();

	Location signPosition = sign.getLocation();

	Set<String> signs = ConfigFactory.getKeysUnderPath("signs", false, fileConfiguration);
	if (signs != null) {
		for (String signString : signs) {
			String path = "signs." + signString;
			String game = ConfigFactory.getString(path, "game", fileConfiguration);
			for (String gameName : GetGames.getGameNames(PluginLoader.getInstance().getConfig())) {
				if (game.trim().equalsIgnoreCase(gameName.trim())) {
					int x = ConfigFactory.getInt(path, "x", fileConfiguration);
					int y = ConfigFactory.getInt(path, "y", fileConfiguration);
					int z = ConfigFactory.getInt(path, "z", fileConfiguration);
					String world = ConfigFactory.getString(path, "world", fileConfiguration);
					Location signLocation = new Location(Bukkit.getWorld(world), x, y, z);
					if (signPosition.getBlockX() == x && signPosition.getBlockY() == y
							&& signPosition.getBlockZ() == z) {
						if (signLocation.getBlock().getState() instanceof Sign) {
							return true;
						}
					}
				}
			}
		}
	}

	return false;
}
 
開發者ID:KWStudios,項目名稱:RageMode,代碼行數:40,代碼來源:SignCreator.java

示例4: buySkull

import org.bukkit.block.Sign; //導入方法依賴的package包/類
public static void buySkull(BPPlayer bpPlayer, Sign sign, String[] lines)
{
	Player player = bpPlayer.getPlayer();
	String typeName = ChatColor.stripColor(lines[3]);
	SkullType skullType = SkullType.parse(typeName);
	boolean vip = skullType == null || skullType.isVip();
	
	if(!vip || player.hasPermission("Breakpoint.vip"))
	{
		Location bLoc = sign.getLocation();
		String nameColored = lines[3];
		int cost = SkullType.getCost(skullType);
		int exHours = 1;
		if(bLoc.equals(bpPlayer.getShopItemLocation()))
		{
			int money = bpPlayer.getMoney();
			
			if (money >= cost)
			{
				bpPlayer.addMoney(-cost, false, false);
				BPSkull bpSkull = new BPSkull(skullType != null ? skullType.name() : typeName, exHours * 60);
				InventoryMenuManager.saveLobbyMenu(bpPlayer);
				processBoughtItem(bpPlayer, bpSkull, player.hasPermission("Breakpoint.vip"));
				InventoryMenuManager.showLobbyMenu(bpPlayer);
				bpPlayer.getStatistics().increaseBought();
				Achievement.checkBought(bpPlayer);
				player.sendMessage(MessageType.SHOP_PURCHASE_ARMOR_SUCCESS.getTranslation().getValue(nameColored, cost));
			}
			else
				player.sendMessage(MessageType.SHOP_PURCHASE_NOTENOUGHEMERALDS.getTranslation().getValue());
			
			bpPlayer.setShopItemLocation(null);
		}
		else
		{
			if(!bpPlayer.hasSpaceInLobbyInventory())
			{
				player.sendMessage(MessageType.SHOP_PURCHASE_NOINVENTORYSPACE.getTranslation().getValue());
				return;
			}
			
			bpPlayer.setShopItemLocation(bLoc);
			player.sendMessage(MessageType.SHOP_PURCHASE_ARMOR_QUESTION.getTranslation().getValue(lines[3], cost, exHours));
		}
	}
	else
		player.sendMessage(MessageType.SHOP_PURCHASE_VIPSONLY.getTranslation().getValue());
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:49,代碼來源:ShopManager.java


注:本文中的org.bukkit.block.Sign.getLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。