Message

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

@EventHandler

public void onInventoryClicsk(InventoryClickEvent event) {


if (event.getClickedInventory() != null &&
event.getClickedInventory().getType() == InventoryType.ANVIL) {
//
// ItemStack result = event.getClickedInventory().getItem(2);
// if (result != null && result.getType() != Material.AIR) {
//
// ItemMeta meta = result.getItemMeta();
// if (meta != null && meta.hasDisplayName()) {
// event.getWhoClicked().sendMessage("Gracz " +
event.getWhoClicked().getName() +
// " połączył " + meta.getDisplayName());
// } else {
// event.getWhoClicked().sendMessage("Gracz " +
event.getWhoClicked().getName() +
// " połączył " + result.getAmount() + " x " +
result.getType().toString());
// }

Block block = isLocationNearBlock(event.getWhoClicked().getLocation(),


new ArrayList<Integer>(Collections.singletonList(Material.ANVIL.getId())) {
}, 10);

Location locationBlock = new Location(event.getWhoClicked().getWorld(),


block.getX() + 0.5, block.getY() + 1.6, block.getZ() + 0.5);
Hologram hologram = hologramMap.get(locationBlock);

String[] a = hologram.getLines().get(0).toString().split(" ");


String b = a[0].replace("§6", "").replace("TextLine{text=", "");
int c = Integer.parseInt(b);

c = c - 1;

int type = 0;

if (c == 2) type = 1;
if (c == 1) type = 2;

MaterialData materialData = new MaterialData(type);

event.getWhoClicked().getWorld().getBlockAt(block.getLocation()).setType(Material.A
NVIL);
final BlockFace face = block.getFace(block);
block.setData(this.getDirection(face));

if (c == 0) {
hologram.delete();
block.breakNaturally();
} else {
hologram.getLines().clear();
hologram.getLines().appendText("§6" + c + " §fużyc");
}
}
}

You might also like