{ @EventHandler public void onEntityExplode(EntityExplodeEvent e) { Calendar c = Calendar.getInstance(); int hr = c.get(11); if (((hr >= 24) || (hr < 12)) && (e.getEntity().getType().equals(EntityType.PRIMED_TNT))) { e.setCancelled(true); } } @EventHandler(priority=EventPriority.HIGHEST) public void onBlock(BlockPlaceEvent e) { Player p = e.getPlayer(); Material m = e.getBlock().getType(); Location l = e.getBlock().getLocation(); int y = l.getBlockY(); if (m == Material.TNT) { if (y > 50) { e.setCancelled(true); p.sendMessage(ChatUtil.fixColor("§4Blad: §cTnT mozna stawiac od 50 kratki")); } } } @EventHandler public void onPlayerClick(PlayerInteractEvent e) { Player p = e.getPlayer(); if ((e.getAction() == Action.RIGHT_CLICK_BLOCK) && (p.getItemInHand().getType().equals(Material.EXPLOSIVE_MINECART)) && (p.getLocation().getY() > 50.0D)) { p.sendMessage(ChatUtil.fixColor( "&4Blad: &cMinecart z TNT mozna stawiac tylko od 50 poziomu w dol.")); e.setCancelled(true); return; } } @EventHandler public void onTNTPlace(BlockPlaceEvent e) { Material m = e.getBlockPlaced().getType(); Player p = e.getPlayer(); Calendar c = Calendar.getInstance(); int hr = c.get(11); if ((m == Material.TNT) && ((hr >= 24) || (hr < 12))) { e.setCancelled(true); p.sendMessage(ChatUtil.fixColor("§4TNT §7dziala w godzinach §c10:00 §7- §c22:00")); } } }