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


Java Sign.getY方法代碼示例

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


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

示例1: removeSign

import org.bukkit.block.Sign; //導入方法依賴的package包/類
public synchronized static boolean removeSign(Sign sign) {
	File file = SignConfiguration.getYamlSignsFile();
	FileConfiguration fileConfiguration = SignConfiguration.getSignConfiguration();

	int x = sign.getX();
	int y = sign.getY();
	int z = sign.getZ();
	String world = sign.getWorld().getName();
	String path = "signs." + Integer.toString(x) + Integer.toString(y) + Integer.toString(z) + world;

	if (fileConfiguration.contains(path)) {
		fileConfiguration.set(path, null);
		try {
			fileConfiguration.save(file);
			return true;
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
	}
	return false;
}
 
開發者ID:KWStudios,項目名稱:RageMode,代碼行數:23,代碼來源:SignCreator.java

示例2: getGameFromSign

import org.bukkit.block.Sign; //導入方法依賴的package包/類
public static String getGameFromSign(Sign sign) {
	FileConfiguration fileConfiguration = SignConfiguration.getSignConfiguration();

	int x = sign.getX();
	int y = sign.getY();
	int z = sign.getZ();
	String world = sign.getWorld().getName();
	String signString = Integer.toString(x) + Integer.toString(y) + Integer.toString(z) + world;
	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())) {
			return game;
		}
	}

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

示例3: getKitSign

import org.bukkit.block.Sign; //導入方法依賴的package包/類
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,代碼行數:8,代碼來源:Lobby.java

示例4: createNewSign

import org.bukkit.block.Sign; //導入方法依賴的package包/類
public synchronized static boolean createNewSign(Sign sign, String game) {
	File file = SignConfiguration.getYamlSignsFile();
	FileConfiguration fileConfiguration = SignConfiguration.getSignConfiguration();

	Set<String> signs = ConfigFactory.getKeysUnderPath("signs", false, fileConfiguration);
	if (signs != null) {
		if (signs.contains(Integer.toString(sign.getX()) + Integer.toString(sign.getY())
				+ Integer.toString(sign.getZ()) + sign.getWorld().getName())) {
			return false;
		}
	}

	int x = sign.getX();
	int y = sign.getY();
	int z = sign.getZ();
	String world = sign.getWorld().getName();
	String path = "signs." + Integer.toString(x) + Integer.toString(y) + Integer.toString(z) + world;

	ConfigFactory.setString(path, "game", game, fileConfiguration);
	ConfigFactory.setString(path, "world", world, fileConfiguration);
	ConfigFactory.setInt(path, "x", x, fileConfiguration);
	ConfigFactory.setInt(path, "y", y, fileConfiguration);
	ConfigFactory.setInt(path, "z", z, fileConfiguration);

	try {
		fileConfiguration.save(file);
		return true;
	} catch (IOException e) {
		e.printStackTrace();
		return false;
	}

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

示例5: onPlayerInteract

import org.bukkit.block.Sign; //導入方法依賴的package包/類
@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,代碼行數:47,代碼來源:GameEvents.java

示例6: sendSignChange

import org.bukkit.block.Sign; //導入方法依賴的package包/類
public static void sendSignChange(Player p, Sign sign, String[] arr) {
	Packet130UpdateSign packet = new Packet130UpdateSign(sign.getX(), sign.getY(), sign.getZ(), arr);
	((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:5,代碼來源:WorldUtil.java

示例7: create

import org.bukkit.block.Sign; //導入方法依賴的package包/類
public static void create(ChestShopLogger plugin, Sign sign, String[] signLines, Player player) {
	String world = sign.getWorld().getName();	
	int x = sign.getX();
	int y = sign.getY();
	int z = sign.getZ();
	double tpX = player.getLocation().getX();
	double tpY = player.getLocation().getY();
	double tpZ = player.getLocation().getZ();
	float tpYaw = player.getLocation().getYaw();
	float tpPitch = player.getLocation().getPitch();
	String ownerName = signLines[0];
	UUID ownerUUID = PlayerModel.getUUID(plugin, ownerName);
	int maxAmount = Integer.parseInt(signLines[1]);
	double buyPrice = PriceUtil.getBuyPrice(signLines[2]);
	double sellPrice = PriceUtil.getSellPrice(signLines[2]);
	String itemName = ShopManager.getItemName(signLines[3]);
	long created = System.currentTimeMillis();
	
	try {
		
		Connection con = plugin.getDBHandler().open();
		PreparedStatement st = con.prepareStatement("INSERT INTO chestshop_shop (world, x, y, z, tpx, tpy, tpz, tpyaw, tppitch, owneruuid, maxamount, buyprice, sellprice, itemname, created) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
		st.setString(1, world);
		st.setInt(2, x);
		st.setInt(3, y);
		st.setInt(4, z);
		st.setDouble(5, tpX);
		st.setDouble(6, tpY);
		st.setDouble(7, tpZ);
		st.setFloat(8, tpYaw);
		st.setFloat(9, tpPitch);
		if(ownerUUID != null) st.setString(10, ownerUUID.toString());
		else st.setString(10, null);
		st.setInt(11, maxAmount);
		st.setDouble(12, buyPrice);
		st.setDouble(13, sellPrice);
		st.setString(14, itemName);
		st.setLong(15, created);
		st.execute();
		st.close();
		con.close();
		
	} catch (SQLException ex) {
		ex.printStackTrace();
	}		
}
 
開發者ID:yeahwhat-mc,項目名稱:ChestShopLogger,代碼行數:47,代碼來源:ShopModel.java


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