@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Location location = player.getLocation();
ItemStack item = event.getItem();
if (isBull(item) && event.getAction() == Action.RIGHT_CLICK_AIR | event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (!FactionsXL.getInstance().getBoard().isAnnexable(location)) {
ParsingUtil.sendMessage(player, FMessage.ERROR_LAND_NOT_FOR_SALE.getMessage());
return;
}
FactionCache factions = FactionsXL.getInstance().getFactionCache();
BookMeta meta = ((BookMeta) item.getItemMeta());
String title = meta.getTitle().replace(" ", "-");
if (factions.getByName(title) != null) {
title += NumberUtil.generateRandomInt(0, 100);
}
FireworkUtil.spawnRandom(location);
FactionsXL.getInstance().getFactionCache().create(player, title);
player.getInventory().remove(item);
}
}
FBull.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:FactionsXL
作者:
评论列表
文章目录