本文整理汇总了Java中org.bukkit.block.Sign.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Sign.getX方法的具体用法?Java Sign.getX怎么用?Java Sign.getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.block.Sign
的用法示例。
在下文中一共展示了Sign.getX方法的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;
}
示例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 "";
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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();
}
}